| predict,classif.task-method(mlr) | R Documentation |
Predicts the target classes of a new data set based on an already fitted wrapped.model of a classifcation task.
## S4 method for signature 'classif.task': predict(object, model, newdata, type="default")
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. |
See documentation super method.
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.
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)