bucky.util.distributions
#
Provide probability distributions used by the model that aren’t in numpy/cupy.
Module Contents#
Functions#
|
Approximate betaincinv using Kumaraswamy after converting the params s.t. means and modes are equal. |
|
Approximate sample from an mPERT distribution that uses a Kumaraswamy distrib in place of the incbeta. |
|
Inverse CDF of the Kumaraswamy distribution. |
|
Provide a vectorized Modified PERT distribution. |
|
Provide a vectorized truncnorm implementation that is compatible with cupy. |
|
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:
mu (
float
ornumpy.ndarray
orcupy.ndarray
if using CuPy) – Mean value for the PERT distribution.a (
float
ornumpy.ndarray
orcupy.ndarray
if using CuPy) – Lower bound for the distribution.b (
float
ornumpy.ndarray
orcupy.ndarray
if using CuPy) – Upper bound for the distribution.gamma (
float
ornumpy.ndarray
orcupy.ndarray
if using CuPy) – Shape paramter.var (
float
,numpy.ndarray
orcupy.ndarray
if using CuPy orNone
) – Variance of the distribution. If var != None, gamma will be calcuated to meet the desired variance.
- Returns:
out – Samples drawn from the specified mPERT distribution. Shape is the broadcasted shape of the the input parameters.
- Return type:
float
ornumpy.ndarray
orcupy.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
orcupy.ndarray
if using CuPy