From f493e93fb8342b64dd030ddb72d140c50c595e07 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 8 Jan 2021 14:32:14 +0100 Subject: [PATCH] Fixed classifier threshold --- .../main/java/eu/faircode/email/MessageClassifier.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/MessageClassifier.java b/app/src/main/java/eu/faircode/email/MessageClassifier.java index 71a0216dfd..f148c6843f 100644 --- a/app/src/main/java/eu/faircode/email/MessageClassifier.java +++ b/app/src/main/java/eu/faircode/email/MessageClassifier.java @@ -257,13 +257,14 @@ public class MessageClassifier { String classification = null; double c0 = chances.get(0).chance; double c1 = chances.get(1).chance; - if (c0 > class_min_chance && c1 < c0 * class_min_difference) + double threshold = c0 * (1.0 - class_min_difference); + if (c0 > class_min_chance && c1 < threshold) classification = chances.get(0).clazz; Log.i("Classifier current=" + currentClass + - " c0=" + Math.round(c0 * 100 * 100) / 100.0 + ">" + Math.round(class_min_chance * 100 * 100) / 100.0 + "%" + - " c1=" + Math.round(c1 * 100 * 100) / 100.0 + "<" + Math.round(c0 * class_min_difference * 100 * 100) / 100.0 + "%" + - " (" + class_min_difference + "%)" + + " c0=" + Math.round(c0 * 100 * 100) / 100.0 + ">" + Math.round(class_min_chance * 100) + "%" + + " c1=" + Math.round(c1 * 100 * 100) / 100.0 + "<" + Math.round(threshold * 100 * 100) / 100.0 + "%" + + " (" + Math.round(class_min_difference * 100) + "%)" + " classified=" + classification); return classification;