SpeakerDiar.py 文件源码

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

项目:bnpy 作者: bnpy 项目源码 文件源码
def plotBlackWhiteStateSeqForMeeting(meetingNum=1, badUIDs=[-1, -2],
                                     **kwargs):
    ''' Make plot like in Fig. 3 of AOAS paper
    '''
    from matplotlib import pylab

    Data = get_data(meetingNum=args.meetingNum)
    Z = np.asarray(Data.TrueParams['Z'], dtype=np.int32)

    uLabels = np.unique(Z)
    uLabels = np.asarray([u for u in uLabels if u not in badUIDs])
    sizes = np.asarray([np.sum(Z == u) for u in uLabels])
    sortIDs = np.argsort(-1 * sizes)
    Zim = np.zeros((10, Z.size))
    for rankID, uID in enumerate(uLabels[sortIDs]):
        Zim[1 + rankID, Z == uID] = 1
        size = sizes[sortIDs[rankID]]
        frac = size / float(Z.size)
        print 'state %3d: %5d tsteps (%.3f)' % (rankID + 1, size, frac)

    for uID in badUIDs:
        size = np.sum(Z == uID)
        frac = size / float(Z.size)
        print 'state %3d: %5d tsteps (%.3f)' % (uID, size, frac)

    pylab.imshow(1 - Zim,
                 interpolation='nearest',
                 aspect=Zim.shape[1] / float(Zim.shape[0]) / 3,
                 cmap='bone',
                 vmin=0,
                 vmax=1,
                 origin='lower')
    pylab.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号