Skip to main content

A Binomial and Gaussian Distribution Package

Project description

This package provides methods for Gaussian distribution and Binomial distribution classes.

Gaussian

This package contains Gaussian distribution class for calculating and visualizing a Gaussian distribution. Attributes: mean (float) - representing the mean value of the distribution. stdev (float) - representing the standard deviation of the distribution. data_list (list of floats) - a list of floats extracted from the data file.

Methods:

calculate_mean() - Function to calculate the mean of the data set. calculate_stdev() - Function to calculate the standard deviation of the data set. plot_histogram() - Function to output a histogram of the instance variable data using matplotlib pyplot library. read_data_file(filename) - Function to read in data from a txt file. The txt file should have one number (float) per line. The numbers are stored in the data attribute. pdf(x) - Probability density function calculator for the gaussian distribution . Args: x (float): point for calculating the probability density function Returns: float: probability density function output plot_histogram_pdf(n_spaces = 50) - Function to plot the normalized histogram of the data and a plot of the probability density function along the same range Args: n_spaces (int): number of data points Returns: list: x values for the pdf plot list: y values for the pdf plot add(other) - Function to add together two Gaussian distributions . Args: other (Gaussian): Gaussian instance Returns: Gaussian: Gaussian distribution repr() - Function to output the characteristics of the Gaussian instance.

Binomial

Contains Binomial distribution class for calculating and visualizing a Binomial distribution. Attributes: mean (float) representing the mean value of the distribution . stdev (float) representing the standard deviation of the distribution . data_list (list of floats) a list of floats to be extracted from the data file . p (float) representing the probability of an event occurring. n (int) number of trials

Methods:

calculate_mean() - Function to calculate the mean from p and n calculate_stdev() - Function to calculate the standard deviation from p and n. read_data_file(filename) - Function to read in data from a txt file. The txt file should have one number (float) per line. The numbers are stored in the data attribute. replace_stats_with_data() - Function to calculate p and n from the data set Args: None Returns: float: the p value float: the n value plot_bar() - Function to output a histogram of the instance variable data using matplotlib pyplot library. pdf(k) - Probability density function calculator for the gaussian distribution. Args: x (float): point for calculating the probability density function Returns: float: probability density function output plot_bar_pdf() - Function to plot the pdf of the binomial distribution Args: None Returns: list: x values for the pdf plot list: y values for the pdf plot add(other) - Function to add together two Binomial distributions with equal p Args: other (Binomial): Binomial instance Returns: Binomial: Binomial distribution repr() - Function to output the characteristics of the Binomial instance.

The code should run with no issues using Python versions >= 3.6.

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

blaze-distributions-0.2.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file blaze-distributions-0.2.tar.gz.

File metadata

  • Download URL: blaze-distributions-0.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.3

File hashes

Hashes for blaze-distributions-0.2.tar.gz
Algorithm Hash digest
SHA256 a21e8a74be94a005885015bf619b2d0fd63a1536d12cdf87901af1bd76afc8a6
MD5 7487347e7740f25f62556b56a3cc703d
BLAKE2b-256 15ce836b25df78e9c29bcf516c02f5e8675626a0efe221d8db126d0c6ed56b74

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