Skip to contents

A wrapper function that creates the correct subclass of Predictor by automatically from model. Can be passed to the constructor of FME.

Usage

makePredictor(model, data)

Arguments

model

the (trained) model, with the ability to predict on new data.

data

the data used for computing FMEs, must be data.frame or data.table.

Examples

# Train a model:

library(mlr3verse)
data(bikes, package = "fmeffects")
task = as_task_regr(x = bikes, id = "bikes", target = "count")
forest = lrn("regr.ranger")$train(task)

# Create the predictor:
predictor = makePredictor(forest, bikes)

# This instantiated an object of the correct subclass of `Predictor`:
class(predictor)
#> [1] "PredictorMLR3" "Predictor"     "R6"