Training | R Documentation |
This is a primary classes of fuseMLR. An object from this class is designed to contain multiple training layers, but only one meta training layer.
The Training class is structured as followed:
TrainLayer: Specific layer containing:
Lrner: Specific learner. This must be set by the user.
TrainData: Specific training dataset. This must be set up by the user.
Model: Specific model. This is set up by training the learner on the training data.
TrainMetaLayer: Basically a TrainLayer, but with some specific properties.
Lrner: This is the meta learner, it must be set up by the user.
TrainData: Specific modality-specific prediction data. This is set up internally after cross-validation.
Model: Specific meta model. This is set up by training the learner on the training data.
Use the function train
for training and predict
for predicting.
fuseMLR::HashTable
-> Training
new()
constructor
Training$new( id, ind_col, target, target_df, problem_type = "classification", verbose = TRUE )
id
character
ind_col
character
Name of column of individuals IDS.
target
character
Name of the target variable.
target_df
data.frame
Data frame with two columns: individual IDs and response variable values.
problem_type
character
Either "classification" or "regression".
verbose
boolean
Warning messages will be displayed if set to TRUE.
print()
Printer
Training$print(...)
...
any
trainLayer()
Train each layer of the current Training.
Training$trainLayer(ind_subset = NULL, use_var_sel = FALSE, verbose = TRUE)
ind_subset
character
Subset of individuals IDs to be used for training.
use_var_sel
boolean
If TRUE, selected variables available at each layer are used.
verbose
boolean
Warning messages will be displayed if set to TRUE.
Returns the object itself, with a model for each layer.
predictLayer()
Predicts values given new data.
Training$predictLayer(testing, ind_subset = NULL)
testing
TestData
Object of class TestData.
ind_subset
vector
Subset of individuals IDs to be used for training.
A new Training with predicted values for each layer.
createMetaTrainData()
Creates a meta training dataset and assigns it to the meta layer.
Training$createMetaTrainData( resampling_method, resampling_arg, use_var_sel, impute = TRUE )
resampling_method
function
Function for internal validation.
resampling_arg
list
List of arguments to be passed to the function.
use_var_sel
boolean
If TRUE, selected variables available at each layer are used.
impute
boolean
If TRUE, mode or median based imputation is performed on the modality-specific predictions.
The current object is returned, with a meta training dataset assigned to the meta layer.
train()
Trains the current object. All leaners and the meta learner are trained.
Training$train( ind_subset = NULL, use_var_sel = FALSE, resampling_method = NULL, resampling_arg = list(), seed = NULL )
ind_subset
vector
ID subset to be used for training.
use_var_sel
boolean
If TRUE, variable selection is performed before training.
resampling_method
function
Function for internal validation. If not specify, the resampling
function from the package caret
is used for a 10-folds cross-validation.
resampling_arg
list
List of arguments to be passed to the function.
seed
integer
Random seed. Default is NULL, which generates the seed from R
.
The current object is returned, with each learner trained on each layer.
predict()
Compute predictions for a testing object.
Training$predict(testing, ind_subset = NULL)
testing
Testing
A new testing object to be predicted.
ind_subset
vector
Vector of IDs to be predicted.
The predicted object. All layers and the meta layer are predicted. This is the final predicted object.
varSelection()
Variable selection on the current training object.
Training$varSelection(ind_subset = NULL, verbose = TRUE)
ind_subset
vector
ID subset of individuals to be used for variable selection.
verbose
boolean
Warning messages will be displayed if set to TRUE.
The current layer is returned with the resulting model.
getTargetValues()
Gather target values from all layer.
Training$getTargetValues()
A data.frame
containing individuals IDs and corresponding target values.
getIndIDs()
Gather individual IDs from all layer.
Training$getIndIDs()
A data.frame
containing individuals IDs.
getLayer()
Get a layer of a given ID.
Training$getLayer(id)
id
character
The ID of the layer to be returned.
The TrainLayer object is returned for the given ID.
getTrainMetaLayer()
Getter of the meta layer.
Training$getTrainMetaLayer()
Object from class TrainMetaLayer
getModel()
Retrieve models from all layer.
Training$getModel()
A list
containing all (base and meta) models.
getData()
Retrieve modality-specific predictions.
Training$getData()
A list
containing all (base and meta) models.
removeLayer()
Remove a layer of a given ID.
Training$removeLayer(id)
id
character
The ID of the layer to be removed.
The TrainLayer object is returned for the given ID.
removeTrainMetaLayer()
Remove the meta layer from the current Training object.
Training$removeTrainMetaLayer()
getIndCol()
Getter of the individual column name.
Training$getIndCol()
getTarget()
Getter of the target variable name.
Training$getTarget()
getVerbose()
Getter of the verbose setting.
Training$getVerbose()
getUseVarSel()
Getter of the use_var_sel field.
Training$getUseVarSel()
getVarSelDone()
Getter of the use_var_sel field.
Training$getVarSelDone()
increaseNbTrainedLayer()
Increase the number of trained layer.
Training$increaseNbTrainedLayer()
checkTargetExist()
Check whether a target object has already been stored.
Training$checkTargetExist()
Boolean value
getTargetObj()
Getter of the target object.
Training$getTargetObj()
getProblemTyp()
Getter of the problem type.
Training$getProblemTyp()
setImpute()
Set imputation action na.action.
Training$setImpute(impute)
impute
character
How to handle missing values.
testOverlap()
Test that individuals overlap over layers. At least five individuals must overlapped.
Training$testOverlap()
upset()
UpSet plot to show an overview of the overlap of individuals across various layers.
Training$upset(...)
...
any
Further parameters to be passed to the upset
function from package UpSetR
.
summary()
Generate training summary
Training$summary()
TrainLayer
Testing and Predicting
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.