paramnormal: Conventionally parameterized probability distributions
Scipy distributions are weird. Maybe these will be less weird.
The problem this is solving
Let's look at the lognormal distribution. The wikipedia article states that they are parameterized by μ and σ, the mean and standard deviation of the underlying normal distribution. In this case, μ and σ can also be known as the location and scale parameters, respectively.
However, to create a lognormal distribution in scipy, you need three parameters: location, scale, and shape. The tricky part is, however, is that "location" in scipy refers to an offset from zero, "shape" refers to σ, and the "scale" refers to $e^\mu$. This is all explained the scipy documentation, but it took me a couple of readings and bad mistakes to figure it out. It's also never really explicitly stated that scipy's location parameter should be zero 99.999% of the time. That's a very import point to understand when you're fitting lognormal parameters to a sample and you end with three crazy numbers that don't make any sense and distribution with values less than zero despite the fact that you thought lognormal distribution couldn't have values less than zero.
Point of all of this is that paramnormal is trying to make easy what scipy sometimes makes tricky.
So where as in scipy, you would do this:
import numpy
from scipy import stats
mu = 0.75
sigma = 1.25
dist = stats.lognorm(sigma, loc=0, scale=numpy.exp(mu))
In paramnormal, you can do this:
import paramnormal
dist = paramnormal.lognormal(mu=0.75, sigma=1.25)
You can even use Greek letters
dist = paramnormal.lognormal(μ=0.75, σ=1.25)
All three snippets return the same scipy distribution objects and have the same numerical methods (e.g., cdf, pdf, rvs, ppf).
Paramnormal just provides a short cut that let's you only specify the traditional distribution parameters you read about in your text book.
Documentation
We have HTML docs built with sphinx.
Installation
Binaries are available through my conda channel
conda install --channel=phobson paramnormal
This is a pure python package, so installation from source should be as easy as running
pip install . (or uv pip install .) from the source directory if you've cloned the repo.
Otherwise, pip install paramnormal or pip install git+https://github.com/phobson/paramnormal.git will work.
Development
This project is managed with uv:
uv sync # create .venv with dev dependencies
uv run pytest # run the tests
uv run ruff check . && uv run ruff format --check .
uv run --group docs sphinx-build -b html docs docs/_build/html
Then view the docs with:
uv run python -m http.server 8001 --directory docs/_build/html
Development status
From my perspective this is now feature complete, meaning it has all of the distribution that I use somewhat regularly. If you want to add a new distribution, get in touch. Otherwise, I'll just be fixing bugs and typos/ommisions in the documentaion.
Metadata
Release files for paramnormal 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| paramnormal-0.5.0.tar.gz | 224.2 kB | Without provenance | Details for paramnormal-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| paramnormal-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for paramnormal-0.5.0-py3-none-any.whl |
Total release size: 449.8 kB
Release files / paramnormal-0.5.0.tar.gz
| Download URL | paramnormal-0.5.0.tar.gz |
|---|---|
| Size | 224.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
607877fcad631d0167a547420d06c0d5e100ed7ddb93bcdb08c0e6215d7ebd58
|
|
BLAKE2b-256 checksum How to use checksums |
b54ede5cdbb0aa6e9126e9ab65b0ea225ecdb29e9bc197e67a62fbcae1056b43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / paramnormal-0.5.0-py3-none-any.whl
| Download URL | paramnormal-0.5.0-py3-none-any.whl |
|---|---|
| Size | 225.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac4a07e84e5f7d637a35ebc355811816b426710016be2bb7c4cd5428aec0fef8
|
|
BLAKE2b-256 checksum How to use checksums |
6419ceadb8a581f00dca1fa716bd700ba291c218f0214c813041dc3274371684
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for paramnormal 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.