specificity: convert to plaintf

This commit is contained in:
Starbeamrainbowlabs 2023-03-03 22:16:48 +00:00
parent 26cc824ace
commit c7b577ab29
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -19,7 +19,7 @@ def specificity(y_pred, y_true):
neg_y_true = 1 - y_true
neg_y_pred = 1 - y_pred
fp = K.sum(neg_y_true * y_pred)
tn = K.sum(neg_y_true * neg_y_pred)
specificity = tn / (tn + fp + K.epsilon())
fp = tf.math.reduce_sum(neg_y_true * y_pred)
tn = tf.math.reduce_sum(neg_y_true * neg_y_pred)
specificity = tn / (tn + fp + tf.keras.backend.epsilon())
return specificity