# bucky.util.distributions¶

Provide probability distributions used by the model that aren’t in numpy/cupy.

## Module Contents¶

### Functions¶

 approx_betaincinv(alp1, alp2, u) Approximate betaincinv using Kumaraswamy after converting the params so that the means and modes are equal approx_mPERT_sample(mu, a=0.0, b=1.0, gamma=4.0, var=None) Approximate sample from an mPERT distribution that uses a Kumaraswamy distribution in place of the incomplete beta; Supports Cupy. kumaraswamy_invcdf(a, b, u) Inverse CDF of the Kumaraswamy distribution mPERT_sample(mu, a=0.0, b=1.0, gamma=4.0, var=None) Provide a vectorized Modified PERT distribution. truncnorm(loc=0.0, scale=1.0, size=1, a_min=None, a_max=None) Provide a vectorized truncnorm implementation that is compatible with cupy.
bucky.util.distributions.approx_betaincinv(alp1, alp2, u)[source]

Approximate betaincinv using Kumaraswamy after converting the params so that the means and modes are equal

bucky.util.distributions.approx_mPERT_sample(mu, a=0.0, b=1.0, gamma=4.0, var=None)[source]

Approximate sample from an mPERT distribution that uses a Kumaraswamy distribution in place of the incomplete beta; Supports Cupy.

bucky.util.distributions.kumaraswamy_invcdf(a, b, u)[source]

Inverse CDF of the Kumaraswamy distribution

bucky.util.distributions.mPERT_sample(mu, a=0.0, b=1.0, gamma=4.0, var=None)[source]

Provide a vectorized Modified PERT distribution.

Parameters
Returns

out – Samples drawn from the specified mPERT distribution. Shape is the broadcasted shape of the the input parameters.

Return type

float or numpy.ndarray or cupy.ndarray if using CuPy

bucky.util.distributions.truncnorm(loc=0.0, scale=1.0, size=1, a_min=None, a_max=None)[source]

Provide a vectorized truncnorm implementation that is compatible with cupy.

The output is calculated by using the numpy/cupy random.normal() and truncted via rejection sampling. The interface is intended to mirror the scipy implementation of truncnorm.