Skip to main content

Gaussian & Binomial distributions

Project description

lb-dsnd-distributions package


This package provides the Gaussian distribution and Binomial distribution classes.

  • Gaussian - 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 - 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.
    

Files

  • Generaldistribution.py - contains Distribution class, its attributes and methods being inherited by Gaussian and Binomial class.
  • Gaussiandistribution.py - contains Gaussian class, its attributes and methods stated above in lb-dsnd-distributions package summary.
  • Binomialdistribution.py - contains Binomial class, its attributes and methods stated above in lb-dsnd-distributions package summary.

Installation

  • The code should run with no issues using Python versions 3.*.
  • No extra besides the built-in libraries from Anaconda needed to run this project Math matplotlib

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

lb_dsnd_distributions-0.0.3.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lb_dsnd_distributions-0.0.3-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file lb_dsnd_distributions-0.0.3.tar.gz.

File metadata

  • Download URL: lb_dsnd_distributions-0.0.3.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for lb_dsnd_distributions-0.0.3.tar.gz
Algorithm Hash digest
SHA256 981df0b02de8ab8cfab208a9a673410748f34d21860a975b668cd572992af130
MD5 4d796a7232f3da08e2e99b1ee4a5bb36
BLAKE2b-256 d3745bacb95a57788b2d2c034730ae598b021102a4d4d6f02610cf4427fc3bc0

See more details on using hashes here.

File details

Details for the file lb_dsnd_distributions-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: lb_dsnd_distributions-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for lb_dsnd_distributions-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 07ff8b0fe472ad539319c0a1d0b4a883a6d5a21b93c26d125566eb33bde627ee
MD5 fa14f2acf8efa42e11c3c64898ad52ce
BLAKE2b-256 9552336e70e2bfc7a3f9253accf7ff927d21ce43ccf968d760828d33b03db320

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