SuffStatBag.py 文件源码

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

项目:bnpy 作者: bnpy 项目源码 文件源码
def replaceCompWithExpansion(self, uid=0, xSS=None,
                                 keysToSetNonExtraZero=['sumLogPiRemVec']):
        ''' Replace existing component with expanded set of statistics.

        Post Condition
        --------------
        Values associated with uid are removed.
        All entries of provided xSS are added last in index order.
        '''
        if not np.intersect1d(xSS.uids, self.uids).size == 0:
            raise ValueError("Cannot expand with same uids.")

        for key in self._Fields._FieldDims:
            if key in keysToSetNonExtraZero:
                arr = getattr(self._Fields, key)
                arr.fill(0)

        if hasattr(xSS, 'mUIDPairs'):
            assert not self.hasMergeTerms()
            self.setMergeUIDPairs(xSS.mUIDPairs)
        self.insertComps(xSS)
        self.removeComp(uid=uid)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号