-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdiff_155.patch
More file actions
32 lines (30 loc) · 2.98 KB
/
Copy pathdiff_155.patch
File metadata and controls
32 lines (30 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
diff --git a/models/ensemble_classifier_method.py b/models/ensemble_classifier_method.py
index c8f005b..308f1df 100644
--- a/models/ensemble_classifier_method.py
+++ b/models/ensemble_classifier_method.py
@@ -256,15 +256,22 @@ def confidence_weighted_voting(
label = pred["label"].upper()
confidence = pred["score"]
- # Weight the vote by confidence
+ accuracy = 1.0
+ if hasattr(self, 'performance_tracker') and self.performance_tracker:
+ stats = self.performance_tracker.get_model_stats(model_name)
+ accuracy = stats.get("recent_accuracy", 1.0)
+
+ # Weight the vote by confidence and accuracy
+ adjusted_confidence = confidence * accuracy
+
if label == "SPAM":
- spam_weight += confidence
- weight_contribution_spam = confidence
+ spam_weight += adjusted_confidence
+ weight_contribution_spam = adjusted_confidence
weight_contribution_ham = 0.0
else:
- ham_weight += confidence
+ ham_weight += adjusted_confidence
weight_contribution_spam = 0.0
- weight_contribution_ham = confidence
+ weight_contribution_ham = adjusted_confidence
model_votes.append(
{