Spaces:
Running
Running
YanBoChen
commited on
Commit
·
7620d26
1
Parent(s):
5d4792a
Add adaptive relevance thresholds for query complexity in PrecisionMRRAnalyzer; fix typo in condition mapping for postpartum hemorrhage
Browse files
evaluation/metric7_8_precision_MRR.py
CHANGED
|
@@ -36,6 +36,10 @@ from pathlib import Path
|
|
| 36 |
import re
|
| 37 |
import statistics
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
class PrecisionMRRAnalyzer:
|
| 40 |
"""Specialized analyzer for metrics 7-8 using existing comprehensive evaluation data"""
|
| 41 |
|
|
@@ -129,7 +133,7 @@ class PrecisionMRRAnalyzer:
|
|
| 129 |
is_complex = self._is_complex_query(query, processed_results)
|
| 130 |
|
| 131 |
# Step 2: Choose adaptive threshold (aligned with Metric 3 relevance standards)
|
| 132 |
-
threshold =
|
| 133 |
|
| 134 |
print(f" 🎯 Using relevance threshold: {threshold} ({'lenient' if is_complex else 'strict'})")
|
| 135 |
|
|
|
|
| 36 |
import re
|
| 37 |
import statistics
|
| 38 |
|
| 39 |
+
# Relevance threshold constants for adaptive query complexity handling
|
| 40 |
+
COMPLEX_QUERY_RELEVANCE_THRESHOLD = 0.65 # For queries with multiple emergency keywords
|
| 41 |
+
SIMPLE_QUERY_RELEVANCE_THRESHOLD = 0.75 # For straightforward diagnostic queries
|
| 42 |
+
|
| 43 |
class PrecisionMRRAnalyzer:
|
| 44 |
"""Specialized analyzer for metrics 7-8 using existing comprehensive evaluation data"""
|
| 45 |
|
|
|
|
| 133 |
is_complex = self._is_complex_query(query, processed_results)
|
| 134 |
|
| 135 |
# Step 2: Choose adaptive threshold (aligned with Metric 3 relevance standards)
|
| 136 |
+
threshold = COMPLEX_QUERY_RELEVANCE_THRESHOLD if is_complex else SIMPLE_QUERY_RELEVANCE_THRESHOLD # Updated thresholds for complex/simple queries
|
| 137 |
|
| 138 |
print(f" 🎯 Using relevance threshold: {threshold} ({'lenient' if is_complex else 'strict'})")
|
| 139 |
|
src/medical_conditions.py
CHANGED
|
@@ -64,7 +64,7 @@ CONDITION_KEYWORD_MAPPING: Dict[str, Dict[str, str]] = {
|
|
| 64 |
"emergency": "seizure|status epilepticus|postictal state",
|
| 65 |
"treatment": "antiepileptic drugs|EEG monitoring|neurology consult"
|
| 66 |
},
|
| 67 |
-
"
|
| 68 |
"emergency": "postpartum hemorrhage|uterine atony|placental retention|vaginal laceration",
|
| 69 |
"treatment": "uterine massage|IV oxytocin infusion|blood transfusion|surgical intervention"
|
| 70 |
},
|
|
|
|
| 64 |
"emergency": "seizure|status epilepticus|postictal state",
|
| 65 |
"treatment": "antiepileptic drugs|EEG monitoring|neurology consult"
|
| 66 |
},
|
| 67 |
+
"postpartum hemorrhage": {
|
| 68 |
"emergency": "postpartum hemorrhage|uterine atony|placental retention|vaginal laceration",
|
| 69 |
"treatment": "uterine massage|IV oxytocin infusion|blood transfusion|surgical intervention"
|
| 70 |
},
|