Skip to main content

CI Docs PyPI version Binder

ipysensitivityprofiler

Jupyter Widgets for visualizing local sensitivities of vectorized functions with signature y = f(x) where x, y are arrays.

Main Features

  • Visualize multiple outputs against multiple inputs interactively
  • Overlay more than one model at once
  • Download pictures of individual plots (by clicking on the red dot)

Installation

pip install ipysensitivityprofiler

Example Usage

See the example notebooks, or run them without installing anything on binder.

Import the library and define one or more vectorized models:

import numpy as np
import ipysensitivityprofiler as isp

def quadratic1(x):
    """y = x1**2 + x2**2 + x1*x2"""
    return np.prod(x, axis=1) + np.power(x, 2).sum(axis=1)

def quadratic2(x):
    """y = 10 + x1**2 + x2**2 - 2 * x1*x2"""
    return 10 - 2 * np.prod(x, axis=1) + np.power(x, 2).sum(axis=1)

Then profile them:

isp.profiler(
    models=[quadratic1, quadratic2],
    xmin=[0, 0],
    xmax=[2, 1],
    ymin=[0],
    ymax=[20],
    x0=[1.5, 0.75],
    resolution=10_000,
    xlabels=["x1", "x2"],
    ylabels=["y"],
)

Use Case

A local sensitivity profile is the trace of a function obtained by holding all dimensions fixed but one. Profiling a model interactively is useful for debugging models (spotting obviously wrong trends early), for robust design (seeing how performance changes when the design is perturbed away from nominal), and for model comparison (overlaying a high-fidelity model, a low-fidelity one, and ground truth on the same plot to see where they disagree).

Limitations

Models must be fast for interactivity: they must be able to evaluate thousands of datapoints on the order of milliseconds. This is a non-issue for empirical regressions (e.g. neural nets) or first-order physics-based models.

The other limitation is screen real estate. Beyond a certain number of inputs and outputs, humans become overwhelmed and the screen runs out of room, so this library is best suited for targeted studies on a subspace of a larger problem.

Documentation

Documentation is available here (generated using sphinx).

Contributing

Contributions are welcome — see CONTRIBUTING.md for how to set up the development environment (pixi) and run the QA pipeline.

A Note on AI-Assisted Development

This library began in 2024 as hand-written code, and its foundation — the profiling idea itself, the widget architecture, and the vectorized numerics behind it — reflects deliberate design rather than generated output. We recognize how capable AI has since become, and we leverage it judiciously and under human oversight — applying it where it genuinely improves the project, such as performance audits and test coverage, not as a substitute for understanding it. Every change, whatever its source, is held to the same standard of review.

License

Distributed under the terms of the MIT License.

Download files

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

Source Distribution

ipysensitivityprofiler-0.0.2.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

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

ipysensitivityprofiler-0.0.2-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file ipysensitivityprofiler-0.0.2.tar.gz.

File metadata

  • Download URL: ipysensitivityprofiler-0.0.2.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ipysensitivityprofiler-0.0.2.tar.gz
Algorithm Hash digest
SHA256 1d0aca05ee8837a401bcaff0a0496d15e22c04af755d620d21697496e7129e4a
MD5 a17f846cf9759f6a8cf16c3f16a2f474
BLAKE2b-256 7c6fa9854942fe0be04850bc0d168eebfa9b61519b1d7e8eeb7c6d2124058206

See more details on using hashes here.

Provenance

The following attestation bundles were made for ipysensitivityprofiler-0.0.2.tar.gz:

Publisher: release.yml on shb84/ipysensitivityprofiler

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

File details

Details for the file ipysensitivityprofiler-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for ipysensitivityprofiler-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 99c29b49b9796427cab1d88d059c80b65569178306144885d94fafa37402ca56
MD5 d8e1054eb2dd502cf2b825dc82be2ade
BLAKE2b-256 da2fda068c91e8363329afd19c31bdc71dd15f620a5ac9bb7b9bae1f31276c98

See more details on using hashes here.

Provenance

The following attestation bundles were made for ipysensitivityprofiler-0.0.2-py3-none-any.whl:

Publisher: release.yml on shb84/ipysensitivityprofiler

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.0.3

2 files

This release

0.0.2 This release

2 files

0.0.1

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