Skip to main content

Last-layer uncertainty modeling via zonotopic representations.

Project description

Zonolayer

Matthew McCann
University of Strathclyde, 2025

Developed with guidance and support from Marco de Angelis, University of Strathclyde

Python Version License: MIT PyPI Version

Zonolayer is a Python package for last-layer uncertainty modeling via zonotopic representations.
It provides zonotopic output bounds and statistical prediction intervals for neural networks with interval-bounded outputs, enabling precise and interpretable uncertainty quantification in regression tasks.


Features

  • Compute zonotopic bounds for last-layer outputs.
  • Combine statistical prediction intervals with interval uncertainty.
  • Compatible with PyTorch networks exposing latent features.
  • Modular, research-friendly, and easy to use.

By default, Zonolayer relies on NumPy for all numerical computations and interval handling.

If you require more advanced interval arithmetic (e.g., using pyinterval or other specialized packages), you can install the optional dependencies and modify the code accordingly, or submit a request for support to be added. I appreciate any and all feedback.

IPM support using the PyIPM library by J. Sadeghi


Installation

Ensure all requirements from requirements.txt are installed to reduce any potential issues.

pip install zonolayer

Getting Started

See the examples directory for working examples with different types of neural networks and data.

Example Plots

Zonolayer produces zonotopic bounds and statistical prediction intervals. Example outputs:

Zonotopic bounds Zonotopic bounds 2


License

MIT License

Copyright (c) Matthew McCann

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

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

Source Distribution

zonolayer-0.8.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

zonolayer-0.8.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file zonolayer-0.8.0.tar.gz.

File metadata

  • Download URL: zonolayer-0.8.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for zonolayer-0.8.0.tar.gz
Algorithm Hash digest
SHA256 9a3b67a11f7bd05a0da29394e0cf6a012b6a4158b69e3b779047298238038a57
MD5 18da70516b861e88859e243d7079b7dd
BLAKE2b-256 6f9f5b26032b16d106d9645cfa5d3b0e639b04ce70db0bac4a0353f1b9a93a7a

See more details on using hashes here.

File details

Details for the file zonolayer-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: zonolayer-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for zonolayer-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f6452641355d527b88c1f9c8c456af83a20eca812d053d7935d92c2400d69963
MD5 1485b5af67faf6b8f18b45a10acaa04b
BLAKE2b-256 8ea7e6858f40f4264e19fbfc3ada2af53ed1d3cfaebeb5660a07501f277dffac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page