ipf.py 文件源码

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

项目:AequilibraE 作者: AequilibraE 项目源码 文件源码
def factor(self, marginals, targets):
        f = np.divide(targets, marginals)  # We compute the factors
        f[f == np.NINF] = 1  # And treat the errors, with the infinites first
        f = f + 1  # and the NaN second
        f = np.nan_to_num(f)  # The sequence of operations is just a resort to
        f[f == 0] = 2  # use at most numpy functions as possible instead of pure Python
        f = f - 1
        return f
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号