Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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, and ElasticNet
  • LogisticRegression and RidgeClassifier
  • MLPRegressor with identity output
  • MLPClassifier, 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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skgrad-0.1.0.dev0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

skgrad-0.1.0.dev0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file skgrad-0.1.0.dev0.tar.gz.

File metadata

  • Download URL: skgrad-0.1.0.dev0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for skgrad-0.1.0.dev0.tar.gz
Algorithm Hash digest
SHA256 e4cbb2d1bea0116c806c741309ae84156b0e978dae70a8dc12c6e715182d8e6a
MD5 6291cdee4648beaa3ed265669abe3b66
BLAKE2b-256 839eed77d381fa701aecbbd4bd8724a410d2c22626f803e06d3eef89ec8ebb12

See more details on using hashes here.

Provenance

The following attestation bundles were made for skgrad-0.1.0.dev0.tar.gz:

Publisher: release.yml on LudgerHentschel/skgrad

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file skgrad-0.1.0.dev0-py3-none-any.whl.

File metadata

  • Download URL: skgrad-0.1.0.dev0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for skgrad-0.1.0.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ef707628cc6fa38063bc29050834eb4971bcb47e2cfb3344f81e6f7233af372
MD5 cd67cef6316aa0c764793c4255bef2a5
BLAKE2b-256 8324b1327270154d8b29fdb1e310b753d9a2bb99b95dc53d04b347799d268642

See more details on using hashes here.

Provenance

The following attestation bundles were made for skgrad-0.1.0.dev0-py3-none-any.whl:

Publisher: release.yml on LudgerHentschel/skgrad

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.6

2 files

0.1.5

2 files

0.1.1

2 files

0.1.0

2 files

This release

0.1.0.dev0 This release

2 files

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