Skip to main content

probplotlib

Probability Distributions for Python

GitHub

The Statistical Void

Stats can get tricky in the transition from plotting fun graphs to advanced algebraic equations. A classic example is the given sum:

1.0e14 + 1.0 - 1.0e14

The actual result is 1.0 but in double precision, this will result in 0.0. While in this example the failure is quite obvious, it can get a lot trickier than that. Instances like these hinder the community from exploring the inferential potential of complex entities.

p=Gaussian(a,b)
q=Gaussian(x,y)
p+q

This snippet would be close to useless as python addition doesn't isn't attributed for higher-level declarables such as Gaussian variables. probplotlib provides simple solutions for probability distributions; posing a highly-optimized alternative to numpy and math, in a niche that is scarce in options.

Usage

probplotlib has the following operative methods:

  • +: uses Dunder Methods for facilitating dist-additions.

  • calculate_mean(): returns the mean of a distribution.

gaussianex = Gaussian()
calculate_mean(gaussianx)
  • calculate_stdev(): returns the standard deviation of a distribution.
binomialex = Binomial()
calculate_stdev(binomialex)
  • read_dataset(): reads an external .txt dataset directly as a distribution.
gaussianex.read_dataset('values.txt')
binomialex.read_dataset('values.txt')
  • params(): retrieves the identity parameters of an imported dataset.
gaussianex.params()
binomialex.params()
  • pdf(): returns the probability density function at a given point.
pdf(gaussianex, 2)

functions unique to Gaussian Distributions:

  • plot_histogram(): uses matplotlib to display a histogram of the Gaussian Distribution.
gaussianex.plot_histogram()
  • plot_histogram_pdf(): uses matplotlib to display a co-relative plot along with the Gaussian probability density function.
gaussianex.plot_histogram_pdf()

functions unique to Binomial Distributions:

  • plot_bar(): uses matplotlib to display a bar graph of the Binomial Distribution.
binomialex.plot_bar()
  • plot_bar_pdf(): uses matplotlib to display a co-relative plot along with the Binomial probability density function.
binomialex.plot_bar_pdf()

Data Visualization

probplotlib therefore allows you to analyze raw numerical data graphically in minimial lines of code. The example below makes for better understanding.

TXT file

a bag of numbers in a .txt file corresponds to the following plots:

histogram plot:

Histogram Plot

bar plot:

Bar Plot

histogram plot with pdf:

Histogram Plot With PDF

References

Stanford Archives: CS109- The Normal(Gaussian) Distribution

A Practical Overview on Probability Distributions: Andrea Viti, Alberto Terzi, Luca Bertolaccini

Awesome Scientific Computing: Nico Schlömer, GitHub Repository

math.statistics: Python 3.10 Source Code

Stack Overflow

Dependencies

probplotlib depends on the matplotlib library on top of your regular python installation.

pip install matplotlib

or

conda install matplotlib

Installation

probplotlib is available on the Python Package Index. You can install it directly using pip.

pip install probplotlib

Testing

To run the tests, simply check to this directory and run the code below.

python -m unittest test_probplotlib

Metadata

Release files for probplotlib 1.0

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

Source distribution (sdist)

Source distribution for probplotlib 1.0
File Size Uploaded Provenance Actions
probplotlib-1.0.tar.gz 4.2 kB Without provenance Details for probplotlib-1.0.tar.gz

Built distribution (wheel)

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

Total release size: 8.3 kB

Release files / probplotlib-1.0.tar.gz

Download URL probplotlib-1.0.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8f8c734fc0fa9ae12410f90daffae9aa8cf7e3fa5de91798f3c83fa2db0f499f
BLAKE2b-256 checksum
How to use checksums
ab5f29d18e54e56db8376bcfd47f222d455bdba12b48a77ad08456c370b781f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release files / probplotlib-1.0-py3-none-any.whl

Download URL probplotlib-1.0-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fbb73b65954eef177d7160fba26a2f896922c62e1420f522783d074ad483d4db
BLAKE2b-256 checksum
How to use checksums
3dc373660937e87ac7635a4ab05a9050089a68e6d7d3ea41a72395f4cf4b658c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Security for probplotlib 1.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.

Release history Release notifications | RSS feed

This release

1.0 This release

2 release files No provenance

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