Skip to main content

Gaussian and binomial distributions

Project description

distributions_gb001

distributions_gb001 is a Python package for calculating and visualizing a Gaussian distribution and binomial distribution.

Description

What you can do with the package: for Gaussian distribution and binomial distribution

-   calculate mean and standard deviation.
-   calculate Probability density function
-   plot and visualize the normalized histogram of the data and a plot of the 
	probability density function along the same range or bar probability density function of a binomial distribution
-   add together two Gaussian or Binomial distributions

Installation

Use the package manager pip to install distributions_gb001.

pip install distributions_gb001

Dependency

  • matplotlib (to visualize plotted histogram/bar)
pip install matplotlib

Usage

import distributions_gb001

**- without data file**

gaussian_one = distributions_gb001.Gaussian(22, 3)
binomial_one = distributions_gb001.Binomial(.9, 20)
gaussian_one.mean # returns 22
binomial_one.stdev # returns 1.3416407864998736
gaussian_one + gaussian_one # returns 'mean 44, standard deviation 4.242640687119285'

**- with data file**

gaussian_two = distributions_gb001.Gaussian()
gaussian_two.read_data_file("/home/myname/Desktop/numbers.txt")  # read in data from a txt file

gaussian_two.calculate_mean() # calculate mean
gaussian_two.mean # returns mean value

gaussian_two.calculate_stdev(sample=True)    # calculate standard deviation ...... 
"""note -sample (bool): whether the data represents a sample or population which is set to True as default""" 
gaussian_two.stdev # returns standard deviation value

gaussian_two.pdf(x) # returns Probability density function output
"""x (float): point for calculating the probability density function"""

gaussian_two.plot_histogram_pdf(n_spaces = 50) # visualize normalized histogram with your set spaces
"""n_spaces (int): number of data points which is set to 50 as default"""



binomial_two = distributions_gb001.Binomial()
binomial_two.read_data_file("/home/myname/Desktop/numbers_bin.txt") # read in data from a txt file

binomial_two.calculate_mean() # calculate mean
binomial_two.mean # returns mean value

binomial_two.calculate_stdev()    # calculate standard deviation ...... 
binomial_two.stdev # returns standard deviation value

binomial_two.replace_stats_with_data() # to get new mean and standard deviation from the data set
""" by default --- mean = 10.0
                   standard deviation = 2.23606797749979"""
binomial_two.mean # returns new mean value
binomial_two.stdev # returns new standard deviation value

binomial_two.pdf(k) # returns Probability density function output
"""k (integer): point for calculating the probability density function"""

binomial_two.plot_bar_pdf() # visualize normalized histogram with your set spaces
"""n_spaces (int): number of data points which is set to 50 as default"""


""""Note : make sure "matplotlib" is installed" to visualize""" 
""""Note : to provide GUI backend to show figures, make sure python Tkinter is installed - for linux/ubuntu --- sudo apt install python3-tk""" 

Author

Abeeb Ridwan Olumide

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

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

Source Distribution

distributions_gb001-1.0.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file distributions_gb001-1.0.tar.gz.

File metadata

  • Download URL: distributions_gb001-1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9

File hashes

Hashes for distributions_gb001-1.0.tar.gz
Algorithm Hash digest
SHA256 c0a4a3c0d245e4fb344c37679ef2e6691a0a2b8d83119b6517ea1287e8579ffc
MD5 954e178c476921a8b859ea169ad541c0
BLAKE2b-256 d3bd56956f6678c974b0c9850438ac8953ccd0ba6d89d2f8a5ab0e3226222932

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