Fit local model around the observation: shortcut for DALEX explainer objects

local_approximation(explainer, observation, target_variable_name,
n_new_obs, local_model = "regr.lm", select_variables = F,
predict_type = "response", kernel_type = gaussian_kernel, ...)

## Arguments

explainer a model to be explained, preprocessed by the DALEX::explain function a new observation for which predictions need to be explained name of the response variablea as a character Number of observation in the simulated dataset Character specyfing mlr learner to be used as a local model If TRUE, variable selection will be performed while fitting the local linear model Argument passed to mlr::makeLearner() argument "predict.type" while fitting the local model. Defaults to "response" Function which will be used to calculate distances from simulated observation to explained instance Arguments to be passed to sample_locally function

## Value

object of class live_explainer. More details in fit_explanation function help.

## Examples

# NOT RUN {
data('wine')
library(randomForest)
library(DALEX)
rf <- randomForest(quality~., data = wine)
expl <- explain(rf, wine, wine\$quality)
live_expl <- local_approximation(expl, wine[5, ], "quality", 500)
# }