Add predictions to generated dataset.

give_predictions(data, black_box, explained_var, similar, predict_function,
  hyperpars = list(), ...)

Arguments

data

Original data frame used to generate new dataset.

black_box

String with mlr signature of a learner or a model with predict interface.

explained_var

Name of a column with the variable to be predicted.

similar

Dataset created for local exploration.

predict_function

Either a "predict" function that returns a vector of the same type as response or custom function that takes a model as a first argument, new data used to calculate predictions as a second argument called "newdata" and returns a vector of the same type as response. Will be used only if a model object was provided in the black_box argument.

hyperpars

Optional list of (hyper)parameters to be passed to mlr::makeLearner.

...

Additional parameters to be passed to predict function.

Value

A list containing black box model object and predictions.