Gaussian and Binomial Distributions

gaus-bin-dist

This package contains modules for working with Gaussian and Binomial Distributions.

Files

• gaus_bin_dist/: Distributions package
• Binomialdistribution.py: Binomial class
• Gaussiandistribution.py: Gaussian class
• Generaldistribution.py: Distribution class
• __init__.py: Initialization script
• license.txt: MIT license
• numbers.txt: Test file for Gaussian class
• numbers_binomial.txt: Test file for Binomial class
• setup.cfg: Configuration file for code packaging
• setup.py: Script for code packaging
• test.py: Unit tests

Installation

pip install gaus-bin-dist

Python Interpreter Example

Initialization

>>> from gaus_bin_dist import Gaussian, Binomial
>>> Gaussian(10, 7)
mean 10, standard deviation 7
>>> Binomial(0.4, 25)
mean 10.0, standard deviation 2.449489742783178, p 0.4, n 25


>>> gaussian_one = Gaussian(25, 3)
>>> gaussian_two = Gaussian(30, 4)
>>> gaussian_one + gaussian_two
mean 55, standard deviation 5.0
>>> binomial_one = Binomial(0.4, 20)
>>> binomial_two = Binomial(0.4, 60)
>>> binomial_one + binomial_two
mean 32.0, standard deviation 4.381780460041329, p 0.4, n 80


Probability Density Function

>>> gaussian_one.pdf(25)  # gaussian_one PDF at x = 25
0.1329807601338109
>>> binomial_one.pdf(5)  # binomial_one PDF at x = 5
0.07464701952887093


Gaussian Visualizations

>>> gaussian = Gaussian()
>>> gaussian.replace_stats_with_data()  # returns (mean, stdev)
(78.0909090909091, 92.87459776004906)
>>> gaussian.plot_histogram()


>>> gaussian.plot_histogram_pdf()


Binomial Visualizations

>>> binomial = Binomial()
>>> binomial.replace_stats_with_data()  # returns (p, n)
(0.6153846153846154, 13)
>>> binomial.plot_histogram()


>>> binomial.plot_pdf()


Project details

Source Distribution

gaus_bin_dist-2.1.tar.gz (4.3 kB view hashes)

Uploaded Source