createTrainLayer: createTrainLayer

createTrainLayerR Documentation

createTrainLayer

Description

Creates and stores a TrainLayer on the Training object passed as argument. The main components of a training layer are training data modality, a variable selection methods, and a modality-specific learner.

Usage

createTrainLayer(
  training,
  train_layer_id,
  train_data,
  varsel_package = NULL,
  varsel_fct = NULL,
  varsel_param = list(),
  lrner_package = NULL,
  lrn_fct,
  param_train_list = list(),
  param_pred_list = list(),
  na_action = "na.rm",
  x_varsel = "x",
  y_varsel = "y",
  x_lrn = "x",
  y_lrn = "y",
  object = "object",
  data = "data",
  extract_pred_fct = NULL,
  extract_var_fct = NULL
)

Arguments

training

Training
Training object for storing the created layer.

train_layer_id

character
ID of the TrainLayer to be created.

train_data

data.frame
Data modality to be stored on the layer.

varsel_package

character
Package name containing the variable selection algorithm function. Defaults to NULL if the function exists in the current working environment.

varsel_fct

character
Variable selection function name. Default value is NULL for no variable selection. If specified, the function must accept at least two parameters: x (predictors) and y (response values), and return a vector of selected variables. Alternatively, use the interface parameters x_varsel and y_varsel to map the original argument names, and extract_var_fct to specify how to extract the vector of selected variables. An exception is made for the Boruta function, which includes an internal adjustment and requires no additional modifications.

varsel_param

list
List of arguments to be passed to varsel_fct.

lrner_package

character
Name of the package containing the learning algorithm function. Defaults to NULL if the function is available in the current working environment.

lrn_fct

character
Name of the learning function. The function must accept at least two parameters: x (predictors) and y (response values) and return a model. Alternatively, use the interface parameters x_lrn and y_lrn to map these names to the original arguments in your function. The returned model must support the generic predict function (with arguments object and data) to generate predictions for new data. Predictions should be either a vector or a list containing a vector named predictions with the predicted values.
If the arguments object and data have different names in your predict function, use the interface parameters below to map them to the original names. Additionally, if predictions are stored as a matrix or data.frame (e.g., predicted probabilities for dichotomous classification), only the second column (assumed to be class 1 probabilities) will be used. If the predicted values are not returned in one of the formats mentioned above, use the extract_pred_fct argument below to specify how to extract the predicted values from the prediction object.

param_train_list

character
List of arguments to be passed to lrn_fct.

param_pred_list

character
List of arguments to be passed to predict when generating predictions.

na_action

character
Handling of missing values in data during training. Set to "na.keep" to retain missing values, or "na.rm" to remove instances with missing values.

x_varsel

character
If the name of the argument used by the provided original variable selection function to pass the matrix of independent variable is not x, use this argument to specify how it is called in the provided function.

y_varsel

character
If the name of the argument used by the provided original variable selection function to pass the target variable is not y, use this argument to specify how it is called in the provided function.

x_lrn

character
If the name of the argument used by the provided original learning function to pass the matrix of independent variable is not x, use this argument to specify how it is called in the provided function.

y_lrn

character
If the name of the argument used by the provided original learning function to pass the target variable is not y, use this argument to specify how it is called in the provided function.

object

character
The generic function predict uses the parameter object to pass a model. If the corresponding argument is named differently in your predict function, specify its name.

data

character
The generic function predict uses a parameter data to pass new data. If the corresponding argument is named differently in your predict function, specify the name.

extract_pred_fct

⁠character or function⁠
If the predict function called for the model does not return a vector, use this argument to specify a function (or the name of a function) to extract the vector of predictions. The default value is NULL if predictions are returned as a vector.

extract_var_fct

⁠character or function⁠
If the variable selection function does not return a vector, use this argument to specify a function (or the name of a function) to extract the vector of selected variables.

Value

The updated Training object (with the new layer) is returned.

References

Fouodo C.J.K, Bleskina M. and Szymczak S. (2024). fuseMLR: An R package for integrative prediction modeling of multi-omics data, paper submitted.

See Also

createTrainMetaLayer and fusemlr.


fuseMLR documentation built on April 3, 2025, 8:49 p.m.