| predict,regr.task-method(mlr) | R Documentation |
Predicts the target values of a new data set based on an already fitted wrapped.model of a regression task.
## S4 method for signature 'regr.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). |
See documentation super method.
A vector of numeric values.
data(BostonHousing)
inds <- seq(1, nrow(BostonHousing), 2)
test <- BostonHousing[-inds,]
rt <- make.regr.task("stats.lm", data=BostonHousing, formula=medv~.)
model <- train(rt, subset=inds)
predict(rt, model, newdata = test)