Skip to main content

Probability Distribution Visualizer

An interactive probability distribution visualizer with a Streamlit web interface, a typed Python API, and toolkits for fitting, Monte Carlo simulation, and statistical testing.

CI Status Tests Docs License
Python Streamlit Docker PRs Welcome

  • Docs (GitHub Pages): https://sanskarpan.github.io/probviz/
  • 16 univariate distributions (10 continuous + 6 discrete) with PDF/PMF, CDF, quantiles, sampling, and full statistics — in the web app and the API.
  • Advanced modules (Python API): multivariate distributions, copulas, mixtures/GMM, distribution fitting, Monte Carlo, and statistical tests.
  • Production-ready: 695-test suite, typed packaging (pyproject.toml), probviz CLI, Docker/Compose, CI with coverage gate, docs + PyPI + Docker release pipelines. See CHANGELOG.md.

Normal PDF morphing with sigma Central Limit Theorem convergence Gaussian copula dependence sweep
Beta PDF shape morph Gaussian mixture separation

Top: Normal σ sweep · CLT convergence · Gaussian-copula ρ sweep. Bottom: Beta shape sweep · mixture separation. Regenerate with python examples/generate_media.py.

Quick start

pip install probviz
probviz app

Or from source:

git clone https://github.com/sanskarpan/probviz.git
cd probviz
pip install -r requirements.txt
streamlit run web/app.py

Open http://localhost:8501. Full guide: QUICKSTART.md · docs quickstart.

Install as a package

pip install -e ".[test]"
probviz app        # launch the UI
probviz test       # run tests
probviz version    # print version

Docker

docker build -t probviz .
docker run -p 8501:8501 probviz
# or
docker compose up --build

What's inside

Area Contents
Univariate Normal, Exponential, Uniform, Beta, Gamma, Chi-Square, Student-t, Weibull, Lognormal, Cauchy · Binomial, Poisson, Geometric, Negative Binomial, Hypergeometric, Discrete Uniform
Multivariate Multivariate Normal, Dirichlet, Multivariate Student-t, Wishart
Copulas Gaussian, Clayton, Gumbel, Student-t + fit_copula_to_data
Mixtures MixtureDistribution (1-D EM), GaussianMixtureModel, BayesianGMM, BIC selection
Fitting DistributionFitter, BayesianEstimator, GoodnessOfFit
Monte Carlo MonteCarloSimulator, VarianceReduction, QuasiMonteCarloSimulator
Tests hypothesis / nonparametric / descriptive dict-returning helpers
Utils validation, preprocessing, plotting, structured logging; probviz.visualizers facade

Project layout and conventions: docs/architecture.md. API reference: docs/api.md (rendered on the docs site).

Python API

import numpy as np
from probviz.distributions import NormalDistribution, BinomialDistribution

normal = NormalDistribution(mu=0, sigma=1)
x = np.linspace(-4, 4, 200)
pdf, cdf = normal.pdf(x), normal.cdf(x)
samples = normal.rvs(size=1000, random_state=42)
print(normal.get_statistics())
print(normal.interval(0.95), normal.ppf(0.975))

binomial = BinomialDistribution(n=10, p=0.3)
print(binomial.pdf(np.arange(0, 11)))
from probviz.fitting import DistributionFitter
from probviz.monte_carlo import MonteCarloSimulator

fitter = DistributionFitter(samples)
print(fitter.fit_all())

rng = np.random.default_rng(42)
sim = MonteCarloSimulator(random_seed=42)
res = sim.estimate_probability(lambda: rng.normal(0, 1) > 1.0, num_samples=100_000)
print(res["probability"], res["confidence_interval"])

Known limitations (by design)

  • The Streamlit app covers the 16 univariate distributions only; advanced modules are Python-API only.
  • Clayton/Gumbel copula pdf/rvs are bivariate-only (explicit error otherwise).
  • StudentTCopula has no closed-form cdf/pdf; use Monte Carlo via rvs.
  • MixtureDistribution EM assumes 1-D components; use the sklearn GMM wrappers for multivariate mixtures.
  • Cauchy moments are undefined — the API surfaces nan instead of masking it.

Testing

pip install -r requirements-dev.txt
pytest tests/ -q                                  # 695 tests
pytest tests/ -q --cov=src --cov-report=term      # with coverage (gate: 80%)
flake8 src/ tests/ --count --select=E9,F63,F7,F82 --statistics
mypy --config-file=pyproject.toml src/

Contributing

See CONTRIBUTING.md (setup, style, tests, PR checklist), CODE_OF_CONDUCT.md, and SECURITY.md.

License

MIT — see LICENSE. If you use this in research or teaching:

@software{probability_distribution_visualizer,
  title  = {Probability Distribution Visualizer},
  author = {sanskarpan},
  year   = {2026},
  url    = {https://github.com/sanskarpan/probviz}
}

Also see CITATION.cff.

Metadata

Release files for probviz 1.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for probviz 1.0.8
File Size Uploaded Provenance Actions
probviz-1.0.8.tar.gz 327.2 kB Without provenance Details for probviz-1.0.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for probviz 1.0.8
File Interpreter ABI Platform Actions
probviz-1.0.8-py3-none-any.whl Python 3 none any Details for probviz-1.0.8-py3-none-any.whl

Total release size: 419.1 kB

Release files / probviz-1.0.8.tar.gz

Download URL probviz-1.0.8.tar.gz
Size 327.2 kB
Tags Source
SHA-256 checksum
How to use checksums
736c2e28d0c254c9076b68fa682c3614abf5e8efec8a50434ea2c1d8e6ba7ad3
BLAKE2b-256 checksum
How to use checksums
13e9e7718990d696fcd82086289331360c9a14bd4b6b904d71e6efac47fe7ac8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / probviz-1.0.8-py3-none-any.whl

Download URL probviz-1.0.8-py3-none-any.whl
Size 91.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9752beb767f1e0e1fee9a28e869203a100bf582b0c3deec1e45584224590856e
BLAKE2b-256 checksum
How to use checksums
2bf074650b688762329564bf1eea4db46ab005781d4854ce44fc10bd3c462e34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for probviz 1.0.8

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.

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