distributions.py 文件源码

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

项目:aboleth 作者: data61 项目源码 文件源码
def norm_posterior(dim, std0):
    """Initialise a posterior (diagonal) Normal distribution.

    Parameters
    ----------
    dim : tuple or list
        the dimension of this distribution.
    std0 : float
        the initial (unoptimized) standard deviation of this distribution.

    Returns
    -------
    Q : tf.distributions.Normal
        the initialised posterior Normal object.

    Note
    ----
    This will make tf.Variables on the randomly initialised mean and standard
    deviation of the posterior. The initialisation of the mean is from a Normal
    with zero mean, and ``std0`` standard deviation, and the initialisation of
    the standard deviation is from a gamma distribution with an alpha of
    ``std0`` and a beta of 1.

    """
    mu_0 = tf.random_normal(dim, stddev=std0, seed=next(seedgen))
    mu = tf.Variable(mu_0, name="W_mu_q")

    std_0 = tf.random_gamma(alpha=std0, shape=dim, seed=next(seedgen))
    std = pos(tf.Variable(std_0, name="W_std_q"))

    Q = tf.distributions.Normal(loc=mu, scale=std)
    return Q
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号