⬛ Python Individual Conditional Expectation Plot Toolbox

Overview

PyCEbox

Python Individual Conditional Expectation Plot Toolbox

Individual conditional expectation plot

A Python implementation of individual conditional expecation plots inspired by R's ICEbox. Individual conditional expectation plots were introduced in Peeking Inside the Black Box: Visualizing Statistical Learning with Plots of Individual Conditional Expectation (arXiv:1309.6392).

Quickstart

pycebox is available on PyPI and can be installed with pip install pycebox.

The tutorial recreates the first example in the above paper using pycebox.

Development

For easy development and prototyping using IPython notebooks, a Docker environment is included. To run an IPython notebook with access to your development version of pycebox, run PORT=8889 sh ./start_container.sh. A Jupyter notebook server with access to your development version of pycebox should be available at http://localhost:8889/tree.

To run the pycebox's tests in your development container

  1. Access a bash shell on the container with docker exec -it pycebox bash.
  2. Change to the pycebox directory with cd ../pycebox
  3. Run the tests with pytest test/test.py

Documentation

For details of pycebox's API, consult the documentation.

License

This library is distributed under the MIT License.

Comments
  • Typo in ice_plot() regarding _get_quantiles()

    Typo in ice_plot() regarding _get_quantiles()

    There is a typo in the ice_plot() function when calling the _get_quantiles() function. In lines 124 and 137, the ice_plot() calls __get_quantiles() (which is undefined) instead of _get_quantiles(), which results in an error if trying to use quantiles or center the ICE curves.

    opened by savvastj 6
  • Using predicted probabilities for binary classification

    Using predicted probabilities for binary classification

    Is there any way to give some form of predict_proba function to the ice() function in order to see the probability as opposed to the prediction?

    Thanks! Nema

    opened by nemasobhani 1
  • Plot mistake

    Plot mistake

    There is a problem in the visualization part. When I am trying to plot the graph in the example, I see the following mistake:


    TypeError Traceback (most recent call last) in 12 ice_plot(ice_df, frac_to_plot=0.1, 13 color_by='x3', cmap=PuOr, ---> 14 ax=ice_ax); 15 16 ice_ax.set_xlabel('$X_2$');

    C:\ProgramData\Anaconda3\lib\site-packages\pycebox\ice.py in ice_plot(ice_data, frac_to_plot, plot_points, point_kwargs, x_quantile, plot_pdp, centered, centered_quantile, color_by, cmap, ax, pdp_kwargs, **kwargs) 128 if frac_to_plot < 1.: 129 n_cols = ice_data.shape[1] --> 130 icols = np.random.choice(n_cols, size=frac_to_plot * n_cols, replace=False) 131 plot_ice_data = ice_data.iloc[:, icols] 132 else:

    mtrand.pyx in mtrand.RandomState.choice()

    TypeError: 'float' object cannot be interpreted as an integer

    opened by karakol15 4
  • "frac_to_plot" parameter in ice_plot

    Hey Austin,

    This package rocks, thanks for publishing it!

    I have a question and a potential small bug in the ice_plot method, specifically on the "frac_to_plot" parameter.

    It is my understanding that you simply take the fraction and multiply by the number of columns, and then pass this to the "size" parameter of np.random.choice(). I think we should make sure that the number being passed is an integer, not a float. Otherwise np.random.choice() will not accept a float as a parameter for "size".

    Current: icols = np.random.choice(n_cols, size=frac_to_plot * n_cols, replace=False)

    Fix: icols = np.random.choice(n_cols, size=int(frac_to_plot * n_cols), replace=False)

    Best, Andrew

    opened by andrew-cho 1
  • Extended use to classification models, fixed typecast bug

    Extended use to classification models, fixed typecast bug

    • Extended use to classification models by allowing predict_proba to be passed to the ice_plot function.
    • Fixed 'type error when size is non-int' error for np.random.choice function
    opened by sanjifr3 0
  • Averaging ICE plots across multiple runs/folds of a model

    Averaging ICE plots across multiple runs/folds of a model

    Hi Austin,

    I was wondering if it is possible to average across multiple runs/folds of the same model.

    I am trying at the moment, but the resulting ICE plots do not make sense. The per run plots make sense but when I average them across both runs and folds the data gets screwed.

    Cheers,

    Dan

    opened by danieltudosiu 0
Releases(0.0.1)
Owner
Austin Rochford
Chief Data Scientist @ Kibo Commerce, recovering mathematician, enthusiastic Bayesian
Austin Rochford
FairML - is a python toolbox auditing the machine learning models for bias.

======== FairML: Auditing Black-Box Predictive Models FairML is a python toolbox auditing the machine learning models for bias. Description Predictive

Julius Adebayo 338 Nov 9, 2022
Visualization Toolbox for Long Short Term Memory networks (LSTMs)

Visualization Toolbox for Long Short Term Memory networks (LSTMs)

Hendrik Strobelt 1.1k Jan 4, 2023
Python implementation of R package breakDown

pyBreakDown Python implementation of breakDown package (https://github.com/pbiecek/breakDown). Docs: https://pybreakdown.readthedocs.io. Requirements

MI^2 DataLab 41 Mar 17, 2022
Python Library for Model Interpretation/Explanations

Skater Skater is a unified framework to enable Model Interpretation for all forms of model to help one build an Interpretable machine learning system

Oracle 1k Dec 27, 2022
👋🦊 Xplique is a Python toolkit dedicated to explainability, currently based on Tensorflow.

???? Xplique is a Python toolkit dedicated to explainability, currently based on Tensorflow.

DEEL 343 Jan 2, 2023
Fastapi mail system sending mails(individual, bulk) attachments(individual, bulk)

Fastapi-mail The fastapi-mail simple lightweight mail system, sending emails and attachments(individual && bulk) ?? Installation $ pip install fastap

Sabuhi 399 Dec 29, 2022
Code for paper ECCV 2020 paper: Who Left the Dogs Out? 3D Animal Reconstruction with Expectation Maximization in the Loop.

Who Left the Dogs Out? Evaluation and demo code for our ECCV 2020 paper: Who Left the Dogs Out? 3D Animal Reconstruction with Expectation Maximization

Benjamin Biggs 29 Dec 28, 2022
python partial dependence plot toolbox

PDPbox python partial dependence plot toolbox Motivation This repository is inspired by ICEbox. The goal is to visualize the impact of certain feature

Li Jiangchun 723 Jan 7, 2023
python partial dependence plot toolbox

PDPbox python partial dependence plot toolbox Motivation This repository is inspired by ICEbox. The goal is to visualize the impact of certain feature

Li Jiangchun 531 Feb 16, 2021
python partial dependence plot toolbox

PDPbox python partial dependence plot toolbox Motivation This repository is inspired by ICEbox. The goal is to visualize the impact of certain feature

Li Jiangchun 722 Dec 30, 2022
Plot toolbox based on Matplotlib, simple and elegant.

Elegant-Plot Plot toolbox based on Matplotlib, simple and elegant. 绘制效果 绘制过程 数据准备 每种图标类型的目录下有data.csv文件,依据样例数据填入自己的数据。

null 3 Jul 15, 2022
A simple Python module for parsing human names into their individual components

Name Parser A simple Python (3.2+ & 2.6+) module for parsing human names into their individual components. hn.title hn.first hn.middle hn.last hn.suff

Derek Gulbranson 574 Dec 20, 2022
A python program to cut longer MP3 files (i.e. recordings of several songs) into the individual tracks.

I'm writing a python script to cut longer MP3 files (i.e. recordings of several songs) into the individual tracks called ReCut. So far there are two

Dönerspiess 1 Oct 27, 2021
Compute execution plan: A DAG representation of work that you want to get done. Individual nodes of the DAG could be simple python or shell tasks or complex deeply nested parallel branches or embedded DAGs themselves.

Hello from magnus Magnus provides four capabilities for data teams: Compute execution plan: A DAG representation of work that you want to get done. In

null 12 Feb 8, 2022
a python function to plot a geopandas dataframe

Pretty GeoDataFrame A minimum python function (~60 lines) to draw pretty geodataframe. Based on matplotlib, shapely, descartes. Installation just use

haoming 27 Dec 5, 2022
Getting started with Python, Dash and Plot.ly for the Data Dashboards team

data_dashboards Getting started with Python, Dash and Plot.ly for the Data Dashboards team Getting started MacOS users: # Install the pyenv version ma

Department for Levelling Up, Housing and Communities 1 Nov 8, 2021
A simple python script using Numpy and Matplotlib library to plot a Mohr's Circle when given a two-dimensional state of stress.

Mohr's Circle Calculator This is a really small personal project done for Department of Civil Engineering, Delhi Technological University (formerly, D

Agyeya Mishra 0 Jul 17, 2021
higher is a pytorch library allowing users to obtain higher order gradients over losses spanning training loops rather than individual training steps.

higher is a library providing support for higher-order optimization, e.g. through unrolled first-order optimization loops, of "meta" aspects of these

Facebook Research 1.5k Jan 3, 2023
Self-Attention Between Datapoints: Going Beyond Individual Input-Output Pairs in Deep Learning

We challenge a common assumption underlying most supervised deep learning: that a model makes a prediction depending only on its parameters and the features of a single input. To this end, we introduce a general-purpose deep learning architecture that takes as input the entire dataset instead of processing one datapoint at a time.

OATML 360 Dec 28, 2022
Code for Quantifying Ignorance in Individual-Level Causal-Effect Estimates under Hidden Confounding

?? quince Code for Quantifying Ignorance in Individual-Level Causal-Effect Estimates under Hidden Confounding ?? Installation $ git clone [email protected]

Andrew Jesson 19 Jun 23, 2022