gauss.py 文件源码

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

项目:elfi 作者: elfi-dev 项目源码 文件源码
def gauss(mu, sigma, n_obs=50, batch_size=1, random_state=None):
    """Sample the 1-D Gaussian distribution.

    Parameters
    ----------
    mu : float, array_like
    sigma : float, array_like
    n_obs : int, optional
    batch_size : int, optional
    random_state : np.random.RandomState, optional

    Returns
    -------
    array_like
        1-D observations.

    """
    # Transforming the arrays' shape to be compatible with batching.
    batches_mu = np.asanyarray(mu).reshape((-1, 1))
    batches_sigma = np.asanyarray(sigma).reshape((-1, 1))

    # Sampling observations.
    y_obs = ss.norm.rvs(loc=batches_mu, scale=batches_sigma,
                        size=(batch_size, n_obs), random_state=random_state)
    return y_obs
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号