Function 'plot.variable_response_explainer' plots marginal responses for one or more explainers.

# S3 method for feature_response_explainer
plot(x, ..., use_facets = FALSE)

Arguments

x

a single variable exlainer produced with the 'single_feature' function

...

other explainers that shall be plotted together

use_facets

logical. If TRUE then separate models are on different facets

Value

a ggplot2 object

Examples

library("DALEX") HR_glm_model <- glm(status == "fired" ~., data = HR, family = "binomial") explainer_glm <- explain(HR_glm_model, data = HR) expl_glm <- feature_response(explainer_glm, "hours", "pdp") head(expl_glm)
#> x y var type label #> 1 35.00000 0.6453431 hours pdp lm #> 2 35.89955 0.6251385 hours pdp lm #> 3 36.79911 0.6045067 hours pdp lm #> 4 37.69866 0.5835110 hours pdp lm #> 5 38.59822 0.5622188 hours pdp lm #> 6 39.49777 0.5407016 hours pdp lm
plot(expl_glm)
library("randomForest") HR_rf_model <- randomForest(status~., data = HR, ntree = 100) explainer_rf <- explain(HR_rf_model, data = HR) expl_rf <- feature_response(explainer_rf, feature = "hours", type = "pdp") head(expl_rf)
#> x y var type label #> 1 35.00000 0.5153970 hours pdp randomForest.fired #> 2 35.89955 0.6495654 hours pdp randomForest.fired #> 3 36.79911 0.6340028 hours pdp randomForest.fired #> 4 37.69866 0.6258048 hours pdp randomForest.fired #> 5 38.59822 0.6425194 hours pdp randomForest.fired #> 6 39.49777 0.6271683 hours pdp randomForest.fired
plot(expl_rf)
plot(expl_rf, expl_glm)
plot(expl_rf, expl_glm, use_facets = TRUE)