break_down_uncertainty

0th

Percentile

Explanation Level Uncertainty of Sequential Variable Attribution

The break_down_uncertainty() calles B times the break down algorithm for random orderings. Then it calculated distribution of attributions for these different orderings. Note that the shap() function is just a simplified interface to the break_down_uncertainty() function with by default B=25 random draws.

Usage
break_down_uncertainty(x, ..., B = 10)# S3 method for explainer
break_down_uncertainty(x, new_observation, ...,
B = 10)# S3 method for default
break_down_uncertainty(x, data,
predict_function = predict, new_observation, label = class(x),
..., path = NULL, B = 10)shap(x, ..., B = 25)
Arguments
x

a model to be explained, or an explainer created with function DALEX::explain().

...

other parameters.

B

number of random paths

new_observation

a new observation with columns that correspond to variables used in the model.

data

validation dataset, will be extracted from x if it is an explainer.

predict_function

predict function, will be extracted from x if it is an explainer.

label

name of the model. By default it's extracted from the 'class' attribute of the model.

path

if specified, then this path will be highlighed on the plot. Use average in order to show an average effect

Value

an object of the break_down_uncertainty class.

References

Predictive Models: Visual Exploration, Explanation and Debugging https://pbiecek.github.io/PM_VEE

break_down, local_attributions

Aliases
• break_down_uncertainty
• break_down_uncertainty.explainer
• break_down_uncertainty.default
• shap
Examples
# NOT RUN {
library("DALEX")
library("iBreakDown")
# Toy examples, because CRAN angels ask for them
titanic <- na.omit(titanic)
set.seed(1313)
titanic_small <- titanic[sample(1:nrow(titanic), 500), c(1,2,6,9)]
model_titanic_glm <- glm(survived == "yes" ~ gender + age + fare,
data = titanic_small, family = "binomial")
explain_titanic_glm <- explain(model_titanic_glm,
data = titanic_small[,-9],
y = titanic_small$survived == "yes") # there is no explanation level uncertanity linked with additive models bd_rf <- break_down_uncertainty(explain_titanic_glm, titanic_small[1, ]) bd_rf plot(bd_rf) # } # NOT RUN { ## Not run: library("randomForest") set.seed(1313) model <- randomForest(status ~ . , data = HR) new_observation <- HR_test[1,] explainer_rf <- explain(model, data = HR[1:1000, 1:5]) bd_rf <- break_down_uncertainty(explainer_rf, new_observation) bd_rf plot(bd_rf) # example for regression - apartment prices # here we do not have intreactions model <- randomForest(m2.price ~ . , data = apartments) explainer_rf <- explain(model, data = apartments_test[1:1000, 2:6], y = apartments_test$m2.price[1:1000])

bd_rf <- break_down_uncertainty(explainer_rf, apartments_test[1,])
bd_rf
plot(bd_rf)

bd_rf <- break_down_uncertainty(explainer_rf, apartments_test[1,], path = 1:5)
plot(bd_rf)

bd_rf <- break_down_uncertainty(explainer_rf,
apartments_test[1,],
path = c("floor", "no.rooms", "district",
"construction.year", "surface"))
plot(bd_rf)

bd_rf <- shap(explainer_rf,
apartments_test[1,])
bd_rf
plot(bd_rf)
plot(bd_rf, show_boxplots = FALSE)
# }

Documentation reproduced from package iBreakDown, version 0.9.6, License: GPL-2

Community examples

Looks like there are no examples yet.