Skip to main content

Gaussian and Binomial distributions

Project description

Gaussian and Binomial Distributions

This package contains code to perform basic mathematical operations on Gaussian and Binomial distributions. Operations include finding the mean and standard deviation (of both sample and population), plotting histograms for Gaussian distribution and plotting frequncy bar charts for Binomial distributions.

Dummy input data

For Gaussian distribution, you can test the package using the following dummy input data.

1
3
99
100
120
32
330
23
76
44
31

Here's some dummy data for a Binomial distribution. It contains the outcomes of 13 trials. A '0' denotes failure and a '1' denotes success.

0
1
1
1
1
1
0
1
0
1
0
1
0

Test the code

Copy the following code snippet in a .py file and execute it.

from dg_probability import Gaussian

gaussian = Gaussian(10,5)
print(f"Gaussian mean = {gaussian.mean}")
print(f"Gaussian standard deviation = {gaussian.stdev}")

This snippet is for the Binomial module.

from dg_probability import Binomial

binomial = Binomial(0.25,60)
print(f"Binomian mean = {binomial.mean}")
print(f"Binomian standard deviation = {binomial.stdev}")

Test the entire Binomial distribution module

Here's how you can test the entire Binomial distribution module using the dummy data shown in the 'Input data' section. Create a file called data_binomial.txt and add the dummy data for Binomial distribution to it. Save this file in the same directory where your code is.

# ignore if module is already imported
from dg_probability import Binomial

binomial = Binomial()
binomial.read_data_file('data_binomial.txt')
binomial.calculate_mean()
binomial.calculate_stdev()
binomial.replace_stats_with_data()
binomial.plot_bar()
binomial.plot_bar_pdf()

The methods for Gaussian distribution are similar.

Contributions

There is not CONTRIBUTIONS.md file yet but you are welcome to create PRs :)

Source code

https://github.com/dg1223/object-oriented-programming/tree/main/upload_to_pypi

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

dg_probability-1.0.tar.gz (5.9 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: dg_probability-1.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.5

File hashes

Hashes for dg_probability-1.0.tar.gz
Algorithm Hash digest
SHA256 58ce9a7a9fe9bc2e108ccf8efffa1b3547b9fb63b49b65cd73252446110eb6bb
MD5 68db1200f95d8df43738584524c0f45e
BLAKE2b-256 05c17b251b5d2a260ed35b33ee9c295ef72ca1022f6b46411248947320329252

See more details on using hashes here.

Supported by

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