Learn R Programming

fmeffects (version 0.1.3)

makePredictor: User-friendly function to create a Predictor.

Description

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

Run this code
# 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)

Run the code above in your browser using DataLab