| resample.fit(mlr) | R Documentation |
Given the training and test indices (e.g. generated by cross-validation and generally specified by
the resample.instance object) resample.fit
fits the selected learner using the training sets and performs predictions for the test sets. These
predictions are returned - encapsulated in a resample.result object.
Optionally the fitted models are also stored.
resample.fit(learn.task, resample.instance, parset, vars, models, type)
learn.task |
[learn.task] Specifies the learning task for the problem. |
resample.instance |
[resample.instance] Specifies the training and test indices of the resampled data. |
parset |
[list]A list of named elements which specify the hyperparameters of the learner. |
vars |
[character] Vector of variable names to use in training the model. Default is to use all variables. |
models |
[logical] If TRUE a list of the fitted models is included in the result. |
type |
[character] Only used for classification tasks; specifies the type of predictions - either probability ("prob") or class ("class"). |
An object of class resample.result.
library(mlr)
ct1 <- make.classif.task("lda", data=iris, formula=Species~.)
ct2 <- make.classif.task("rpart.classif", data=iris, formula=Species~.)
rin <- make.cv.instance(iters=3, size=nrow(iris))
f1 <- resample.fit(ct1, resample.instance=rin)
f2 <- resample.fit(ct2, resample.instance=rin, parset=list(minsplit=10, cp=0.03))