Skip to main content

# PDPbox [![PyPI version](https://badge.fury.io/py/PDPbox.svg)](https://badge.fury.io/py/PDPbox) [![codecov](https://codecov.io/gh/SauceCat/PDPbox/branch/master/graph/badge.svg?token=wIGFZIoSKJ)](https://codecov.io/gh/SauceCat/PDPbox) ![Build Status](https://github.com/SauceCat/PDPbox/actions/workflows/tox-test.yml/badge.svg)

Python P**artial **D**ependence **P**lot tool**box.

Visualize the influence of certain features on model predictions for supervised machine learning algorithms, utilizing partial dependence plots.

For a comprehensive explanation, I recommend referring to the [Partial Dependence Plot (PDP)](https://christophm.github.io/interpretable-ml-book/pdp.html) chapter in Christoph Molnar’s book, [Interpretable Machine Learning](https://christophm.github.io/interpretable-ml-book/).

## I am back! :smirk_cat:

After four years…

I’m delighted to see how popular PDPbox has become; it has exceeded all my expectations. When I first embarked on this project, it was a modest endeavor, simply to whet my appetite for real-world Python package development.

With the shift in my career path towards deep learning in 2018, I had to halt the development and maintenance of PDPbox. As I no longer actively used it and several other outstanding packages such as [lime](https://github.com/marcotcr/lime) and [shap](https://github.com/slundberg/shap) were emerging.

However, as the years have passed, I have seen PDPbox gain a significant presence in the community. It’s been referenced in various online courses and books, demonstrating its valuable role. Despite well-known limitations of partial dependence plots, their simplicity and intuitiveness might have made them a popular starting point for many, appealing to a broad range of audiences.

Given this, I feel a renewed sense of responsibility to revisit the project, refine the existing code, potentially add new features, and create additional tutorials. I’m excited about this next phase and look forward to contributing more to the open source community.

## Installation

  • through pip ` $ pip install pdpbox `

  • through git (latest develop version) ` $ git clone https://github.com/SauceCat/PDPbox.git $ cd PDPbox $ python setup.py install `

## Reference

## Testing ### Test with pytest

` cd <dir>/PDPbox python -m pytest tests `

### Test with tox PDPbox can be tested using tox.

  • First install tox

    ` $ pip install tox `

  • Call tox inside the pdpbox clone directory. This will run tests with python3.9.

  • To test the documentation, call tox -e docs. The documentation should open up in your browser if it is successfully build. Otherwise, the problem with the documentation will be reported in the output of the command.

## Gallery - PDP: PDP for a single feature

<img src=’assets/images/pdp_plot.jpeg’ width=90%>

  • PDP: PDP for a multi-class

    <img src=’assets/images/pdp_plot_multiclass.jpeg’ width=90%>

  • PDP Interact: PDP Interact for two features with contour plot

    <img src=’assets/images/pdp_interact_contour.jpeg’ width=90%>

  • PDP Interact: PDP Interact for two features with grid plot

    <img src=’assets/images/pdp_interact_grid.jpeg’ width=90%>

  • PDP Interact: PDP Interact for multi-class

    <img src=’assets/images/pdp_interact_multiclass.jpeg’ width=90%>

  • Information plot: target plot for a single feature

    <img src=’assets/images/target_plot.jpeg’ width=90%>

  • Information plot: target interact plot for two features

    <img src=’assets/images/target_plot_interact.jpeg’ width=90%>

  • Information plot: prediction plot for a single feature

    <img src=’assets/images/predict_plot.jpeg’ width=90%>

Release files for PDPbox 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PDPbox 0.3.0
File Size Uploaded
PDPbox-0.3.0.tar.gz 34.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for PDPbox 0.3.0
File Interpreter ABI Platform
PDPbox-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 69.8 MB

Release files / PDPbox-0.3.0.tar.gz

Download URL PDPbox-0.3.0.tar.gz
Size 34.0 MB
Tags Source
SHA-256 checksum
How to use checksums
86931543e0032803ba38ea4d7486146fa8d715451e40c90ec874b2d2ebb707fe
BLAKE2b-256 checksum
How to use checksums
d9d71e5090b4546eae9b7d7031d3bee1eb71b97a514626770cd8fac5535d6f87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release files / PDPbox-0.3.0-py3-none-any.whl

Download URL PDPbox-0.3.0-py3-none-any.whl
Size 35.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
12388b2bbbd55717797a8a297d011ab9de3009ad1a230061e51992f538509d44
BLAKE2b-256 checksum
How to use checksums
1f2e8f115e0c514f2057fd8a99a01f52a5cd7d6952adf98dcffae086c2bccff6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.1

1 release file

0.2.0

2 release files

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page