提交 e6a29707 编写于 作者: L LDOUBLEV

add eps

上级 2afc8dd0
...@@ -48,7 +48,7 @@ class RecMetric(object): ...@@ -48,7 +48,7 @@ class RecMetric(object):
self.norm_edit_dis += norm_edit_dis self.norm_edit_dis += norm_edit_dis
return { return {
'acc': correct_num / all_num, 'acc': correct_num / all_num,
'norm_edit_dis': 1 - norm_edit_dis / all_num 'norm_edit_dis': 1 - norm_edit_dis / (all_num + 1e-3)
} }
def get_metric(self): def get_metric(self):
...@@ -58,8 +58,8 @@ class RecMetric(object): ...@@ -58,8 +58,8 @@ class RecMetric(object):
'norm_edit_dis': 0, 'norm_edit_dis': 0,
} }
""" """
acc = 1.0 * self.correct_num / self.all_num acc = 1.0 * self.correct_num / (self.all_num + 1e-3)
norm_edit_dis = 1 - self.norm_edit_dis / self.all_num norm_edit_dis = 1 - self.norm_edit_dis / (self.all_num + 1e-3)
self.reset() self.reset()
return {'acc': acc, 'norm_edit_dis': norm_edit_dis} return {'acc': acc, 'norm_edit_dis': norm_edit_dis}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册