Skip to main content

Gaussian and Binomial Distributions

Project description

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

Download on PyPi or use following command:

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

Addition

>>> 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.read_data_file('numbers.txt')
>>> gaussian.replace_stats_with_data()  # returns (mean, stdev)
(78.0909090909091, 92.87459776004906)
>>> gaussian.plot_histogram()

Gaussian Histogram

>>> gaussian.plot_histogram_pdf()

Gaussian Histogram PDF

Binomial Visualizations

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

Binomial Histogram

>>> binomial.plot_pdf()

Binomial PDF

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

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

Uploaded Source

File details

Details for the file gaus_bin_dist-2.1.tar.gz.

File metadata

  • Download URL: gaus_bin_dist-2.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using 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.7.6

File hashes

Hashes for gaus_bin_dist-2.1.tar.gz
Algorithm Hash digest
SHA256 6978540afda7eef2afc99778dfc47f9b1dba0ee85e43b61c3846655c743e5cb6
MD5 affe7dd66299f526617f43ba43bb6d81
BLAKE2b-256 9d2077a263e6f73b338efa3d95f31447b1c55a451639a096b501d4c4a475d6f6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page