2020
10-08
10-08
使用keras实现Precise, Recall, F1-socre方式
实现过程fromkerasimportbackendasKdefPrecision(y_true,y_pred):"""精确率"""tp=K.sum(K.round(K.clip(y_true*y_pred,0,1)))#truepositivespp=K.sum(K.round(K.clip(y_pred,0,1)))#predictedpositivesprecision=tp/(pp+K.epsilon())returnprecisiondefRecall(y_true,y_pred):"""召回率"""tp=K.sum(K.round(K.clip(y_true*y_pred,0,1)))#truepositivespp=K.sum(K.round(K.clip(y_...
继续阅读 >