DALEX (version 0.1.1)

plot.single_variable_explainer: Plots Marginal Model Explanations (Single Variable Responses)

Description

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

Usage

# S3 method for single_variable_explainer
plot(x, ...)

Arguments

x

a single variable exlainer produced with the 'single_variable' function

...

other explainers that shall be plotted together

Value

a ggplot2 object

Examples

Run this code
# NOT RUN {
library("breakDown")
logit <- function(x) exp(x)/(1+exp(x))

HR_glm_model <- glm(left~., data = breakDown::HR_data, family = "binomial")
explainer_glm <- explain(HR_glm_model, data = HR_data)
expl_glm <- single_variable(explainer_glm, "satisfaction_level", "pdp", trans=logit)
plot(expl_glm)

# }
# NOT RUN {
library("randomForest")
HR_rf_model <- randomForest(left~., data = breakDown::HR_data, ntree = 100)
explainer_rf  <- explain(HR_rf_model, data = HR_data)
expl_rf  <- single_variable(explainer_rf, variable =  "satisfaction_level", type = "pdp")
plot(expl_rf)

plot(expl_rf, expl_glm)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab