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.
- 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: 688-test suite, typed packaging (
pyproject.toml),probvizCLI, Docker/Compose, CI with coverage gate, docs + PyPI + Docker release pipelines. SeeCHANGELOG.md.
Gallery
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 .
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; src.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 src.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 src.fitting import DistributionFitter
from src.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/Gumbelcopulapdf/rvsare bivariate-only (explicit error otherwise).StudentTCopulahas no closed-formcdf/pdf; use Monte Carlo viarvs.MixtureDistributionEM assumes 1-D components; use the sklearn GMM wrappers for multivariate mixtures.- Cauchy moments are undefined — the API surfaces
naninstead of masking it.
Testing
pip install -r requirements-dev.txt
pytest tests/ -q # 688 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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file probviz-1.0.1.tar.gz.
File metadata
- Download URL: probviz-1.0.1.tar.gz
- Upload date:
- Size: 119.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a474cc4c814b55c92d254e0f8aecb2ffacbbfae81408d48c00ed9c12c68f1d01
|
|
| MD5 |
c0e961abb00eed9e281895fc4f163167
|
|
| BLAKE2b-256 |
d9281f32de6766c09a863f8898bbe62c5ff38fc99cf67bbd8bbcb37ad2421417
|
File details
Details for the file probviz-1.0.1-py3-none-any.whl.
File metadata
- Download URL: probviz-1.0.1-py3-none-any.whl
- Upload date:
- Size: 53.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc1b3345277096f7afb7d5c94dfa78b32b2f4f056575d63746a3f8be85e1d8a2
|
|
| MD5 |
33a4d841b0ca7cf0f846d4986962e0aa
|
|
| BLAKE2b-256 |
2a371b88ad22cb62d7fa03b1a20cab698973473561ea2cc3a8b31bcfcb7e0d5f
|