This release is a pre-release and may not be stable for production use.
Unified IG
Unified IG provides one small, SHAP-like API for Integrated Gradients across model families. The first implementation supports closed-form attributions for scikit-learn linear models and multilayer perceptrons.
import unifiedig as uig
explainer = uig.Explainer(model, baseline)
explanation = explainer(X)
For numerical backends, the quadrature resolution is configurable:
explainer = uig.Explainer(model, baseline, n_steps=128)
Explanation is lightweight and has SHAP-compatible fields. SHAP remains an
optional dependency; call explanation.to_shap() to use its plotting tools.
Installation
During development, install the project and its test dependencies with:
python -m pip install -e ".[test]"
Output semantics
For regression, attributions sum to the difference between the prediction and
the baseline prediction. Binary classifiers are explained on their
decision-score (logit) scale; probability attributions are not part of V1.
See docs/semantics.md for the complete array-shape and output contract.
Numerical explanations expose their observed completeness residual:
explanation.completeness_error
explanation.max_abs_completeness_error
Unified IG warns when this error exceeds the configured tolerance. Increasing
n_steps usually improves it. See the examples/ directory for complete
linear, logistic, MLP regression, and MLP classification programs.
Supported models
sklearn.linear_model.LinearRegression(closed form)- Binary
sklearn.linear_model.LogisticRegression(closed form) sklearn.neural_network.MLPRegressor(analytic gradients and quadrature)- Binary
sklearn.neural_network.MLPClassifier(analytic logit gradients and quadrature) - PyTorch modules with one raw scalar output per sample (Captum, optional)
- TreeIG-supported sklearn, XGBoost, and LightGBM trees (exact, optional)
Install PyTorch support separately so the core package remains lightweight:
pip install "unifiedig[torch]"
Install exact tree-model support separately:
pip install "unifiedig[trees]"
Tree attributions are computed by TreeIG; Unified IG normalizes the input and
baseline and adapts TreeIG's exact result to Explanation.
PyTorch models may accept tabular or structured single-tensor inputs. Unified IG preserves the model's device and floating-point dtype, temporarily evaluates the model in inference mode, and restores every module's prior training state. V1 expects one raw scalar output per sample. For binary classification that output must be the logit, not a sigmoid probability.
Development
Run the tests and validate distribution artifacts with:
pytest
python -m build
python -m twine check dist/*
See CONTRIBUTING.md for the development workflow.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file unifiedig-0.1.0.dev3.tar.gz.
File metadata
- Download URL: unifiedig-0.1.0.dev3.tar.gz
- Upload date:
- Size: 20.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab9cd6681f429dfcda3adc3aa8e8cb07668e43374f26b6f0c0dd8abf44dffeb0
|
|
| MD5 |
da1c2abb2506c0613bd9d4343d16a0a7
|
|
| BLAKE2b-256 |
84f9d059a6b770ef60c2b8d9f1e512e3b2dcaa322dfbd917432c53aba33f2c3a
|
Provenance
The following attestation bundles were made for unifiedig-0.1.0.dev3.tar.gz:
Publisher:
release.yml on LudgerHentschel/unifiedig
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unifiedig-0.1.0.dev3.tar.gz -
Subject digest:
ab9cd6681f429dfcda3adc3aa8e8cb07668e43374f26b6f0c0dd8abf44dffeb0 - Sigstore transparency entry: 2317817422
- Sigstore integration time:
-
Permalink:
LudgerHentschel/unifiedig@cbdd6ae26f769cd0102640574c05f0d46fa286ba -
Branch / Tag:
refs/tags/v0.1.0.dev3 - Owner: https://github.com/LudgerHentschel
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cbdd6ae26f769cd0102640574c05f0d46fa286ba -
Trigger Event:
push
-
Statement type:
File details
Details for the file unifiedig-0.1.0.dev3-py3-none-any.whl.
File metadata
- Download URL: unifiedig-0.1.0.dev3-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76597c03ccf92a0066e89181d4415f0093c7ec64c1101d50ef9cc9bc2fd6c81d
|
|
| MD5 |
65aa8e2d3257d51419d51c4b0397d34c
|
|
| BLAKE2b-256 |
caa136f1ebdff1f401d6f7acb47eec4924820acd7fa236196419481892506d90
|
Provenance
The following attestation bundles were made for unifiedig-0.1.0.dev3-py3-none-any.whl:
Publisher:
release.yml on LudgerHentschel/unifiedig
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unifiedig-0.1.0.dev3-py3-none-any.whl -
Subject digest:
76597c03ccf92a0066e89181d4415f0093c7ec64c1101d50ef9cc9bc2fd6c81d - Sigstore transparency entry: 2317817456
- Sigstore integration time:
-
Permalink:
LudgerHentschel/unifiedig@cbdd6ae26f769cd0102640574c05f0d46fa286ba -
Branch / Tag:
refs/tags/v0.1.0.dev3 - Owner: https://github.com/LudgerHentschel
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cbdd6ae26f769cd0102640574c05f0d46fa286ba -
Trigger Event:
push
-
Statement type: