Learn R Programming

Ceteris Paribus Plots

Ceteris Paribus Plots (What-If Plots) are designed to present model responses around a single point in the feature space. For example around a single prediction for an interesting observation. Plots are designed to work in a model-agnostic fashion, they are working for any Machine Learning model and allow for model comparisons.

The ceterisParibus Plots supplement the breakDown Plots that are designed to attribute features into parts of a single prediction.

Imagine a scenario in which a client gets low credit score and is wondering why the score is so low. What can I do to get a higher score?

Ceteris Paribus Plots show possible scenarios for model predictions allowing for changes in a single dimension keeping all other features constant (the ceteris paribus principle).

See a short 100 secs introduction to the package on YouTube.

Find more about Ceteris Paribus Profiles in this Gentle introduction to DALEX with examples or in the cheatsheet presented below.

Installation

To get started, install the latest version of ceterisParibus from CRAN

install.packages("ceterisParibus")

or from GitHub:

source("https://install-github.me/pbiecek/ceterisParibus")

Simple Ceteris Paribus Plot

The plot below shows Ceteris Paribus plots for an apartment data for a large apartment (130 m2) on 3-rd floor. On can read what would be the model prediction for smaller apartment (largest change) or one that is located higher.

Uniform Ceteris Paribus Plot

Since different variables may have different scales, we recommend to transform variables into quantiles. Then it is much easier to see how a particular variable looks in relation to others.

Having all variables in a single quantile scale we may plot them together in a single plot.

Multimodel Ceteris Paribus Plot

We may compare responses for few models in a single plot.

Some equations

More formally, a Ceteris Paribus plot for variable V and observations O is a set of points (X, Y) where

$$Y(X) := f(O_1, ..., O_{V-1}, O_{V} + X, O_{V+1}, ..., O_{p})$$

More examples

https://pbiecek.github.io/ceterisParibus/articles/whatIf1d.html

Copy Link

Version

Install

install.packages('ceterisParibus')

Monthly Downloads

617

Version

0.4.2

License

GPL-2

Maintainer

Przemyslaw Biecek

Last Published

March 28th, 2020

Functions in ceterisParibus (0.4.2)

plot.ceteris_paribus_oscillations

Plot Ceteris Paribus Oscillations
plot.local_fit_explainer

Local Fit Plots / Wangkardu Explanations
print.what_if_2d_explainer

Print What If 2D Explainer Summary
print.plot_ceteris_paribus_explainer

Print Ceteris Paribus Explainer Summary
+.plot_ceteris_paribus_explainer

Add More Layers to a Ceteris Paribus Plot
select_sample

Select Subset of Rows
print.local_fit_explainer

Prints Local Fit / Wangkardu Summary
what_if

What-If Plot
print.ceteris_paribus_explainer

Print Ceteris Paribus Explainer Summary
print.ceteris_paribus_profile

Print Ceteris Paribus Profiles
plot_interactive

Plots Interactive What-If Explanations
plot.what_if_explainer

Plot What If Explanations
what_if_2d

What-If 2D Plot
plot.what_if_2d_explainer

Plot What If 2D Explanations
print.what_if_explainer

Print What If Explainer Summary
select_neighbours

Select Subset of Rows Closest to a Specified Observation
calculate_profiles_lce

Calculate Local Conditional Expectation profiles
calculate_variable_splits

Calculate Split Points for Selected Variables
ceteris_paribus

Ceteris Paribus Explainer
calculate_oscillations

Calculate Oscillations for Ceteris Paribus Explainer
plot.ceteris_paribus_explainer

Plot Ceteris Paribus Explanations
local_fit

Local Fit / Wangkardu Explanations
calculate_profiles

Calculate Ceteris Paribus Profiles
local_conditional_expectations

Local Conditional Expectation Explainer
ceteris_paribus_layer

Add Layer to the Ceteris Paribus Plot