ccks_baidu_entity_link
ccks_baidu_entity_link copied to clipboard
实体消歧训练时间
请问实体消歧的训练,大约需要多久
一个模型20多小时
在 2019-10-12 14:15:02,"sleepsophia" [email protected] 写道:
请问实体消歧的训练,大约需要多久
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
本人基本跑通,有需要交流加我15821444815,谢谢!
@panchunguang 实体消歧的训练,metric_f1=nan?应该是里面的pred_num=0
@panchunguang 实体消歧的训练,metric_f1=nan?应该是里面的pred_num=0
您好,我也遇到了这个问题,找了一下代码,是metric_f1函数,但想请教一个问题:这个函数需要传两个参数y_pred和y_true,而在调用处,没有传参数就调用了,有点不太理解。
@panchunguang 实体消歧的训练,metric_f1=nan?应该是里面的pred_num=0
from keras import backend as K
def metrics_f1(y_true, y_pred):
def recall(y_true, y_pred):
"""Recall metric.
Only computes a batch-wise average of recall.
Computes the recall, a metric for multi-label classification of
how many relevant items are selected.
"""
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
possible_positives = K.sum(K.round(K.clip(y_true, 0, 1)))
recall = true_positives / (possible_positives + K.epsilon())
return recall
def precision(y_true, y_pred):
"""Precision metric.
Only computes a batch-wise average of precision.
Computes the precision, a metric for multi-label classification of
how many selected items are relevant.
"""
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1)))
precision = true_positives / (predicted_positives + K.epsilon())
return precision
precision = precision(y_true, y_pred)
recall = recall(y_true, y_pred)
return 2*((precision*recall)/(precision+recall+K.epsilon()))
使用这个代码计算f1值,把原代码中的metrics_f1方法替换掉,就不会出现nan的问题了