1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-28 10:47:28 +00:00

Fixed classifier threshold

This commit is contained in:
M66B 2021-01-08 14:32:14 +01:00
parent 60d235eec2
commit f493e93fb8

View file

@ -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;