predict,classif.task-method(mlr)R Documentation

predict

Description

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

Usage

## S4 method for signature 'classif.task':
predict(object, model, newdata, type="default")

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).
type [character]
Specifies the type of predictions - either probability ("prob") or class ("class"). Default is "default", which uses the type specified in the classification task.

Details

See documentation super method.

Value

Either a factor of predicted classes or a matrix of probabilities. The rows correspond to the predicted observations and the columns to the classes. Each column has the name of its respective class.

See Also

predict,learn.task-method

Examples

inds <- 2*(1:75)
test <- iris[-inds,]

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

[Package mlr version 0.3.180 Index]