prior.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:enterprise 作者: nanograv 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号