Resampler {flowml} | R Documentation |
Resampler
Description
Model validation by repeated bootstrapping
Format
[R6::R6Class] object.
Details
Uses repeated bootstrapping to validate models without a test data set. For each experiment multiple metrics are measured. For classification experiments the confusion matrix is calculated additionally. In order to test hypotheses, either features or the response variable can be permuted.
Active bindings
permute
returns the instance variable 'permute'. (character)
permute_alphabet
returns the instance variable 'permute_alphabet'. (character)
n_resample
returns the instance variable 'n_resample'. (integer)
fml_method
returns the instance variable 'fml_method'. (character)
fml_type
returns the instance variable 'fml_type'. (character)
fml_type_alphabet
returns the instance variable 'fml_type_alphabet'. (character)
pre_process_lst
returns the instance variable 'pre_process_lst'. (character)
hyper_parameters
returns the instance variable 'hyper_parameters'. (list)
response_var
returns the instance variable 'response_var'. (character)
n_features
returns the instance variable 'n_features'. (integer)
strata_var
returns the instance variable 'strata_var'. (character)
metrics_df
returns the instance variable 'metrics_df'. (tibble::tibble)
confusion_df
returns the instance variable 'confusion_df'. (tibble::tibble)
Methods
Public methods
Method new()
checks, if permutation is requested. If true, performs the permutation task.
Checks if ml.type is classification. If true, calculates confusion matrix.
Creates and returns instance of Resampler class.
Usage
Resampler$new( n_resample = 500, fml_method = "pcr", fml_type = "classification", hyper_parameters = "list", pre_process_lst = c("center", "scale"), permute = NULL, n_features = 0, response_var = "character", strata_var = NULL )
Arguments
n_resample
number of bootstrap resamples. The default is 500 (integer)
fml_method
ML model that is being used. The default is 'pcr' (character).
fml_type
ML model type. Needs to be 'classification', 'regression' or 'censored'. Default is 'classification' (character).
hyper_parameters
List of model hyper parameters. (list)
pre_process_lst
Vector of pre-processing steps. Default is 'c("center", "scale")' (character).
permute
Permutation method. Needs to be 'none', 'features' or 'response'. (character)
n_features
Number of features to be chosen in the permutation experiment. Default is 0 (integer).
response_var
Response variable of the model (character).
strata_var
Stratification variable (character).
Returns
Resampler
Method print()
Print instance variables of Resampler class.
Usage
Resampler$print()
Returns
character
Method fit()
Runs the bootstrap analysis based on the instance variables chosen under initialize.
Usage
Resampler$fit(data_df = "tbl_df")
Arguments
data_df
data set to be analyzed (tibble::tibble).
Returns
None
Method clone()
The objects of this class are cloneable with this method.
Usage
Resampler$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Sebastian Malkusch