test_CPT_Gibbs.py 文件源码

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

项目:cptm 作者: NLeSC 项目源码 文件源码
def test_get_phi_opinion_from_memory():
    sampler2 = GibbsSampler(corpus, nTopics=3, nIter=5)
    sampler2._initialize()
    sampler2.run()

    f = sampler2.get_phi_opinion_file_name(0, 0)
    yield assert_false, os.path.isfile(f)

    phi = sampler2.get_phi_opinion()
    yield assert_equal, len(phi), sampler2.nPerspectives
    yield assert_equal, phi[0].shape, (sampler2.nTopics, sampler2.VO)

    phi = sampler2.get_phi_opinion(index=2)
    yield assert_equal, len(phi), sampler2.nPerspectives
    yield assert_equal, phi[0].shape, (sampler2.nTopics, sampler2.VO)

    phi = sampler2.get_phi_opinion(start=0, end=5)
    yield assert_equal, len(phi), sampler2.nPerspectives
    yield assert_equal, phi[0].shape, (sampler2.nTopics, sampler2.VO)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号