Learn R Programming

mlr (version 2.10)

predictLearner: Predict new data with an R learner.

Description

Mainly for internal use. Predict new data with a fitted model. You have to implement this method if you want to add another learner to this package.

Usage

predictLearner(.learner, .model, .newdata, ...)

Arguments

.learner
[RLearner] Wrapped learner.
.model
[WrappedModel] Model produced by training.
.newdata
[data.frame] New data to predict. Does not include target column.
...
[any] Additional parameters, which need to be passed to the underlying predict function.

Value

  • For classification: Either a factor with class labels for type “response” or, if the learner supports this, a matrix of class probabilities for type “prob”. In the latter case the columns must be named with the class labels.
  • For regression: Either a numeric vector for type “response” or, if the learner supports this, a matrix with two columns for type “se”. In the latter case the first column contains the estimated response (mean value) and the second column the estimated standard errors.
  • For survival: Either a numeric vector with some sort of orderable risk for type “response” or, if supported, a numeric vector with time dependent probabilities for type “prob”.
  • For clustering: Either an integer with cluster IDs for type “response” or, if supported, a matrix of membership probabilities for type “prob”.
  • For multilabel: A logical matrix that indicates predicted class labels for type “response” or, if supported, a matrix of class probabilities for type “prob”. The columns must be named with the class labels.

Details

Your implementation must adhere to the following: Predictions for the observations in .newdata must be made based on the fitted model (.model$learner.model). All parameters in ... must be passed to the underlying predict function.