Learn R Programming

ingredients (version 0.3.3)

describe: Describe Ceteris Paribus Explainers.

Description

Function describe.ceteris_paribus_explainer generates text descriptions for Ceteris Paribus Profiles. Note that currently only first observation is being described.

Usage

describe(x, ...)

# S3 method for ceteris_paribus_explainer describe(x, ...)

Arguments

x

a ceteris paribus explainer produced with function `ceteris_paribus()`

...

other explainers that shall be plotted together

Value

an `ceteris_paribus_descriptions` object.

Examples

Run this code
# NOT RUN {
library("DALEX")
# Toy examples, because CRAN angels ask for them
titanic <- na.omit(titanic)
model_titanic_glm <- glm(survived == "yes" ~ gender + age + fare,
                       data = titanic, family = "binomial")

explain_titanic_glm <- explain(model_titanic_glm,
                           data = titanic[,-9],
                           y = titanic$survived == "yes")
cp_rf <- ceteris_paribus(explain_titanic_glm, titanic[1,])
cp_rf
describe(cp_rf)
plot(cp_rf)

 
# }
# NOT RUN {
 library("randomForest")
 model_titanic_rf <- randomForest(survived == "yes" ~ gender + age + class + embarked +
                                    fare + sibsp + parch,  data = titanic)
 model_titanic_rf

 explain_titanic_rf <- explain(model_titanic_rf,
                           data = titanic[,-9],
                           y = titanic$survived == "yes",
                           label = "Random Forest v7")

selected_passangers <- select_sample(titanic, n = 1)
cp_rf <- ceteris_paribus(explain_titanic_rf, selected_passangers)
cp_rf
describe(cp_rf)

plot(cp_rf) +
  show_observations(cp_rf)
 
# }

Run the code above in your browser using DataLab