Functions

Automatically generated list of the functions of beanPy using autodoc

This is the main and only current module for beanPy

class beanPy.Distribution

Bases: object

Generic class that all distributions will inherit from

draw_CDF(n=50, safe=False)

Draws the CDF graph. It does this by systematically going from 0 - 1 then using that number as the y-axis, plots points for continuous functions. For discrete functions, it will plot n + 1 points and stop the graph there. The default n is 50, as this ensures a smooth CDF graph for the continuous functions.

The ‘safe’ parameter rounds everything in piecewise discrete distributions (such as the uniform discrete distribution) to 6 dp when calculating the x values, and checks the x value rounded to 5 dp against the step rounded to 5 dp. This is to be absolutely safe from floating point errors and will rarely be used. Because of the nature of the ‘safe’ parameter, if it is set to true, the function will not be as good at handling numbers where decimal places after the 5th are significant to the distribution.

draw_PDF(n=50, safe=False)

Draws the PDF graph. This takes about twice as long as the CDF graph. It does the systematic approach from the CDF, then converts that into an X value, then finds the PDF. The default here is 50, as it’s a good number for this because it ensures a smooth graph for continuous functions. The ‘n’ input means the same thing as for the CDF

The ‘safe’ parameter here is the same as in the draw_CDF function

take_multiple_samples(num, seed=None)

Takes a sample of given size and optional seed.

take_sample(seed=None)

Takes a single sample from a population which follows the given distribution. The sample follows a given seed. If no seed is given, it will generate a random seed

class beanPy.binomial_distribution(n, p)

Bases: Distribution

Gives the distribution all the common information. You can call any of these, apart from x of course. Calling these attributes gives the value or a formula, depending on which you call

find_CDF(x, safe=False)

Finds the distributions cumulative density at a given value of x

find_PDF(x, safe=False)

Finds the distributions probability density at a given value of x

find_quantile(x)

Finds the distributions quantile at a given value x

class beanPy.continuous_uniform_distribution(a, b)

Bases: Distribution

find_CDF(x)

Finds the distributions cumulative density at a given value of x

find_PDF(x)

Finds the distributions probability density at a given value of x

find_quantile(p)

Finds the distributions quantile at a given value x

class beanPy.discrete_uniform_distribution(min, max, step=1)

Bases: Distribution

find_CDF(x, safe=False)

Finds the distributions cumulative density at a given value of x

find_PDF(x, safe=False)

Finds the distributions probability density at a given value of x

find_quantile(p)

Finds the distributions quantile at a given value x

class beanPy.exponential_distribution(l)

Bases: Distribution

find_CDF(x)

Finds the distributions cumulative density function at a given value of x

find_PDF(x)

Finds the distributions probability density function at a given value of x

find_quantile(p)

Finds the distributions quantile at a given value x

quantile

These functions (find_PDF and find_quantile) are technically not needed, as we can just use sympy.subs on the pdf and cdf, however the use of these functions causes the graphs to appear a lot quicker.

class beanPy.normal_distribution(mean, var)

Bases: Distribution

find_CDF(x)

Finds the distributions cumulative density function at a given value of x

find_PDF(x)

Finds the distributions probability density function at a given value of x

find_quantile(p)

Finds the distributions quantile at a given value x

class beanPy.poisson_distribution(l)

Bases: Distribution

find_CDF(x)

Finds the distributions cumulative density at a given value of x

find_PDF(x)

Finds the distributions probability density at a given value of x

find_quantile(p)

Finds the distributions quantile at a given value x