def GaussianBoundedRV(loc=0., scale=1., lower=0., upper=1.):
r"""A Gaussian prior between two finite bounds.
This is a convenience function with more natural bound parameters
than ``scipy.stats.truncnorm``.
:param loc: location parameter, mean of distribution
:type loc: float
:param scale: standard deviation of distribution
:type scale: float
:param lower: lower bound of parameter range
:type lower: float
:param upper: upper bound of parameter range
:type upper: float
:return: a frozen rv_continuous instance with normalized Gaussian
probability truncated to the range [lower, upper] and 0 outside
"""
low, up = (lower - loc) / scale, (upper - loc) / scale
nn = scipy.stats.truncnorm(loc=loc, scale=scale, a=low, b=up)
return nn
评论列表
文章目录