Skip to main content

Rigorous computation with Uncertain Number in Python

Project description

Python Version version DOI Documentation Status license contributions welcome

Logo

PyUncertainNumber

Scientific computations of complex systems are surrounded by various forms of uncertainty, requiring appropriate treatment to maximise the credibility of computations. Empirical information for characterisation is often scarce, vague, conflicting and imprecise, requiring expressive uncertainty structures for trustful representation, aggregation and propagation.

This package is underpined by a framework of uncertain number which allows for a closed computation ecosystem whereby trustworthy computations can be conducted in a rigorous manner. It provides capabilities across the typical uncertainty analysis pipeline, encompassing characterisation, aggregation, propagation, and applications including reliability analysis and optimisation under uncertainty, especailly with a focus on imprecise probabilities.

Uncertain Number refers to a class of mathematical objects useful for risk analysis that generalize real numbers, intervals, probability distributions, interval bounds on probability distributions (i.e. probability boxes), and finite DempsterShafer structures. Refer to the documentation of this package for additional introduction.

quick start

PyUncertainNumber can be used to easily create an UncertainNumber object, which may embody a mathematical construct such as PBox, Interval, Distribution, or DempsterShafer structure.

drapbox dynamic visualisationwing
from pyuncertainnumber import UncertainNumber as UN
import pyuncertainnumber as pun

# a verbose to instantiate uncertain numbers with ancillary fields
e = UN(
    name='elas_modulus', 
    symbol='E', 
    unit='Pa', 
    essence='pbox', 
    distribution_parameters=['gaussian', ([0,12],[1,4])])

# or simply use shortcut to create uncertain numbers
a = pun.normal([2,3], [1])
b = pun.normal([10,14], [1])

# specify a response function
def foo(x): return x[0] ** 3 + x[1] + 2

# intrusive call signature which allows for drop-in replacements
response = foo([a, b])

# alternatively, one can use a more generic call signature for propagation
p = Propagation(vars=[a, b], func=foo, method='slicing', interval_strategy='direct')
response = p.run(n_slices=50)

installation

Requirement: Python >=3.11

PyUncertainNumber can be installed from PyPI. Upon activation of your virtual environment, use the code below in your terminal. For additional instructions, refer to installation guide.

pip install pyuncertainnumber

Capabilities

  • PyUncertainNumber is a Python package for generic computational tasks focussing on rigourou uncertainty analysis, which provides a research-grade computing environment for uncertainty characterisation, propagation, validation and uncertainty extrapolation.
  • PyUncertainNumber supports probability bounds analysis to rigorously bound the prediction for the quantity of interest with mixed uncertainty propagation.
  • PyUncertainNumber also features great natural language support as such characterisatin of input uncertainty can be intuitively done by using natural language like about 7 or simple expression like [15 +- 10%], without worrying about the elicitation.
  • Interoperability via serialization: features the save and loading of Uncertain Number objects to work with downstream applications.
  • Yields informative results during the computation process such as the combination that leads to the maximum in vertex method.

UQ multiverse

UQ is a big world (like Marvel multiverse) consisting of abundant theories and software implementations on multiple platforms. We focus mainly on the imprecise probability frameworks. Some notable examples include OpenCossan, UQlab in Matlab and UncertaintyQuantification.jl, ProbabilityBoundsAnalysis.jl in Julia, and many others of course. PyUncertainNumber is rooted in Python and has close ties with the Python scientific computing ecosystem, it builds upon and greatly extends a few pioneering projects, such as intervals, scipy-stats and pba-for-python to generalise probability and interval arithmetic. Beyond arithmetics, PyUncertainNumber has offered a wide spectrum of algorithms and methods for uncertainty characterisation, propagation, surrogate modelling, and optimisation under uncertainty, allowing imprecise uncertainty analysis in both intrusive and non-intrusive manner. PyUncertainNumber is under active development and will continue to be dedicated to support imprecise analysis in engineering using Python.

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

pyuncertainnumber-0.0.19.tar.gz (151.2 kB view details)

Uploaded Source

Built Distribution

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

pyuncertainnumber-0.0.19-py3-none-any.whl (185.8 kB view details)

Uploaded Python 3

File details

Details for the file pyuncertainnumber-0.0.19.tar.gz.

File metadata

  • Download URL: pyuncertainnumber-0.0.19.tar.gz
  • Upload date:
  • Size: 151.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyuncertainnumber-0.0.19.tar.gz
Algorithm Hash digest
SHA256 a2b56b7e1fe677ea5b739925b9ced6ea528e84cc9d9f2cba978fb170bf937a47
MD5 6d425c518349126517a7966ca36af85e
BLAKE2b-256 4e80882ae0bb0c09ff491a63e3577aba1a90ab290c8fe99aa393704b485097d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyuncertainnumber-0.0.19.tar.gz:

Publisher: python-publish.yml on leslieDLcy/PyUncertainNumber

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

File details

Details for the file pyuncertainnumber-0.0.19-py3-none-any.whl.

File metadata

File hashes

Hashes for pyuncertainnumber-0.0.19-py3-none-any.whl
Algorithm Hash digest
SHA256 37ce22c7bdaab6e9f80065e22104de81fff881eff4b2af44813691dcfe9f870d
MD5 9abb486f8a11a454886903ba9b86cfd0
BLAKE2b-256 14d704c19a868c74f3643c92938d7e730f2efa16c70f4075397fffd507d63614

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyuncertainnumber-0.0.19-py3-none-any.whl:

Publisher: python-publish.yml on leslieDLcy/PyUncertainNumber

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

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