estimator.py 文件源码

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

项目:CNValloc 作者: m1m0r1 项目源码 文件源码
def as_dict(self):
        """ Returns json encodable dictionary
        """
        haps = [[self._data.alphabets[np.argmax(site_beta)] for site_beta in beta_sites.transpose()] for beta_sites in self.log_beta]
        hap_probs = [[[np.exp(np.max(site_beta) - logsumexp(site_beta)) for site_beta in beta_sites.transpose()] for beta_sites in self.log_beta]]

        return {
            'nsites': self._data.nsites,
            'sample_ids': self._data.sample_ids,
            'nhaps': self.nhaps,
            'alphabets': list(self._data.alphabets),
            'step': self.step,
            'log_likelihood': self.ll,
            'alpha': list(map(float, self.alpha)),
            'log_beta': [[list(map(float, site_beta)) for site_beta in beta_sites.transpose()] for beta_sites in self.log_beta],
            'haps': haps,
            'hap_probs': hap_probs,
            'gamma': list(map(float, vec) for vec in self.gamma),
        }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号