VarSel: Varsel Class

VarSelR Documentation

Varsel Class

Description

This class implements a learner. A VarSel object can only exist as a component of a TrainLayer or a TrainMetaLayer object.

Methods

Public methods


Method new()

Variable selection parameter list.

Learner ID.

Usage
VarSel$new(
  id,
  package = NULL,
  varsel_fct,
  varsel_param,
  train_layer,
  na_action = "na.rm"
)
Arguments
id

character
Package that implements the variable selection function. If NULL, the variable selection function is called from the current environment.

package

character
Variable selection function name. Note: Variable selection functions, except Boruta, must return a vector of selected variables.

varsel_fct

character
Variable selection parameters.

varsel_param

list
Layer on which the learner is stored.

train_layer

TrainLayer
The training layer where to store the learner.

na_action

character
Handling of missing values in meta-data. Set to "na.keep" to keep missing values, "na.rm" to remove individuals with missing values or "na.impute" (only applicable on meta-data) to impute missing values in meta-data. Only median and mode based imputations are actually handled. With the "na.keep" option, ensure that the provided learner can handle missing values. If TRUE, the individuals with missing predictor values will be removed from the training dataset.


Method print()

Printer

Usage
VarSel$print(...)
Arguments
...

any


Method summary()

Summary

Usage
VarSel$summary(...)
Arguments
...

any


Method interface()

Learner and prediction parameter interface. Use this function to provide how the following parameters are named in the learning function (lrn_fct) you provided when creating the learner, or in the predicting function.

Usage
VarSel$interface(
  x = "x",
  y = "y",
  object = "object",
  data = "data",
  extract_var_fct = NULL
)
Arguments
x

string
Name of the argument to pass the matrix of independent variables in the original learning function.

y

string
Name of the argument to pass the response variable in the original learning function.

object

string
Name of the argument to pass the model in the original predicting function.

data

character
Name of the argument to pass new data in the original predicting function.

extract_var_fct

character or function
If the variable selection function that is called does not return a vector, then use this argument to specify a (or a name of a) function that can be used to extract vector of selected variables. Default value is NULL, if selected variables are in a vector.


Method varSelection()

Tains the current learner (from class Lrner) on the current training data (from class TrainData).

Usage
VarSel$varSelection(ind_subset = NULL)
Arguments
ind_subset

vector
Individual ID subset on which the training will be performed.

Returns

The resulting model, from class Model, is returned.


Method getTrainLayer()

The current layer is returned.

Usage
VarSel$getTrainLayer()
Returns

TrainLayer object.


Method getId()

Getter of the current learner ID.

Usage
VarSel$getId()
Returns

The current learner ID.


Method getPackage()

Getter of the variable selection package implementing the variable selection function.

Usage
VarSel$getPackage()
Returns

The name of the package implementing the variable selection function.


Method getVarSubSet()

Getter of the list of selected variables.

Usage
VarSel$getVarSubSet()
Returns

List of selected variables..


Method getParamInterface()

The current parameter interface is returned.

Usage
VarSel$getParamInterface()
Returns

A data.frame of interface.


Method getNaAction()

The current layer is returned.

Usage
VarSel$getNaAction()

Method getExtractVar()

The function to extract selected variables is returned.

Usage
VarSel$getExtractVar()
Returns

A data.frame of interface.


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