| 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
permutereturns the instance variable 'permute'. (character)
permute_alphabetreturns the instance variable 'permute_alphabet'. (character)
n_resamplereturns the instance variable 'n_resample'. (integer)
fml_methodreturns the instance variable 'fml_method'. (character)
fml_typereturns the instance variable 'fml_type'. (character)
fml_type_alphabetreturns the instance variable 'fml_type_alphabet'. (character)
pre_process_lstreturns the instance variable 'pre_process_lst'. (character)
hyper_parametersreturns the instance variable 'hyper_parameters'. (list)
response_varreturns the instance variable 'response_var'. (character)
n_featuresreturns the instance variable 'n_features'. (integer)
strata_varreturns the instance variable 'strata_var'. (character)
metrics_dfreturns the instance variable 'metrics_df'. (tibble::tibble)
confusion_dfreturns 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_resamplenumber of bootstrap resamples. The default is 500 (integer)
fml_methodML model that is being used. The default is 'pcr' (character).
fml_typeML model type. Needs to be 'classification', 'regression' or 'censored'. Default is 'classification' (character).
hyper_parametersList of model hyper parameters. (list)
pre_process_lstVector of pre-processing steps. Default is 'c("center", "scale")' (character).
permutePermutation method. Needs to be 'none', 'features' or 'response'. (character)
n_featuresNumber of features to be chosen in the permutation experiment. Default is 0 (integer).
response_varResponse variable of the model (character).
strata_varStratification 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_dfdata 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
deepWhether to make a deep clone.
Author(s)
Sebastian Malkusch