probviz 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. probviz-1.0.1/CHANGELOG.md +78 -0
  2. probviz-1.0.1/CITATION.cff +19 -0
  3. probviz-1.0.1/LICENSE +21 -0
  4. probviz-1.0.1/MANIFEST.in +5 -0
  5. probviz-1.0.1/PKG-INFO +219 -0
  6. probviz-1.0.1/QUICKSTART.md +56 -0
  7. probviz-1.0.1/README.md +162 -0
  8. probviz-1.0.1/docs/advanced.md +47 -0
  9. probviz-1.0.1/docs/api.md +61 -0
  10. probviz-1.0.1/docs/architecture.md +31 -0
  11. probviz-1.0.1/docs/archive/ADVANCED_FEATURES.md +614 -0
  12. probviz-1.0.1/docs/archive/AUDIT_LOG.md +110 -0
  13. probviz-1.0.1/docs/archive/FINAL_REPORT.md +200 -0
  14. probviz-1.0.1/docs/archive/FIXES.md +118 -0
  15. probviz-1.0.1/docs/archive/ISSUES.md +49 -0
  16. probviz-1.0.1/docs/archive/PROJECT_SUMMARY.md +375 -0
  17. probviz-1.0.1/docs/archive/REVIEW_PROMPT.md +1032 -0
  18. probviz-1.0.1/docs/archive/TEST_VERIFICATION_REPORT.md +383 -0
  19. probviz-1.0.1/docs/archive/index.md +23 -0
  20. probviz-1.0.1/docs/changelog.md +10 -0
  21. probviz-1.0.1/docs/contributing.md +14 -0
  22. probviz-1.0.1/docs/distributions.md +59 -0
  23. probviz-1.0.1/docs/examples.md +51 -0
  24. probviz-1.0.1/docs/fitting.md +19 -0
  25. probviz-1.0.1/docs/index.md +57 -0
  26. probviz-1.0.1/docs/installation.md +53 -0
  27. probviz-1.0.1/docs/monte-carlo.md +18 -0
  28. probviz-1.0.1/docs/quickstart.md +42 -0
  29. probviz-1.0.1/docs/statistical-tests.md +14 -0
  30. probviz-1.0.1/docs/web-app.md +19 -0
  31. probviz-1.0.1/examples/basic_usage.py +211 -0
  32. probviz-1.0.1/examples/generate_media.py +188 -0
  33. probviz-1.0.1/probviz.egg-info/PKG-INFO +219 -0
  34. probviz-1.0.1/probviz.egg-info/SOURCES.txt +80 -0
  35. probviz-1.0.1/probviz.egg-info/dependency_links.txt +1 -0
  36. probviz-1.0.1/probviz.egg-info/entry_points.txt +2 -0
  37. probviz-1.0.1/probviz.egg-info/requires.txt +29 -0
  38. probviz-1.0.1/probviz.egg-info/top_level.txt +2 -0
  39. probviz-1.0.1/pyproject.toml +171 -0
  40. probviz-1.0.1/requirements-dev.txt +10 -0
  41. probviz-1.0.1/requirements-docs.txt +3 -0
  42. probviz-1.0.1/requirements.txt +11 -0
  43. probviz-1.0.1/setup.cfg +4 -0
  44. probviz-1.0.1/setup.py +11 -0
  45. probviz-1.0.1/src/__init__.py +7 -0
  46. probviz-1.0.1/src/cli.py +64 -0
  47. probviz-1.0.1/src/distributions/__init__.py +89 -0
  48. probviz-1.0.1/src/distributions/base.py +332 -0
  49. probviz-1.0.1/src/distributions/continuous.py +411 -0
  50. probviz-1.0.1/src/distributions/copulas.py +503 -0
  51. probviz-1.0.1/src/distributions/discrete.py +259 -0
  52. probviz-1.0.1/src/distributions/mixtures.py +490 -0
  53. probviz-1.0.1/src/distributions/multivariate.py +530 -0
  54. probviz-1.0.1/src/fitting/__init__.py +13 -0
  55. probviz-1.0.1/src/fitting/distribution_fitter.py +483 -0
  56. probviz-1.0.1/src/monte_carlo/__init__.py +15 -0
  57. probviz-1.0.1/src/monte_carlo/simulator.py +493 -0
  58. probviz-1.0.1/src/statistical_tests/__init__.py +44 -0
  59. probviz-1.0.1/src/statistical_tests/descriptive.py +217 -0
  60. probviz-1.0.1/src/statistical_tests/hypothesis_tests.py +233 -0
  61. probviz-1.0.1/src/statistical_tests/nonparametric.py +157 -0
  62. probviz-1.0.1/src/utils/__init__.py +69 -0
  63. probviz-1.0.1/src/utils/data_preprocessing.py +291 -0
  64. probviz-1.0.1/src/utils/logger.py +248 -0
  65. probviz-1.0.1/src/utils/plotting.py +341 -0
  66. probviz-1.0.1/src/utils/validation.py +244 -0
  67. probviz-1.0.1/src/visualizers/__init__.py +122 -0
  68. probviz-1.0.1/tests/test_cli.py +22 -0
  69. probviz-1.0.1/tests/test_copulas.py +459 -0
  70. probviz-1.0.1/tests/test_distributions.py +1192 -0
  71. probviz-1.0.1/tests/test_fitting.py +417 -0
  72. probviz-1.0.1/tests/test_integration.py +373 -0
  73. probviz-1.0.1/tests/test_logger.py +191 -0
  74. probviz-1.0.1/tests/test_mixtures.py +372 -0
  75. probviz-1.0.1/tests/test_monte_carlo.py +533 -0
  76. probviz-1.0.1/tests/test_multivariate.py +636 -0
  77. probviz-1.0.1/tests/test_plotting.py +646 -0
  78. probviz-1.0.1/tests/test_statistical_tests.py +824 -0
  79. probviz-1.0.1/tests/test_utils.py +689 -0
  80. probviz-1.0.1/tests/test_visualizers.py +52 -0
  81. probviz-1.0.1/web/__init__.py +1 -0
  82. probviz-1.0.1/web/app.py +600 -0
@@ -0,0 +1,78 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.1] — 2026-09-11
9
+
10
+ ### Changed
11
+
12
+ - Renamed the project and distribution to **`probviz`** (GitHub repo
13
+ `sanskarpan/probviz`, PyPI `probviz`, docs at
14
+ <https://sanskarpan.github.io/probviz/>). All URLs, badges, packaging
15
+ metadata, Docker labels, and citations updated; `docs/archive/` historical
16
+ notes intentionally left untouched.
17
+
18
+ ## [1.0.0] — 2026-09-07
19
+
20
+ ### Added
21
+
22
+ - `LICENSE` (MIT) and `CITATION.cff`.
23
+ - `src/cli.py` with the `probviz` command (`app`, `test`, `version`); fixed the
24
+ packaging entry point (`web.app:main` → `src.cli:main`) and added
25
+ `web/__init__.py` / `src/__init__.py` (`__version__`).
26
+ - `tests/conftest.py` centralizing the `src`-layout path setup.
27
+ - `requirements-dev.txt` / `requirements-docs.txt` splitting dev and docs tooling.
28
+ - `src/visualizers` public facade (`plot_pdf`, `plot_cdf`, `plot_comparison`)
29
+ re-exporting `src.utils.plotting`, resolving the previously empty package.
30
+ - Missing `src.utils` re-exports (`validate_integer`,
31
+ `validate_covariance_matrix`, `validate_correlation_matrix`, `log_transform`,
32
+ `box_cox_transform`, `plot_probability_bands`) and abstract-base exports
33
+ (`Copula`, `MultivariateDistribution`).
34
+ - MkDocs Material site (`mkdocs.yml`, `docs/`) with GitHub Pages deploy workflow.
35
+ - Production repo files: `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`,
36
+ `SECURITY.md`, issue/PR templates, `CODEOWNERS`, `.editorconfig`,
37
+ `.gitattributes`, `MANIFEST.in`, `.github/workflows/docs.yml`,
38
+ `.github/workflows/publish.yml`.
39
+
40
+ ### Fixed
41
+
42
+ - `MixtureDistribution.fit_em`: convergence is now checked **after** the M-step
43
+ so returned weights/components/responsibilities are never one iteration stale;
44
+ added guards for empty data, `n_components > n`, zero row-likelihoods, zero
45
+ component counts, and zero variances.
46
+ - Replaced global `np.random.seed` mutation with local
47
+ `np.random.default_rng(random_state)` in mixture, multivariate-t, and all
48
+ copula samplers (reproducibility preserved per-call).
49
+ - Fixed dead `np.atleast_2d` + `ndim == 1` branches in GMM wrappers via a
50
+ `_as_2d` helper that correctly maps 1-D input to `(n, 1)`.
51
+ - `plot_bivariate_normal`: builds the 2-D + 3-D panels directly instead of
52
+ orphaning a subplot axis.
53
+ - `GaussianCopula.pdf`: clips uniform inputs to avoid `ppf(0/1) → ±inf → nan`.
54
+ - `GumbelCopula.rvs`: no longer silently substitutes `0.5` on solver failure;
55
+ degenerate brackets raise `ValueError`, converged roots are kept.
56
+ - `fit_copula_to_data`: validates Kendall's τ ranges for Clayton/Gumbel and
57
+ documents the Student-t `df=4` simplification.
58
+ - `StudentTCopula`: validates correlation diagonals/positive-definiteness and
59
+ now documents `cdf`/`pdf` as intentionally unimplemented (Monte Carlo via
60
+ `rvs` instead of inheriting a bare `NotImplementedError`).
61
+ - `Clayton`/`Gumbel` bivariate-only guards now state the limitation explicitly.
62
+ - Removed dead imports (`ProcessPoolExecutor`, unused `warnings`/`optimize`/
63
+ `gammaln`/`Axes3D`) and the redundant inner `Lognormal` numpy import path.
64
+
65
+ ### Changed
66
+
67
+ - `pyproject.toml` is now the single source of packaging truth (aligned
68
+ runtime deps incl. scikit-learn/statsmodels/joblib, `requires-python >=3.10`,
69
+ ruff config, project URLs); `setup.py` is a thin shim; `requirements.txt`
70
+ mirrors runtime deps.
71
+ - Root historical notes moved to `docs/archive/` with a staleness disclaimer.
72
+ - `README.md` rewritten for accuracy (16 univariate + advanced modules, real
73
+ tree, correct repo URLs, honest test counts, documented limitations).
74
+
75
+ ### Verification
76
+
77
+ - `pytest tests/ -q`: **688 passed**.
78
+ - `flake8 src/ tests/ --select=E9,F63,F7,F82`, `mypy src/`, Docker build.
@@ -0,0 +1,19 @@
1
+ cff-version: 1.2.0
2
+ title: Probability Distribution Visualizer
3
+ message: If you use this software, please cite it as below.
4
+ type: software
5
+ authors:
6
+ - given-names: Sanskar
7
+ family-names: Pan
8
+ email: sanskarpandey2004@gmail.com
9
+ repository-code: https://github.com/sanskarpan/probviz
10
+ url: https://sanskarpan.github.io/probviz/
11
+ license: MIT
12
+ version: 1.0.1
13
+ date-released: "2026-09-11"
14
+ keywords:
15
+ - statistics
16
+ - probability-distributions
17
+ - visualization
18
+ - streamlit
19
+ - monte-carlo
probviz-1.0.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2026 Sanskar Pan and contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,5 @@
1
+ include README.md QUICKSTART.md CHANGELOG.md LICENSE CITATION.cff
2
+ include requirements*.txt
3
+ recursive-include examples *.py
4
+ recursive-include docs *.md *.yml
5
+ global-exclude __pycache__ *.py[cod]
probviz-1.0.1/PKG-INFO ADDED
@@ -0,0 +1,219 @@
1
+ Metadata-Version: 2.4
2
+ Name: probviz
3
+ Version: 1.0.1
4
+ Summary: Interactive probability distribution visualizer: 16 univariate + multivariate, copulas, mixtures, fitting, Monte Carlo, and statistical tests
5
+ Author: Sanskar Pan and contributors
6
+ Maintainer-email: Sanskar Pan <sanskarpandey2004@gmail.com>
7
+ License: MIT
8
+ Project-URL: Homepage, https://github.com/sanskarpan/probviz
9
+ Project-URL: Documentation, https://sanskarpan.github.io/probviz/
10
+ Project-URL: Repository, https://github.com/sanskarpan/probviz
11
+ Project-URL: Issues, https://github.com/sanskarpan/probviz/issues
12
+ Project-URL: Changelog, https://github.com/sanskarpan/probviz/blob/main/CHANGELOG.md
13
+ Keywords: statistics,probability,distributions,visualization,streamlit,monte-carlo
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Education
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
19
+ Classifier: Topic :: Scientific/Engineering :: Visualization
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: License :: OSI Approved :: MIT License
25
+ Classifier: Operating System :: OS Independent
26
+ Classifier: Typing :: Typed
27
+ Requires-Python: >=3.10
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE
30
+ Requires-Dist: numpy>=1.24.0
31
+ Requires-Dist: scipy>=1.11.0
32
+ Requires-Dist: pandas>=2.1.0
33
+ Requires-Dist: matplotlib>=3.8.0
34
+ Requires-Dist: seaborn>=0.13.0
35
+ Requires-Dist: plotly>=5.18.0
36
+ Requires-Dist: streamlit>=1.29.0
37
+ Requires-Dist: scikit-learn>=1.7.2
38
+ Requires-Dist: statsmodels>=0.15.0
39
+ Requires-Dist: joblib>=1.6.0
40
+ Provides-Extra: dev
41
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
42
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
43
+ Requires-Dist: mypy>=1.7.0; extra == "dev"
44
+ Requires-Dist: black>=23.12.0; extra == "dev"
45
+ Requires-Dist: flake8>=6.1.0; extra == "dev"
46
+ Requires-Dist: isort>=5.13.0; extra == "dev"
47
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
48
+ Requires-Dist: pre-commit>=3.0.0; extra == "dev"
49
+ Provides-Extra: docs
50
+ Requires-Dist: mkdocs>=1.6.0; extra == "docs"
51
+ Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
52
+ Requires-Dist: mkdocstrings[python]>=0.24.0; extra == "docs"
53
+ Provides-Extra: test
54
+ Requires-Dist: pytest>=7.4.0; extra == "test"
55
+ Requires-Dist: pytest-cov>=4.1.0; extra == "test"
56
+ Dynamic: license-file
57
+
58
+ # Probability Distribution Visualizer
59
+
60
+ An interactive probability distribution visualizer with a Streamlit web interface,
61
+ a typed Python API, and toolkits for fitting, Monte Carlo simulation, and
62
+ statistical testing.
63
+
64
+ <p align="center">
65
+ <a href="https://github.com/sanskarpan/probviz/actions/workflows/ci.yml"><img src="https://github.com/sanskarpan/probviz/actions/workflows/ci.yml/badge.svg" alt="CI Status"></a>
66
+ <a href="https://github.com/sanskarpan/probviz/actions/workflows/ci.yml"><img src="https://img.shields.io/badge/tests-688%20passed-brightgreen" alt="Tests"></a>
67
+ <a href="https://sanskarpan.github.io/probviz/"><img src="https://img.shields.io/badge/docs-GitHub%20Pages-blue" alt="Docs"></a>
68
+ <a href="https://github.com/sanskarpan/probviz/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="License"></a>
69
+ <br>
70
+ <a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue?logo=python" alt="Python"></a>
71
+ <a href="https://streamlit.io/"><img src="https://img.shields.io/badge/Streamlit-1.29+-FF4B4B?logo=streamlit" alt="Streamlit"></a>
72
+ <a href="https://github.com/sanskarpan/probviz/pkgs/container/probviz"><img src="https://img.shields.io/badge/docker-ghcr.io-2496ED?logo=docker" alt="Docker"></a>
73
+ <a href="https://github.com/sanskarpan/probviz/pulls"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen" alt="PRs Welcome"></a>
74
+ </p>
75
+
76
+ - **Docs (GitHub Pages):** <https://sanskarpan.github.io/probviz/>
77
+ - **16 univariate distributions** (10 continuous + 6 discrete) with PDF/PMF, CDF,
78
+ quantiles, sampling, and full statistics — in the web app and the API.
79
+ - **Advanced modules** (Python API): multivariate distributions, copulas,
80
+ mixtures/GMM, distribution fitting, Monte Carlo, and statistical tests.
81
+ - **Production-ready:** 688-test suite, typed packaging (`pyproject.toml`),
82
+ `probviz` CLI, Docker/Compose, CI with coverage gate, docs + PyPI + Docker
83
+ release pipelines. See [`CHANGELOG.md`](CHANGELOG.md).
84
+
85
+ ## Gallery
86
+
87
+ <p align="center">
88
+ <img src="docs/assets/normal_sigma_morph.gif" width="250" alt="Normal PDF morphing with sigma">
89
+ <img src="docs/assets/clt_convergence.gif" width="250" alt="Central Limit Theorem convergence">
90
+ <img src="docs/assets/copula_dependence.gif" width="210" alt="Gaussian copula dependence sweep">
91
+ <br>
92
+ <img src="docs/assets/beta_shape_morph.gif" width="250" alt="Beta PDF shape morph">
93
+ <img src="docs/assets/mixture_separation.gif" width="250" alt="Gaussian mixture separation">
94
+ </p>
95
+
96
+ *Top: Normal σ sweep · CLT convergence · Gaussian-copula ρ sweep. Bottom: Beta shape sweep · mixture separation. Regenerate with `python examples/generate_media.py`.*
97
+
98
+ ## Quick start
99
+
100
+ ```bash
101
+ pip install probviz
102
+ probviz app
103
+ ```
104
+
105
+ Or from source:
106
+
107
+ ```bash
108
+ git clone https://github.com/sanskarpan/probviz.git
109
+ cd probviz
110
+ pip install -r requirements.txt
111
+ streamlit run web/app.py
112
+ ```
113
+
114
+ Open `http://localhost:8501`. Full guide: [`QUICKSTART.md`](QUICKSTART.md) ·
115
+ [docs quickstart](https://sanskarpan.github.io/probviz/quickstart/).
116
+
117
+ ### Install as a package
118
+
119
+ ```bash
120
+ pip install -e .
121
+ probviz app # launch the UI
122
+ probviz test # run tests
123
+ probviz version # print version
124
+ ```
125
+
126
+ ### Docker
127
+
128
+ ```bash
129
+ docker build -t probviz .
130
+ docker run -p 8501:8501 probviz
131
+ # or
132
+ docker compose up --build
133
+ ```
134
+
135
+ ## What's inside
136
+
137
+ | Area | Contents |
138
+ |---|---|
139
+ | Univariate | Normal, Exponential, Uniform, Beta, Gamma, Chi-Square, Student-t, Weibull, Lognormal, Cauchy · Binomial, Poisson, Geometric, Negative Binomial, Hypergeometric, Discrete Uniform |
140
+ | Multivariate | Multivariate Normal, Dirichlet, Multivariate Student-t, Wishart |
141
+ | Copulas | Gaussian, Clayton, Gumbel, Student-t + `fit_copula_to_data` |
142
+ | Mixtures | `MixtureDistribution` (1-D EM), `GaussianMixtureModel`, `BayesianGMM`, BIC selection |
143
+ | Fitting | `DistributionFitter`, `BayesianEstimator`, `GoodnessOfFit` |
144
+ | Monte Carlo | `MonteCarloSimulator`, `VarianceReduction`, `QuasiMonteCarloSimulator` |
145
+ | Tests | hypothesis / nonparametric / descriptive dict-returning helpers |
146
+ | Utils | validation, preprocessing, plotting, structured logging; `src.visualizers` facade |
147
+
148
+ Project layout and conventions: [`docs/architecture.md`](docs/architecture.md).
149
+ API reference: [`docs/api.md`](docs/api.md) (rendered on the docs site).
150
+
151
+ ## Python API
152
+
153
+ ```python
154
+ import numpy as np
155
+ from src.distributions import NormalDistribution, BinomialDistribution
156
+
157
+ normal = NormalDistribution(mu=0, sigma=1)
158
+ x = np.linspace(-4, 4, 200)
159
+ pdf, cdf = normal.pdf(x), normal.cdf(x)
160
+ samples = normal.rvs(size=1000, random_state=42)
161
+ print(normal.get_statistics())
162
+ print(normal.interval(0.95), normal.ppf(0.975))
163
+
164
+ binomial = BinomialDistribution(n=10, p=0.3)
165
+ print(binomial.pdf(np.arange(0, 11)))
166
+ ```
167
+
168
+ ```python
169
+ from src.fitting import DistributionFitter
170
+ from src.monte_carlo import MonteCarloSimulator
171
+
172
+ fitter = DistributionFitter(samples)
173
+ print(fitter.fit_all())
174
+
175
+ rng = np.random.default_rng(42)
176
+ sim = MonteCarloSimulator(random_seed=42)
177
+ res = sim.estimate_probability(lambda: rng.normal(0, 1) > 1.0, num_samples=100_000)
178
+ print(res["probability"], res["confidence_interval"])
179
+ ```
180
+
181
+ ## Known limitations (by design)
182
+
183
+ - The Streamlit app covers the **16 univariate distributions only**; advanced
184
+ modules are Python-API only.
185
+ - `Clayton`/`Gumbel` copula `pdf`/`rvs` are **bivariate-only** (explicit error otherwise).
186
+ - `StudentTCopula` has **no closed-form `cdf`/`pdf`**; use Monte Carlo via `rvs`.
187
+ - `MixtureDistribution` EM assumes **1-D** components; use the sklearn GMM wrappers
188
+ for multivariate mixtures.
189
+ - Cauchy moments are undefined — the API surfaces `nan` instead of masking it.
190
+
191
+ ## Testing
192
+
193
+ ```bash
194
+ pip install -r requirements-dev.txt
195
+ pytest tests/ -q # 688 tests
196
+ pytest tests/ -q --cov=src --cov-report=term # with coverage (gate: 80%)
197
+ flake8 src/ tests/ --count --select=E9,F63,F7,F82 --statistics
198
+ mypy --config-file=pyproject.toml src/
199
+ ```
200
+
201
+ ## Contributing
202
+
203
+ See [`CONTRIBUTING.md`](CONTRIBUTING.md) (setup, style, tests, PR checklist),
204
+ [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md), and [`SECURITY.md`](SECURITY.md).
205
+
206
+ ## License
207
+
208
+ MIT — see [`LICENSE`](LICENSE). If you use this in research or teaching:
209
+
210
+ ```bibtex
211
+ @software{probability_distribution_visualizer,
212
+ title = {Probability Distribution Visualizer},
213
+ author = {sanskarpan},
214
+ year = {2026},
215
+ url = {https://github.com/sanskarpan/probviz}
216
+ }
217
+ ```
218
+
219
+ Also see [`CITATION.cff`](CITATION.cff).
@@ -0,0 +1,56 @@
1
+ # Quickstart
2
+
3
+ Get from zero to interactive plots in under five minutes.
4
+
5
+ ## 1. Install
6
+
7
+ ```bash
8
+ git clone https://github.com/sanskarpan/probviz.git
9
+ cd probviz
10
+ python -m venv .venv && source .venv/bin/activate
11
+ pip install -r requirements.txt
12
+ ```
13
+
14
+ ## 2. Launch the web app
15
+
16
+ ```bash
17
+ streamlit run web/app.py
18
+ # or, after `pip install -e .`:
19
+ probviz app
20
+ ```
21
+
22
+ Open `http://localhost:8501`.
23
+
24
+ ## 3. Explore
25
+
26
+ 1. Pick **Continuous** or **Discrete** in the sidebar.
27
+ 2. Choose one of the **16 univariate distributions**.
28
+ 3. Move the parameter sliders (bounds come from `get_parameter_bounds()`).
29
+ 4. Read the PDF/PMF + CDF charts, sample overlay, statistics table, and quantiles.
30
+
31
+ ## 4. Try the Python API
32
+
33
+ ```python
34
+ import numpy as np
35
+ from src.distributions import NormalDistribution
36
+
37
+ normal = NormalDistribution(mu=0, sigma=1)
38
+ x = np.linspace(-4, 4, 200)
39
+ pdf, cdf = normal.pdf(x), normal.cdf(x)
40
+ samples = normal.rvs(size=1000, random_state=42)
41
+ print(normal.get_statistics())
42
+ ```
43
+
44
+ ## 5. Go further
45
+
46
+ - `docs/` (GitHub Pages): fitting, Monte Carlo, copulas, mixtures, API reference.
47
+ - `examples/basic_usage.py`: `python examples/basic_usage.py`.
48
+ - `pytest tests/ -q`: run the 688-test suite.
49
+
50
+ ## Troubleshooting
51
+
52
+ | Symptom | Fix |
53
+ |---|---|
54
+ | `streamlit: command not found` | Activate the venv / `pip install -r requirements.txt` |
55
+ | Port 8501 busy | `streamlit run web/app.py --server.port 8502` |
56
+ | Import errors in snippets | Run from the repo root or `pip install -e .`; imports are `from src....` |
@@ -0,0 +1,162 @@
1
+ # Probability Distribution Visualizer
2
+
3
+ An interactive probability distribution visualizer with a Streamlit web interface,
4
+ a typed Python API, and toolkits for fitting, Monte Carlo simulation, and
5
+ statistical testing.
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/sanskarpan/probviz/actions/workflows/ci.yml"><img src="https://github.com/sanskarpan/probviz/actions/workflows/ci.yml/badge.svg" alt="CI Status"></a>
9
+ <a href="https://github.com/sanskarpan/probviz/actions/workflows/ci.yml"><img src="https://img.shields.io/badge/tests-688%20passed-brightgreen" alt="Tests"></a>
10
+ <a href="https://sanskarpan.github.io/probviz/"><img src="https://img.shields.io/badge/docs-GitHub%20Pages-blue" alt="Docs"></a>
11
+ <a href="https://github.com/sanskarpan/probviz/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="License"></a>
12
+ <br>
13
+ <a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue?logo=python" alt="Python"></a>
14
+ <a href="https://streamlit.io/"><img src="https://img.shields.io/badge/Streamlit-1.29+-FF4B4B?logo=streamlit" alt="Streamlit"></a>
15
+ <a href="https://github.com/sanskarpan/probviz/pkgs/container/probviz"><img src="https://img.shields.io/badge/docker-ghcr.io-2496ED?logo=docker" alt="Docker"></a>
16
+ <a href="https://github.com/sanskarpan/probviz/pulls"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen" alt="PRs Welcome"></a>
17
+ </p>
18
+
19
+ - **Docs (GitHub Pages):** <https://sanskarpan.github.io/probviz/>
20
+ - **16 univariate distributions** (10 continuous + 6 discrete) with PDF/PMF, CDF,
21
+ quantiles, sampling, and full statistics — in the web app and the API.
22
+ - **Advanced modules** (Python API): multivariate distributions, copulas,
23
+ mixtures/GMM, distribution fitting, Monte Carlo, and statistical tests.
24
+ - **Production-ready:** 688-test suite, typed packaging (`pyproject.toml`),
25
+ `probviz` CLI, Docker/Compose, CI with coverage gate, docs + PyPI + Docker
26
+ release pipelines. See [`CHANGELOG.md`](CHANGELOG.md).
27
+
28
+ ## Gallery
29
+
30
+ <p align="center">
31
+ <img src="docs/assets/normal_sigma_morph.gif" width="250" alt="Normal PDF morphing with sigma">
32
+ <img src="docs/assets/clt_convergence.gif" width="250" alt="Central Limit Theorem convergence">
33
+ <img src="docs/assets/copula_dependence.gif" width="210" alt="Gaussian copula dependence sweep">
34
+ <br>
35
+ <img src="docs/assets/beta_shape_morph.gif" width="250" alt="Beta PDF shape morph">
36
+ <img src="docs/assets/mixture_separation.gif" width="250" alt="Gaussian mixture separation">
37
+ </p>
38
+
39
+ *Top: Normal σ sweep · CLT convergence · Gaussian-copula ρ sweep. Bottom: Beta shape sweep · mixture separation. Regenerate with `python examples/generate_media.py`.*
40
+
41
+ ## Quick start
42
+
43
+ ```bash
44
+ pip install probviz
45
+ probviz app
46
+ ```
47
+
48
+ Or from source:
49
+
50
+ ```bash
51
+ git clone https://github.com/sanskarpan/probviz.git
52
+ cd probviz
53
+ pip install -r requirements.txt
54
+ streamlit run web/app.py
55
+ ```
56
+
57
+ Open `http://localhost:8501`. Full guide: [`QUICKSTART.md`](QUICKSTART.md) ·
58
+ [docs quickstart](https://sanskarpan.github.io/probviz/quickstart/).
59
+
60
+ ### Install as a package
61
+
62
+ ```bash
63
+ pip install -e .
64
+ probviz app # launch the UI
65
+ probviz test # run tests
66
+ probviz version # print version
67
+ ```
68
+
69
+ ### Docker
70
+
71
+ ```bash
72
+ docker build -t probviz .
73
+ docker run -p 8501:8501 probviz
74
+ # or
75
+ docker compose up --build
76
+ ```
77
+
78
+ ## What's inside
79
+
80
+ | Area | Contents |
81
+ |---|---|
82
+ | Univariate | Normal, Exponential, Uniform, Beta, Gamma, Chi-Square, Student-t, Weibull, Lognormal, Cauchy · Binomial, Poisson, Geometric, Negative Binomial, Hypergeometric, Discrete Uniform |
83
+ | Multivariate | Multivariate Normal, Dirichlet, Multivariate Student-t, Wishart |
84
+ | Copulas | Gaussian, Clayton, Gumbel, Student-t + `fit_copula_to_data` |
85
+ | Mixtures | `MixtureDistribution` (1-D EM), `GaussianMixtureModel`, `BayesianGMM`, BIC selection |
86
+ | Fitting | `DistributionFitter`, `BayesianEstimator`, `GoodnessOfFit` |
87
+ | Monte Carlo | `MonteCarloSimulator`, `VarianceReduction`, `QuasiMonteCarloSimulator` |
88
+ | Tests | hypothesis / nonparametric / descriptive dict-returning helpers |
89
+ | Utils | validation, preprocessing, plotting, structured logging; `src.visualizers` facade |
90
+
91
+ Project layout and conventions: [`docs/architecture.md`](docs/architecture.md).
92
+ API reference: [`docs/api.md`](docs/api.md) (rendered on the docs site).
93
+
94
+ ## Python API
95
+
96
+ ```python
97
+ import numpy as np
98
+ from src.distributions import NormalDistribution, BinomialDistribution
99
+
100
+ normal = NormalDistribution(mu=0, sigma=1)
101
+ x = np.linspace(-4, 4, 200)
102
+ pdf, cdf = normal.pdf(x), normal.cdf(x)
103
+ samples = normal.rvs(size=1000, random_state=42)
104
+ print(normal.get_statistics())
105
+ print(normal.interval(0.95), normal.ppf(0.975))
106
+
107
+ binomial = BinomialDistribution(n=10, p=0.3)
108
+ print(binomial.pdf(np.arange(0, 11)))
109
+ ```
110
+
111
+ ```python
112
+ from src.fitting import DistributionFitter
113
+ from src.monte_carlo import MonteCarloSimulator
114
+
115
+ fitter = DistributionFitter(samples)
116
+ print(fitter.fit_all())
117
+
118
+ rng = np.random.default_rng(42)
119
+ sim = MonteCarloSimulator(random_seed=42)
120
+ res = sim.estimate_probability(lambda: rng.normal(0, 1) > 1.0, num_samples=100_000)
121
+ print(res["probability"], res["confidence_interval"])
122
+ ```
123
+
124
+ ## Known limitations (by design)
125
+
126
+ - The Streamlit app covers the **16 univariate distributions only**; advanced
127
+ modules are Python-API only.
128
+ - `Clayton`/`Gumbel` copula `pdf`/`rvs` are **bivariate-only** (explicit error otherwise).
129
+ - `StudentTCopula` has **no closed-form `cdf`/`pdf`**; use Monte Carlo via `rvs`.
130
+ - `MixtureDistribution` EM assumes **1-D** components; use the sklearn GMM wrappers
131
+ for multivariate mixtures.
132
+ - Cauchy moments are undefined — the API surfaces `nan` instead of masking it.
133
+
134
+ ## Testing
135
+
136
+ ```bash
137
+ pip install -r requirements-dev.txt
138
+ pytest tests/ -q # 688 tests
139
+ pytest tests/ -q --cov=src --cov-report=term # with coverage (gate: 80%)
140
+ flake8 src/ tests/ --count --select=E9,F63,F7,F82 --statistics
141
+ mypy --config-file=pyproject.toml src/
142
+ ```
143
+
144
+ ## Contributing
145
+
146
+ See [`CONTRIBUTING.md`](CONTRIBUTING.md) (setup, style, tests, PR checklist),
147
+ [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md), and [`SECURITY.md`](SECURITY.md).
148
+
149
+ ## License
150
+
151
+ MIT — see [`LICENSE`](LICENSE). If you use this in research or teaching:
152
+
153
+ ```bibtex
154
+ @software{probability_distribution_visualizer,
155
+ title = {Probability Distribution Visualizer},
156
+ author = {sanskarpan},
157
+ year = {2026},
158
+ url = {https://github.com/sanskarpan/probviz}
159
+ }
160
+ ```
161
+
162
+ Also see [`CITATION.cff`](CITATION.cff).
@@ -0,0 +1,47 @@
1
+ # Multivariate, Copulas & Mixtures
2
+
3
+ ## Multivariate (`src.distributions.multivariate`)
4
+
5
+ - `MultivariateNormalDistribution(mean, cov)` — full pdf/logpdf/rvs/mean/cov;
6
+ `plot_bivariate_normal(dist)` gives contour + 3-D surface for d=2.
7
+ - `DirichletDistribution(alpha)` — simplex sampling; `plot_dirichlet_simplex`
8
+ for d=3.
9
+ - `MultivariateStudentT(df, loc, shape)` — pdf via the closed-form density,
10
+ sampling via the normal/χ² representation with a local `default_rng`.
11
+ - `WishartDistribution(df, scale)` — distribution over PSD matrices with
12
+ mean/mode/pdf/logpdf/rvs.
13
+
14
+ ## Copulas (`src.distributions.copulas`)
15
+
16
+ | Copula | Status |
17
+ |---|---|
18
+ | Gaussian | cdf/pdf/rvs/kendall_tau (any dimension) |
19
+ | Clayton | cdf (any d); **pdf/rvs currently bivariate-only** |
20
+ | Gumbel | cdf (any d); **pdf/rvs currently bivariate-only** |
21
+ | Student-t | rvs/kendall_tau; **cdf/pdf intentionally not implemented** (requires multivariate-t integration — use Monte Carlo via `rvs`) |
22
+
23
+ `fit_copula_to_data(data, copula_type, method)` fits Gaussian/Clayton/Gumbel/t
24
+ from pseudo-observations. It validates Kendall's τ ranges and documents the
25
+ `t` degrees-of-freedom simplification (`df=4`).
26
+
27
+ ```python
28
+ from src.distributions import GaussianCopula
29
+ import numpy as np
30
+
31
+ cop = GaussianCopula(np.array([[1.0, 0.6], [0.6, 1.0]]))
32
+ u = cop.rvs(size=1000, random_state=42) # uniform margins with Gaussian dependence
33
+ ```
34
+
35
+ ## Mixtures (`src.distributions.mixtures`)
36
+
37
+ - `MixtureDistribution(components, weights)` — pdf/cdf/rvs/mean/var + `fit_em`
38
+ (EM for 1-D Gaussian mixtures; guards empty data, `n_components > n`, zero
39
+ responsibilities, and zero variances; convergence is checked **after** the
40
+ M-step so returned parameters are never stale).
41
+ - `GaussianMixtureModel` / `BayesianGMM` — sklearn-backed fitting, predict,
42
+ BIC/AIC, active-component counts.
43
+ - `select_optimal_components(data, max_components)` — BIC sweep.
44
+
45
+ !!! warning "Scope"
46
+ `MixtureDistribution` assumes 1-D components. Multivariate mixtures should
47
+ use `GaussianMixtureModel`/`BayesianGMM`.
@@ -0,0 +1,61 @@
1
+ # API Reference
2
+
3
+ ::: src.distributions
4
+ options:
5
+ show_root_heading: true
6
+
7
+ ::: src.distributions.continuous
8
+ options:
9
+ show_root_heading: true
10
+
11
+ ::: src.distributions.discrete
12
+ options:
13
+ show_root_heading: true
14
+
15
+ ::: src.distributions.multivariate
16
+ options:
17
+ show_root_heading: true
18
+
19
+ ::: src.distributions.copulas
20
+ options:
21
+ show_root_heading: true
22
+
23
+ ::: src.distributions.mixtures
24
+ options:
25
+ show_root_heading: true
26
+
27
+ ::: src.fitting.distribution_fitter
28
+ options:
29
+ show_root_heading: true
30
+
31
+ ::: src.monte_carlo.simulator
32
+ options:
33
+ show_root_heading: true
34
+
35
+ ::: src.statistical_tests
36
+ options:
37
+ show_root_heading: true
38
+
39
+ ::: src.utils.validation
40
+ options:
41
+ show_root_heading: true
42
+
43
+ ::: src.utils.data_preprocessing
44
+ options:
45
+ show_root_heading: true
46
+
47
+ ::: src.utils.plotting
48
+ options:
49
+ show_root_heading: true
50
+
51
+ ::: src.utils.logger
52
+ options:
53
+ show_root_heading: true
54
+
55
+ ::: src.visualizers
56
+ options:
57
+ show_root_heading: true
58
+
59
+ ::: src.cli
60
+ options:
61
+ show_root_heading: true