We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 297b565 commit 30a2dbaCopy full SHA for 30a2dba
1 file changed
framework/fitness.py
@@ -0,0 +1,22 @@
1
+def calculate_composite_fitness(metrics: dict[str, float]) -> float:
2
+ """Calculate composite fitness score from evaluation metrics."""
3
+ # Extract metrics
4
+ f1_macro = metrics.get("f1_macro", 0.0)
5
+ recall_macro = metrics.get("recall_macro", 0.0)
6
+ roc_auc = metrics.get("roc_auc", 0.0)
7
+ precision_macro = metrics.get("precision_macro", 0.0)
8
+ accuracy = metrics.get("accuracy", 0.0)
9
+ f1_micro = metrics.get("f1_micro", 0.0)
10
+
11
+ # Composite fitness
12
+ composite_fitness = (
13
+ 0.30 * f1_macro +
14
+ 0.20 * recall_macro +
15
+ 0.20 * roc_auc +
16
+ 0.15 * precision_macro +
17
+ 0.10 * accuracy +
18
+ 0.05 * f1_micro
19
+ )
20
21
+ return composite_fitness
22
0 commit comments