From c7b577ab29e7cce503626092d26ed0764345158f Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Fri, 3 Mar 2023 22:16:48 +0000 Subject: [PATCH] specificity: convert to plaintf --- aimodel/src/lib/ai/components/MetricSpecificity.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aimodel/src/lib/ai/components/MetricSpecificity.py b/aimodel/src/lib/ai/components/MetricSpecificity.py index 05bf156..b15bef9 100644 --- a/aimodel/src/lib/ai/components/MetricSpecificity.py +++ b/aimodel/src/lib/ai/components/MetricSpecificity.py @@ -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