CV: CV Class

Description Usage Arguments Value Super class Active bindings Methods

Description

A class defines a cross-validation task specification.

Usage

1
new_cv(options = NULL, keys = NULL, fit_param = NULL)

Arguments

options

Options class object.

keys

A named character vector of keys.

fit_param

A list of fit parameters.

Value

A new CV class object

Super class

ml4e::Task -> CV

Active bindings

fit_param

A list of fit parameters.

fit_call

A fit call.

cv_pred

A data.frame of cross-validation predictions.

test_pred

A data.frame of test predictions.

pred

A data.frame of all predictions.

cv_score

A list of cross-validation score.

test_score

A list of test score.

error_count

A list of error counts against folds

error_count_str

A character of error counts.

done

A logical if finished

Methods

Public methods

Inherited methods

Method new()

Construct a new CV class object.

Usage
CV$new(options = NULL, keys = NULL, fit_param = NULL)
Arguments
options

A Options class object.

keys

A named character vector of keys.

fit_param

A list of fit parameters. If NULL, keys must have "fit_param" key.

Returns

A new CV class object


Method print()

Print object.

Usage
CV$print()

Method get_resample()

Get a resample.

Usage
CV$get_resample(seed = NULL)
Arguments
seed

A integer scalar seed.

Returns

A resample of rset class object.


Method convert_data()

Convert data by self$data_call.

Usage
CV$convert_data(data)
Arguments
data

A data.frame or rsplit object to be converted.

Returns

A converted data appropreate for the model input.


Method fit()

Fit model by self$fit_call.

Usage
CV$fit(data = NULL)
Arguments
data

A data.frame or rsplit object.

Returns

A model fitted object.


Method predict()

Predict by a model.

Usage
CV$predict(fitted = NULL, new_data = NULL, ids = NULL)
Arguments
fitted

A model fitted object.

new_data

A data.frame to be predicted.

ids

A integer vector of row indexes.

Returns

A data.frame of predicted values.


Method get_fitted()

Get a fitted object by all training data.

Usage
CV$get_fitted()

Method do()

Run a cross-validation. The result will be stored in self$result.

Usage
CV$do(cv_seed = TRUE)
Arguments
cv_seed

A logical scalar whether to use self$cv_seed. If FALSE, then self$search_seed is used.


Method clone()

The objects of this class are cloneable with this method.

Usage
CV$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


five-dots/ml4e documentation built on June 19, 2020, 4:26 p.m.