def micro_recall(self, y_true, y_pred):
     return K.sum(self.true_positive(y_true, y_pred)) / (K.sum(y_true) + K.epsilon())
 def macro_f_measure(self, y_true, y_pred):
     precision = self.macro_precision(y_true, y_pred)
     recall = self.macro_recall(y_true, y_pred)
     return (2 * precision * recall) / (precision + recall + K.epsilon())
 def class_f_measure(self, class_label, y_true, y_pred):
     precision = self.class_precision(class_label, y_true, y_pred)
     recall = self.class_recall(class_label, y_true, y_pred)
     return (2 * precision * recall) / (precision + recall + K.epsilon())
 def micro_precision(self, y_true, y_pred):
     y_pred = self.normalize_y_pred(y_pred)
     return K.sum(self.true_positive(y_true, y_pred)) / (K.sum(y_pred) + K.epsilon())
 def class_recall(self, class_label, y_true, y_pred):
     return K.sum(self.class_true_positive(class_label, y_true, y_pred)) / (K.sum(y_true[:, class_label]) + K.epsilon())
 def class_precision(self, class_label, y_true, y_pred):
     y_pred = self.normalize_y_pred(y_pred)
     return K.sum(self.class_true_positive(class_label, y_true, y_pred)) / (K.sum(y_pred[:, class_label]) + K.epsilon())
Exemple #7
0
def f1_m(y_true, y_pred):
    precision = precision_m(y_true, y_pred)
    recall = recall_m(y_true, y_pred)
    return 2 * ((precision * recall) / (precision + recall + K.epsilon()))
Exemple #8
0
def precision_m(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
Exemple #9
0
def recall_m(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