# NOT RUN {
library(DALEX)
library(randomForest)
library(localModel)
data('apartments')
mrf <- randomForest(m2.price ~., data = apartments, ntree = 50)
explainer <- explain(model = mrf,
data = apartments[, -1])
model_lok <- individual_surrogate_model(explainer, apartments[5, -1],
size = 500, seed = 17,
kernel = gaussian_kernel)
# In this case each simulated observation has weight
# that is small when the distance from original observation is large,
# so closer observation have more weight.
model_lok
plot(model_lok)
# }
Run the code above in your browser using DataCamp Workspace