window_weights.py 文件源码

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

项目:pytomo3d 作者: computational-seismology 项目源码 文件源码
def _category_validator(weights, wcounts):
    """
    Validate the category weights

    :param weights:
    :param counts:
    :return:
    """
    wsum = 0.0
    nwins_total = 0
    for p, pinfo in weights.iteritems():
        for c in pinfo:
            wsum += weights[p][c] * wcounts[p][c]
            nwins_total += wcounts[p][c]

    print("Summation of (cat_weight * cat_nwins): %.2f" % wsum)
    if not np.isclose(wsum, nwins_total):
        raise ValueError("Category validator fails: %f, %f" %
                         (wsum, nwins_total))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号