predict(mlr)R Documentation

predict

Description

Predicts the target values of a new data set based on an already fitted wrapped.model of a learn.task.

Usage

## S4 method for signature 'learn.task':
predict(object, model, newdata)

Arguments

object [learn.task]
Learning task
model [wrapped.model]
Wrapped model, trained from learn task
newdata [data.frame]
Contains new observations which should be predicted (by default the train data of the wrapped model).

Value

Object containing the predicted targets. See inherited methods.

See Also

train, predict,classif.task-method, predict,regr.task-method, performance

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]