Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- env.py +13 -2
- openenv.yaml +3 -0
- patient_data.json +3 -3
env.py
CHANGED
|
@@ -29,6 +29,8 @@ INCREMENTAL_REWARD = 0.20
|
|
| 29 |
FINAL_REWARD = 1.00
|
| 30 |
HALLUCINATION_PENALTY = -0.50
|
| 31 |
TASK_SEQUENCE = ["easy", "medium", "hard"]
|
|
|
|
|
|
|
| 32 |
|
| 33 |
|
| 34 |
def _normalize(value: Optional[str]) -> str:
|
|
@@ -212,8 +214,11 @@ class ClinicalTrialEnvironment(
|
|
| 212 |
)
|
| 213 |
|
| 214 |
if not components:
|
| 215 |
-
return
|
| 216 |
-
|
|
|
|
|
|
|
|
|
|
| 217 |
|
| 218 |
def _next_task_id(self) -> str:
|
| 219 |
self._task_cursor = (self._task_cursor + 1) % len(TASK_SEQUENCE)
|
|
@@ -326,3 +331,9 @@ class ClinicalTrialEnvironment(
|
|
| 326 |
metadata={"grading_score": self._state.grading_score},
|
| 327 |
terminal_reason=terminal_reason,
|
| 328 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
FINAL_REWARD = 1.00
|
| 30 |
HALLUCINATION_PENALTY = -0.50
|
| 31 |
TASK_SEQUENCE = ["easy", "medium", "hard"]
|
| 32 |
+
MIN_STRICT_SCORE = 0.01
|
| 33 |
+
MAX_STRICT_SCORE = 0.99
|
| 34 |
|
| 35 |
|
| 36 |
def _normalize(value: Optional[str]) -> str:
|
|
|
|
| 214 |
)
|
| 215 |
|
| 216 |
if not components:
|
| 217 |
+
return MIN_STRICT_SCORE
|
| 218 |
+
|
| 219 |
+
raw_score = sum(components) / len(components)
|
| 220 |
+
strict_score = min(max(raw_score, MIN_STRICT_SCORE), MAX_STRICT_SCORE)
|
| 221 |
+
return round(strict_score, 4)
|
| 222 |
|
| 223 |
def _next_task_id(self) -> str:
|
| 224 |
self._task_cursor = (self._task_cursor + 1) % len(TASK_SEQUENCE)
|
|
|
|
| 331 |
metadata={"grading_score": self._state.grading_score},
|
| 332 |
terminal_reason=terminal_reason,
|
| 333 |
)
|
| 334 |
+
|
| 335 |
+
|
| 336 |
+
class ClinicalTrialEnv(ClinicalTrialEnvironment):
|
| 337 |
+
"""Compatibility alias for manifest entry points expecting env:ClinicalTrialEnv."""
|
| 338 |
+
|
| 339 |
+
pass
|
openenv.yaml
CHANGED
|
@@ -7,12 +7,15 @@ tasks:
|
|
| 7 |
- id: easy
|
| 8 |
name: Metastatic NSCLC Screening
|
| 9 |
difficulty: easy
|
|
|
|
| 10 |
- id: medium
|
| 11 |
name: Patient Protocol Ranking
|
| 12 |
difficulty: medium
|
|
|
|
| 13 |
- id: hard
|
| 14 |
name: AML Exclusion Detection
|
| 15 |
difficulty: hard
|
|
|
|
| 16 |
tags:
|
| 17 |
- healthcare
|
| 18 |
- clinical-trials
|
|
|
|
| 7 |
- id: easy
|
| 8 |
name: Metastatic NSCLC Screening
|
| 9 |
difficulty: easy
|
| 10 |
+
grader: grade_easy_screening
|
| 11 |
- id: medium
|
| 12 |
name: Patient Protocol Ranking
|
| 13 |
difficulty: medium
|
| 14 |
+
grader: grade_medium_ranking
|
| 15 |
- id: hard
|
| 16 |
name: AML Exclusion Detection
|
| 17 |
difficulty: hard
|
| 18 |
+
grader: grade_hard_exclusions
|
| 19 |
tags:
|
| 20 |
- healthcare
|
| 21 |
- clinical-trials
|
patient_data.json
CHANGED
|
@@ -40,7 +40,7 @@
|
|
| 40 |
},
|
| 41 |
"hidden_exclusions": [],
|
| 42 |
"max_steps": 6,
|
| 43 |
-
"grader_name": "
|
| 44 |
},
|
| 45 |
"medium": {
|
| 46 |
"difficulty": "medium",
|
|
@@ -102,7 +102,7 @@
|
|
| 102 |
},
|
| 103 |
"hidden_exclusions": [],
|
| 104 |
"max_steps": 6,
|
| 105 |
-
"grader_name": "
|
| 106 |
},
|
| 107 |
"hard": {
|
| 108 |
"difficulty": "hard",
|
|
@@ -137,7 +137,7 @@
|
|
| 137 |
"recent strong cyp3a4 inhibitor"
|
| 138 |
],
|
| 139 |
"max_steps": 6,
|
| 140 |
-
"grader_name": "
|
| 141 |
}
|
| 142 |
}
|
| 143 |
}
|
|
|
|
| 40 |
},
|
| 41 |
"hidden_exclusions": [],
|
| 42 |
"max_steps": 6,
|
| 43 |
+
"grader_name": "grade_easy_screening"
|
| 44 |
},
|
| 45 |
"medium": {
|
| 46 |
"difficulty": "medium",
|
|
|
|
| 102 |
},
|
| 103 |
"hidden_exclusions": [],
|
| 104 |
"max_steps": 6,
|
| 105 |
+
"grader_name": "grade_medium_ranking"
|
| 106 |
},
|
| 107 |
"hard": {
|
| 108 |
"difficulty": "hard",
|
|
|
|
| 137 |
"recent strong cyp3a4 inhibitor"
|
| 138 |
],
|
| 139 |
"max_steps": 6,
|
| 140 |
+
"grader_name": "grade_hard_exclusions"
|
| 141 |
}
|
| 142 |
}
|
| 143 |
}
|