captum  by pytorch

PyTorch library for model interpretability research

created 6 years ago
5,333 stars

Top 9.6% on sourcepulse

GitHubView on GitHub
Project Summary

Captum is a PyTorch library for model interpretability, offering a suite of algorithms to understand feature importance, neuron contributions, and model behavior. It targets ML researchers and developers seeking to debug, improve, and explain their models, providing insights into what drives predictions.

How It Works

Captum implements various attribution algorithms, including Integrated Gradients, DeepLift, and GradientShap, which attribute model predictions to input features or internal model components. It leverages PyTorch's autograd capabilities to efficiently compute these attributions, often using baseline inputs or noise injection for robustness and accuracy. The library supports extensions for layer and neuron-level analysis, enabling deeper inspection of model internals.

Quick Start & Requirements

  • Install via pip: pip install captum
  • Install via conda: conda install captum -c pytorch or conda install captum -c conda-forge
  • Requirements: Python >= 3.9, PyTorch >= 1.10.
  • For development: pip install -e .[dev] or pip install -e .[tutorials]
  • Official documentation and tutorials are available.

Highlighted Details

  • Implements state-of-the-art interpretability algorithms like Integrated Gradients, TCAV, and TracIn.
  • Offers noise tunneling (SmoothGrad, VarGrad) for attribution smoothing.
  • Provides neuron and layer conductance for internal model analysis.
  • Includes adversarial attack and minimal input perturbation capabilities.

Maintenance & Community

  • Developed by the PyTorch team.
  • Active development and contributions from the community.
  • Resources include an FAQ and contribution guidelines.

Licensing & Compatibility

  • BSD 3-Clause License.
  • Permissive license suitable for commercial use and integration into closed-source projects.

Limitations & Caveats

  • Captum Insights (visualization tool) is being deprecated.
  • Some algorithms, like DeepLift, have limitations on supported activation types and may require careful baseline selection.
Health Check
Last commit

1 week ago

Responsiveness

1 day

Pull Requests (30d)
6
Issues (30d)
1
Star History
151 stars in the last 90 days

Explore Similar Projects

Starred by Dominik Moritz Dominik Moritz(Professor at CMU; ML Researcher at Apple), Stas Bekman Stas Bekman(Author of Machine Learning Engineering Open Book; Research Engineer at Snowflake), and
2 more.

ecco by jalammar

0%
2k
Python library for interactive NLP model visualization in Jupyter notebooks
created 4 years ago
updated 11 months ago
Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Elie Bursztein Elie Bursztein(Cybersecurity Lead at Google DeepMind), and
1 more.

alibi by SeldonIO

0.1%
3k
Python library for ML model inspection and interpretation
created 6 years ago
updated 1 month ago
Feedback? Help us improve.