Skip to main content

Gaussian distributions

Project description

This python package consists of various types of distributions and functions for obtaining some statistical calculations like mean, standard deviation, probability density function for each type of distribution and some methods to visualize the distribution into histograms. The package is divided into different modules where each module consists of classes and methods specified for a specific type of distribution. The list of modules are as follows:

  1. General distribution
  2. Gaussian distribution
  3. Binomial distribution General distribution module: This module consists of a general distribution class with some attributes and methods. This class is created to calculate and visualize a probability distribution. This class takes mean (mu_mean) and variance (sigma) of the distribution as arguments. The attributes of this class are: mean: this is a float value and represents the mean value of the distribution. stdev: this is a float value and represents the standard deviation of the distribution. data_list: this is a list of float values extracted from the given data file. This class also contains a method (read_data_file) to read data from a .txt file. The argument of this function is the file name we have. The text file should have one number per line and these numbers are stored in data attribute of the general distribution class. Gaussian distribution module: This module imports the general distribution class from the general distribution module. It contains a gaussian distribution class for calculating and visualizing gaussian distribution which is inherited from the general distribution class. The initializing function of this class is same as general distribution class. The methods present in this class are: • Initializing method: same as general distribution init method • Method for calculating mean of the gaussian distribution which takes gaussian instance as argument and returns a float value. • A function to calculate the standard deviation of the data set, takes a bool value (sample) returns a float value. • Function to output a histogram (plot_histogram) of the instance variable data using matplotlib pyplot library. It takes no args and returns none. • A probability density function calculating method for the gaussian distribution (pdf) which takes a float attribute x- point for calculating the probability density function and returns a float value of the pdf output. • Function to plot the normalized histogram of the data and a plot of the probability density function along the same range (plot_histogram_pdf). It takes number of data points (n_spaces) as argument and returns a list of x as well as Y values for the pdf plot. • add: Function to add two gaussian distributions. It takes gaussian instance as argument and returns a gaussian distribution. • repr: Function to output the characteristics of the gaussian instance. Takes no arguments and returns a string: characteristics of the gaussian distribution. Binomial Distribution module: This module imports the distribution class from the general distribution module. It contains a binomial distribution class for calculating and visualizing binomial distribution which is extended from the general distribution class. Attributes of binomial distribution class: This class contains same attributes as that of the general distribution class and adding to it: P: a float value representing the probability of an event occurring. n: an int value representing the number of trails. The methods of this class are: • init: an initialization method for the class which takes probability and no. of trails as arguments and class init method of the general distribution class. • Calculate_mean: Method for calculating mean of the binomial distribution which returns a float value of mean of the binomial instance. • Calculate_stdev: a function to calculate standard deviation from the values of p and n. It returns a float value of the standard deviation of the binomial instance taken. • Replace_stats_with_data: This is a method to calculate the values of p and n from the dataset. It returns float values of p and n of the given binomial distribution instance. • Plot_bar: function to output the histogram of instance variable data using matplotlib pyplot library. It has no arguments and returns none. • Pdf: Probability density function calculator for the binomial distribution. It has a point for calculating the pdf as argument (float) and returns a float value of the pdf. • Plot_bar_pdf: Function to plot the pdf of the binomial distribution. It returns a list of float values of x and y for the pdf plot of the given binomial distribution. • add: function to add two binomial distributions with same p value. It takes other binomial instance as argument and returns the combined binomial distribution. • repr: This is a function to output the characteristics of the binomial instance. It has no arguments and returns the characteristics of the binomial distribution as a string. The inti.py: This is the initialization file for the package and each module containing the version information and metadata of the created python package.

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

practice_distribution_msrk-1.2.tar.gz (2.8 kB view details)

Uploaded Source

File details

Details for the file practice_distribution_msrk-1.2.tar.gz.

File metadata

File hashes

Hashes for practice_distribution_msrk-1.2.tar.gz
Algorithm Hash digest
SHA256 418b074494ace8c7c38e66a8fd4f90deadac68b76d938b9929ce0dc4b2cae370
MD5 c282d0b2eec3d65ac28a7b9df743eada
BLAKE2b-256 d6225afc731e117ccd50c16ac2d1847bc7cfc2a6598b84e41f5228aa7fc232c9

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