⬛ 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
Visualize a molecule and its conformations in Jupyter notebooks/lab using py3dmol

Mol Viewer This is a simple package wrapping py3dmol for a single command visualization of a RDKit molecule and its conformations (embed as Conformer

Benoît BAILLIF 1 Feb 11, 2022
Tool for visualizing attention in the Transformer model (BERT, GPT-2, Albert, XLNet, RoBERTa, CTRL, etc.)

Tool for visualizing attention in the Transformer model (BERT, GPT-2, Albert, XLNet, RoBERTa, CTRL, etc.)

Jesse Vig 4.7k Jan 01, 2023
Auralisation of learned features in CNN (for audio)

AuralisationCNN This repo is for an example of auralisastion of CNNs that is demonstrated on ISMIR 2015. Files auralise.py: includes all required func

Keunwoo Choi 39 Nov 19, 2022
GNNLens2 is an interactive visualization tool for graph neural networks (GNN).

GNNLens2 is an interactive visualization tool for graph neural networks (GNN).

Distributed (Deep) Machine Learning Community 143 Jan 07, 2023
⬛ Python Individual Conditional Expectation Plot Toolbox

⬛ PyCEbox Python Individual Conditional Expectation Plot Toolbox A Python implementation of individual conditional expecation plots inspired by R's IC

Austin Rochford 140 Dec 30, 2022
Using / reproducing ACD from the paper "Hierarchical interpretations for neural network predictions" 🧠 (ICLR 2019)

Hierarchical neural-net interpretations (ACD) 🧠 Produces hierarchical interpretations for a single prediction made by a pytorch neural network. Offic

Chandan Singh 111 Jan 03, 2023
A Practical Debugging Tool for Training Deep Neural Networks

Cockpit is a visual and statistical debugger specifically designed for deep learning!

31 Aug 14, 2022
Contrastive Explanation (Foil Trees), developed at TNO/Utrecht University

Contrastive Explanation (Foil Trees) Contrastive and counterfactual explanations for machine learning (ML) Marcel Robeer (2018-2020), TNO/Utrecht Univ

M.J. Robeer 41 Aug 29, 2022
Code for "High-Precision Model-Agnostic Explanations" paper

Anchor This repository has code for the paper High-Precision Model-Agnostic Explanations. An anchor explanation is a rule that sufficiently “anchors”

Marco Tulio Correia Ribeiro 735 Jan 05, 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 722 Dec 30, 2022
Code for visualizing the loss landscape of neural nets

Visualizing the Loss Landscape of Neural Nets This repository contains the PyTorch code for the paper Hao Li, Zheng Xu, Gavin Taylor, Christoph Studer

Tom Goldstein 2.2k Dec 30, 2022
A library for debugging/inspecting machine learning classifiers and explaining their predictions

ELI5 ELI5 is a Python package which helps to debug machine learning classifiers and explain their predictions. It provides support for the following m

2.6k Dec 30, 2022
Portal is the fastest way to load and visualize your deep neural networks on images and videos 🔮

Portal is the fastest way to load and visualize your deep neural networks on images and videos 🔮

Datature 243 Jan 05, 2023
L2X - Code for replicating the experiments in the paper Learning to Explain: An Information-Theoretic Perspective on Model Interpretation.

L2X Code for replicating the experiments in the paper Learning to Explain: An Information-Theoretic Perspective on Model Interpretation at ICML 2018,

Jianbo Chen 113 Sep 06, 2022
Summary Explorer is a tool to visually explore the state-of-the-art in text summarization.

Summary Explorer is a tool to visually explore the state-of-the-art in text summarization.

Webis 42 Aug 14, 2022
Pytorch implementation of convolutional neural network visualization techniques

Convolutional Neural Network Visualizations This repository contains a number of convolutional neural network visualization techniques implemented in

Utku Ozbulak 7k Jan 03, 2023
Interactive convnet features visualization for Keras

Quiver Interactive convnet features visualization for Keras The quiver workflow Video Demo Build your model in keras model = Model(...) Launch the vis

Keplr 1.7k Dec 21, 2022
PyTorch implementation of DeepDream algorithm

neural-dream This is a PyTorch implementation of DeepDream. The code is based on neural-style-pt. Here we DeepDream a photograph of the Golden Gate Br

121 Nov 05, 2022
TensorFlowTTS: Real-Time State-of-the-art Speech Synthesis for Tensorflow 2 (supported including English, Korean, Chinese, German and Easy to adapt for other languages)

🤪 TensorFlowTTS provides real-time state-of-the-art speech synthesis architectures such as Tacotron-2, Melgan, Multiband-Melgan, FastSpeech, FastSpeech2 based-on TensorFlow 2. With Tensorflow 2, we c

3k Jan 04, 2023
Making decision trees competitive with neural networks on CIFAR10, CIFAR100, TinyImagenet200, Imagenet

Neural-Backed Decision Trees · Site · Paper · Blog · Video Alvin Wan, *Lisa Dunlap, *Daniel Ho, Jihan Yin, Scott Lee, Henry Jin, Suzanne Petryk, Sarah

Alvin Wan 556 Dec 20, 2022