Skip to contents

Common interface to train a model. The learning method is provided in trainer

Usage

train(trainer, features, ...)

# S4 method for Trainer,ANY
train(
  trainer,
  x,
  y,
  weights = NULL,
  offset = NULL,
  resp.type,
  observations = NULL,
  features = NULL,
  ...
)

# S4 method for Trainer,missing
train(trainer, features, ...)

# S4 method for Trainer,list
train(
  trainer,
  x,
  y,
  weights = NULL,
  offset = NULL,
  resp.type,
  observations = NULL,
  features,
  logger = Logger(verbose = FALSE),
  ...
)

Arguments

trainer

a Trainer object providing the learning method

features

(optional) indices of predictors to keep

...

additional arguments to training method

x

the input matrix, where rows are observations and columns are variables.

y

the response variable. Its number of rows must match the number of rows of x.

weights

priors of the observations

offset

used only for GLM methods, it is an a priori known component to be included in the linear predictor during fitting

resp.type

the response type

observations

(optional) indices of observations to keep

Value

a Trained object or a TrainedList object if learning method runs multiple configurations (i.e. multiple sets of hyper-parameters).

Results are merged into one TrainedList object

Author

Alessandro Barberis