ops.py 文件源码

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

项目:mimicry.ai 作者: fizerkhan 项目源码 文件源码
def GMM_sample(mus, sigmas, mix_weights):
    """
    First, sample according to the prior mixing probabilities
    to choose the component density.
    Second, draw sample from that density

    Inspired by implementation in `cle`
    """
    chosen_component = \
        T.argmax(
            srng.multinomial(pvals=mix_weights),
            axis=1)
    selected_mus = mus[T.arange(mus.shape[0]), :, chosen_component]
    selected_sigmas = sigmas[T.arange(sigmas.shape[0]), :, chosen_component]
    sample = srng.normal(size=selected_mus.shape,
                                avg=0.,
                                std=1.)
    sample *= selected_sigmas
    sample += selected_mus
    return sample, selected_mus, selected_sigmas, chosen_component
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号