train(mlr)R Documentation

train

Description

Given a learn.task train creates a model for the learning machine which can be used for predictions on new data.

Usage

train(learn.task, subset, parset, vars)

Arguments

learn.task [learn.task]
Specifies learning task.
subset [integer]
An index vector specifying the training cases from the data contained in the learning task. By default the complete dataset is used.
parset [list]
Named list which contains the hyperparameters of the learner. Default is an empty list, which means no hyperparameters are specifically set and defaults of the underlying learner are used.
vars [character]
Vector of variable names to use in training the model. Default is to use all variables.

Value

An object of class wrapped.model containing the generated model of the underlying learner and the paramater and index set used for training.

See Also

predict, make.classif.task, make.regr.task

Examples

library(MASS)
train.inds <- seq(1,150,2)
test.inds <- seq(2,150,2)

ct <- make.classif.task("lda", data=iris, formula=Species~.)
cm <- train(ct, subset=train.inds)
ps <- predict(ct, cm, newdata=iris[test.inds,])

ct <- make.classif.task("kknn.classif", data=iris, formula=Species~.)
cm <- train(ct, subset=train.inds, parset=list(k=3))
ps <- predict(ct, cm, newdata=iris[test.inds,])

[Package mlr version 0.3.180 Index]