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 s.t. means and modes are equal.

approx_mPERT(mu, a=0.0, b=1.0, gamma=4.0)

Approximate sample from an mPERT distribution that uses a Kumaraswamy distrib in place of the incbeta.

kumaraswamy_invcdf(a, b, u)

Inverse CDF of the Kumaraswamy distribution.

mPERT(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 s.t. means and modes are equal.

bucky.util.distributions.approx_mPERT(mu, a=0.0, b=1.0, gamma=4.0)[source]#

Approximate sample from an mPERT distribution that uses a Kumaraswamy distrib in place of the incbeta.

Notes

Supports Cupy.

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

Inverse CDF of the Kumaraswamy distribution.

bucky.util.distributions.mPERT(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.

Parameters:
  • loc

  • scale

  • size

  • a_min

  • a_max

Return type:

numpy.ndarray or cupy.ndarray if using CuPy

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.