library("DALEX")
library("modelStudio")
# fit a model
model_titanic <- glm(survived ~., data = titanic_imputed, family = "binomial")
# create an explainer for the model
explainer_titanic <- explain(model_titanic,
data = titanic_imputed,
y = titanic_imputed$survived)
# make a studio for the model
ms <- modelStudio(explainer_titanic,
N = 200, B = 5) # faster example
# \donttest{
# add new observations
ms <- ms_update_observations(ms,
explainer_titanic,
new_observation = titanic_imputed[100:101,],
new_observation_y = titanic_imputed$survived[100:101])
ms
# overwrite the observations with new ones
ms <- ms_update_observations(ms,
explainer_titanic,
new_observation = titanic_imputed[100:101,],
overwrite = TRUE)
ms
# }
Run the code above in your browser using DataLab