predict.Learner | R Documentation |
Extends the generic stats::predict()
with a method for Learner.
Note that this function is intended as glue code to be used in third party packages.
We recommend to work with the Learner directly, i.e. calling learner$predict()
or learner$predict_newdata()
directly.
Performs the following steps:
Sets additional hyperparameters passed to this function.
Creates a Prediction object by calling learner$predict_newdata()
.
Returns (subset of) Prediction.
## S3 method for class 'Learner'
predict(object, newdata, predict_type = NULL, ...)
object |
(Learner) |
newdata |
( |
predict_type |
( |
... |
(any) |
task = tsk("spam")
learner = lrn("classif.rpart", predict_type = "prob")
learner$train(task)
predict(learner, task$data(1:3), predict_type = "response")
predict(learner, task$data(1:3), predict_type = "prob")
predict(learner, task$data(1:3), predict_type = "<Prediction>")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.