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))
window_weights.py 文件源码
python
阅读 33
收藏 0
点赞 0
评论 0
评论列表
文章目录