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.

generic_distribution(base_func, params: dict, interp: partial, clip: partial)

Return value sampled from basic distribution, with additional interpolation and clipping.

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=None, a_min=None, a_max=None)

Provide a vectorized truncnorm implementation that is compatible with cupy.

truncnorm_from_CI(CI, size=1, a_min=None, a_max=None)

Truncnorm implementation that first derives mean and standard deviation from a 95% confidence interval.

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.generic_distribution(base_func, params: dict, interp: partial, clip: partial)[source]

Return value sampled from basic distribution, with additional interpolation and clipping.

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=None, 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.

bucky.util.distributions.truncnorm_from_CI(CI, size=1, a_min=None, a_max=None)[source]

Truncnorm implementation that first derives mean and standard deviation from a 95% confidence interval.