| predict(mlr) | R Documentation |
Predicts the target values of a new data set based on
an already fitted wrapped.model of a learn.task.
## S4 method for signature 'learn.task': predict(object, model, newdata)
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). |
Object containing the predicted targets. See inherited methods.
train, predict,classif.task-method, predict,regr.task-method, performance
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,])