Skip to main content

PyInterpret: A Unified Python Library for Machine Learning Model Interpretation

Python Version License: MIT

PyInterpret is a comprehensive Python library that unifies fragmented explainability tools under one consistent API. It provides modular coverage of both global and local explanations across different data modalities, consolidating capabilities from state-of-the-art tools like SHAP, LIME, and others.

🎯 Key Features

  • Unified API: Consistent interface across all interpretation methods
  • Local Attribution: SHAP, LIME, and other instance-level explanations
  • Global Insights: Permutation importance, partial dependence plots
  • Modular Architecture: Easy extension and customization
  • Multiple Data Types: Support for tabular, text, image, and time-series data
  • Framework Integration: Works seamlessly with scikit-learn, pandas, and other ML libraries
  • Professional Quality: Comprehensive testing, documentation, and error handling

🚀 Quick Start

Installation

# Basic installation
pip install pyinterpret

# With SHAP support
pip install pyinterpret[shap]

# With LIME support  
pip install pyinterpret[lime]

# With all optional dependencies
pip install pyinterpret[all]

Basic Usage

from pyinterpret import SHAPExplainer, LIMEExplainer, PermutationImportanceExplainer
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import make_classification
import pandas as pd

# Create sample data and train model
X, y = make_classification(n_samples=1000, n_features=10, random_state=42)
X_df = pd.DataFrame(X, columns=[f'feature_{i}' for i in range(X.shape[1])])

model = RandomForestClassifier(random_state=42)
model.fit(X_df, y)

# Local explanation with SHAP
shap_explainer = SHAPExplainer(model, explainer_type='tree')
shap_result = shap_explainer.explain_instance(X_df.iloc[0])

print("SHAP attributions:", shap_result.attributions)
print("Feature names:", shap_result.feature_names)

# Global explanation with Permutation Importance
perm_explainer = PermutationImportanceExplainer(model, scoring='accuracy')
perm_result = perm_explainer.explain_global(X_df, y)

print("Most important features:", perm_result.feature_names[:5])
print("Importance scores:", perm_result.attributions[:5])

Metadata

Release files for pyinterpret 0.1.1

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

Source distribution (sdist)

Source distribution for pyinterpret 0.1.1
File Size Uploaded Provenance Actions
pyinterpret-0.1.1.tar.gz 353.1 kB With provenance Details for pyinterpret-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 385.0 kB

Release files / pyinterpret-0.1.1.tar.gz

Download URL pyinterpret-0.1.1.tar.gz
Size 353.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1a6eaa39aa9d8017b2125c84185b9e870f8ed0ea35d97ae91ae551d65fff774d
BLAKE2b-256 checksum
How to use checksums
00a4225145571cab032f97f1ad25e11fe0eb9a071c2baf22d0d0df4f7be87bbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.

Transparency log

Release files / pyinterpret-0.1.1-py3-none-any.whl

Download URL pyinterpret-0.1.1-py3-none-any.whl
Size 31.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b11128a1ed7887b8c69696bf85ae07e8af752f5ba0dc9c55eea239ad2ce0abf5
BLAKE2b-256 checksum
How to use checksums
8c1291c6e7a953bf589f67dbb98a01f9b1c15789b41efbc05e72800bfc7a43e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.

Transparency log

Security for pyinterpret 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyinterpret-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

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