Given a Task, creates a model for the learning machine which can be used for predictions on new data.

train(learner, task, subset = NULL, weights = NULL)

## Arguments

learner (Learner | character(1)) The learner. If you pass a string the learner will be created via makeLearner. (Task) The task. (integer | logical | NULL) Selected cases. Either a logical or an index vector. By default NULL if all observations are used. (numeric) Optional, non-negative case weight vector to be used during fitting. If given, must be of same length as subset and in corresponding order. By default NULL which means no weights are used unless specified in the task (Task). Weights from the task will be overwritten.

## Value

(WrappedModel).

training.set = sample(seq_len(nrow(iris)), nrow(iris) / 2)
mod = train(learner, task, subset = training.set)#> Error: Please use column names for xprint(mod)#> Error in print(mod): object 'mod' not found
mod = train(learner, task, subset = training.set)#> Error: Please use column names for xprint(mod)#> Error in print(mod): object 'mod' not found