def cumulative_score(ground_truth, estimation, largest_error, integer_rounding=True):
if len(ground_truth) != len(estimation):
er = "ground_truth and estimation have different number of elements"
raise Exception(er)
if integer_rounding:
_estimation = numpy.rint(estimation)
else:
_estimation = estimation
N_e_le_j = (numpy.absolute(_estimation - ground_truth) <= largest_error).sum()
return N_e_le_j * 1.0 / len(ground_truth)
评论列表
文章目录