ms_update_observations {modelStudio} | R Documentation |
Update the observations of a modelStudio object
Description
This function calculates local explanations on new observations and adds them
to the modelStudio
object.
Usage
ms_update_observations(
object,
explainer,
new_observation = NULL,
new_observation_y = NULL,
max_features = 10,
B = 10,
show_info = TRUE,
parallel = FALSE,
widget_id = NULL,
overwrite = FALSE,
...
)
Arguments
object |
A |
explainer |
An |
new_observation |
New observations with columns that correspond to variables used in the model. |
new_observation_y |
True label for |
max_features |
Maximum number of features to be included in BD and SV plots.
Default is |
B |
Number of permutation rounds used for calculation of SV and FI.
Default is |
show_info |
Verbose a progress on the console. Default is |
parallel |
Speed up the computation using |
widget_id |
Use an explicit element ID for the widget (rather than an automatically generated one).
Useful e.g. when using |
overwrite |
Overwrite existing observations and their explanations.
Default is |
... |
Other parameters. |
Value
An object of the r2d3, htmlwidget, modelStudio
class.
References
The input object is implemented in DALEX
Feature Importance, Ceteris Paribus, Partial Dependence and Accumulated Dependence explanations are implemented in ingredients
Break Down and Shapley Values explanations are implemented in iBreakDown
See Also
Vignettes: modelStudio - R & Python examples and modelStudio - perks and features
Examples
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
# 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