skgrad
skgrad computes analytic input gradients for fitted scikit-learn models.
It provides one consistent interface for affine estimators and multilayer
perceptrons without numerical finite differences or automatic-differentiation
frameworks.
import skgrad
values, jacobian = skgrad.value_and_jacobian(model, X)
values always has shape (samples, outputs) and jacobian has shape
(samples, outputs, features). Regression values are predictions.
Classification values are decision scores or logits, never probabilities.
Supported models
LinearRegression,Ridge,Lasso, andElasticNetLogisticRegressionandRidgeClassifierMLPRegressorwith identity outputMLPClassifier, using pre-probability logits
Hidden MLP activations may be identity, logistic, tanh, or ReLU. ReLU uses a zero derivative at its nondifferentiable origin, matching scikit-learn's backpropagation convention.
API
skgrad.supports(model)
skgrad.model_output(model, X)
skgrad.input_jacobian(model, X)
skgrad.input_gradient(model, X, target=None)
skgrad.value_and_jacobian(model, X)
input_gradient is the scalar-output convenience API. A target is required
when the model has multiple outputs.
Tree models, parameter gradients, numerical differentiation, Integrated Gradients, and baseline handling are deliberately outside the package scope.
The value_and_jacobian primitive is designed for downstream composition.
For example, UnifiedIG integrates its Jacobians to explain model outputs,
while MPAIG combines them with analytic loss derivatives to explain realized
predictive performance.
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 skgrad-0.1.0.tar.gz.
File metadata
- Download URL: skgrad-0.1.0.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b3525f9f497b4feb19af83c13d0d96264822ee740823c18ca9d5d31c357b925
|
|
| MD5 |
ba9f7fc5d17c9c318feb3f0ed7445697
|
|
| BLAKE2b-256 |
854e5260862e6c3e3b9182f7438589bfea706902ab62b7d2a76d4885f235f436
|
Provenance
The following attestation bundles were made for skgrad-0.1.0.tar.gz:
Publisher:
release.yml on LudgerHentschel/skgrad
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
skgrad-0.1.0.tar.gz -
Subject digest:
5b3525f9f497b4feb19af83c13d0d96264822ee740823c18ca9d5d31c357b925 - Sigstore transparency entry: 2331853949
- Sigstore integration time:
-
Permalink:
LudgerHentschel/skgrad@5ae48dea12d31facb22ce7c3233ced32d758a626 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/LudgerHentschel
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5ae48dea12d31facb22ce7c3233ced32d758a626 -
Trigger Event:
push
-
Statement type:
File details
Details for the file skgrad-0.1.0-py3-none-any.whl.
File metadata
- Download URL: skgrad-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.2 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 |
a724d2a9965872fbc3736e2e047dfb7b5234c16a5b2d322fa85339e3041094af
|
|
| MD5 |
b93a02e5d32b9609b82fec9a8bfa8646
|
|
| BLAKE2b-256 |
bbb22733a58fbb61fb20c555db6e7c14d7812e00a724ab557b8b2f5bdb483bef
|
Provenance
The following attestation bundles were made for skgrad-0.1.0-py3-none-any.whl:
Publisher:
release.yml on LudgerHentschel/skgrad
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
skgrad-0.1.0-py3-none-any.whl -
Subject digest:
a724d2a9965872fbc3736e2e047dfb7b5234c16a5b2d322fa85339e3041094af - Sigstore transparency entry: 2331853977
- Sigstore integration time:
-
Permalink:
LudgerHentschel/skgrad@5ae48dea12d31facb22ce7c3233ced32d758a626 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/LudgerHentschel
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5ae48dea12d31facb22ce7c3233ced32d758a626 -
Trigger Event:
push
-
Statement type: