nifty8.re.num.stats_distributions module#
- interpolator(func: Callable, xmin: float, xmax: float, *, step: float | None = None, num: int | None = None, table_func: Callable | None = None, inv_table_func: Callable | None = None, return_inverse: bool | None = False)[source]#
Evaluate a function point-wise by interpolation. Can be supplied with a table_func to increase the interpolation accuracy, Best results are achieved when lambda x: table_func(func(x)) is roughly linear.
- Parameters:
func (function) – Function to interpolate.
xmin (float) – The smallest value for which func will be evaluated.
xmax (float) – The largest value for which func will be evaluated.
step (float) – Distance between sampling points for linear interpolation. Either of step or num must be specified.
num (int) – The number of interpolation points. Either of step of num must be specified.
table_func (function) – Non-linear function applied to the tabulated function in order to transform the table to a more linear space.
inv_table_func (function) – Inverse of table_func.
return_inverse (bool) – Whether to also return the interpolation of the inverse of func. Only sensible if func is invertible.
- invgamma_invprior(a, scale, loc=0.0, step=0.01) Callable [source]#
Get the inverse transformation to invgamma_prior.
- invgamma_prior(a, scale, loc=0.0, step=0.01) Callable [source]#
Transform a standard normal into an inverse gamma distribution.
The pdf of the inverse gamma distribution is defined as follows using to denote the scale:
That means that for large x the pdf falls off like . The mean of the pdf is at if . The mode is .
This transformation is implemented as a linear interpolation which maps a Gaussian onto an inverse gamma distribution.
- Parameters:
a (float) – The shape-parameter of the inverse-gamma distribution.
scale (float) – The scale-parameter of the inverse-gamma distribution.
loc (float) – An option shift of the whole distribution.
step (float) – Distance between sampling points for linear interpolation.
- laplace_prior(alpha) Partial [source]#
Takes random normal samples and outputs samples distributed according to
- lognormal_invprior(mean, std, *, _log_mean=None, _log_std=None) Partial [source]#
Get the inverse transform to lognormal_prior.
- lognormal_moments(mean, std)[source]#
Compute the cumulants a log-normal process would need to comply with the provided mean and standard-deviation std
- lognormal_prior(mean, std, *, _log_mean=None, _log_std=None) Partial [source]#
Moment-match standard normally distributed random variables to log-space
Takes random normal samples and outputs samples distributed according to
such that the mean and standard deviation of the distribution matches the specified values.