标签:clip on() dict ssi keras ilo span round psi
# accuracy, fmeasure, precision,recall def mcor(y_true, y_pred): y_pred_pos = K.round(K.clip(y_pred, 0, 1)) y_pred_neg = 1-y_pred_pos y_pos = K.round(K.clip(y_true, 0, 1)) y_neg = 1-y_pos tp = K.sum(y_pos*y_pred_pos) tn = K.sum(y_neg*y_pred_neg) fp = K.sum(y_neg*y_pred_pos) fn = K.sum(y_pos*y_pred_neg) numerator = (tp*tn - fp*fn) denominator = K.sqrt((tp+fp)*(tp+fn)*(tn+fp)*(tn+fn)) return numerator/(denominator+K.epsilon()) def precision(y_true, y_pred): 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 def recall(y_true, y_pred): 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 f1(y_true, y_pred): def recall(y_true, y_pred): 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): 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()))
标签:clip on() dict ssi keras ilo span round psi
原文地址:https://www.cnblogs.com/papio/p/10869652.html