Commit ·
eabed0d
1
Parent(s): 54776b0
fix: ensure scores strictly inside (0,1) for phase 2 validation
Browse files- src/environment.py +21 -4
src/environment.py
CHANGED
|
@@ -283,6 +283,19 @@ class StudyEnvironment:
|
|
| 283 |
productive_minutes=round(s["productive_minutes"], 2),
|
| 284 |
)
|
| 285 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 286 |
def _get_info(self) -> dict:
|
| 287 |
"""Extra info for graders and debugging."""
|
| 288 |
s = self._state
|
|
@@ -290,10 +303,14 @@ class StudyEnvironment:
|
|
| 290 |
|
| 291 |
# compute task-specific scores
|
| 292 |
scores = {
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 297 |
|
| 298 |
return {
|
| 299 |
"task_id": self.task_id,
|
|
|
|
| 283 |
productive_minutes=round(s["productive_minutes"], 2),
|
| 284 |
)
|
| 285 |
|
| 286 |
+
def _strict_score(self, value: float) -> float:
|
| 287 |
+
value = float(value)
|
| 288 |
+
|
| 289 |
+
# Clamp upper bound
|
| 290 |
+
if value >= 1.0:
|
| 291 |
+
return 0.999
|
| 292 |
+
|
| 293 |
+
# Clamp lower bound
|
| 294 |
+
if value <= 0.0:
|
| 295 |
+
return 0.001
|
| 296 |
+
|
| 297 |
+
return round(value, 4)
|
| 298 |
+
|
| 299 |
def _get_info(self) -> dict:
|
| 300 |
"""Extra info for graders and debugging."""
|
| 301 |
s = self._state
|
|
|
|
| 303 |
|
| 304 |
# compute task-specific scores
|
| 305 |
scores = {
|
| 306 |
+
"survive_8_hours": self._strict_score(s["energy"] / 100.0),
|
| 307 |
+
"maximize_productivity": self._strict_score(
|
| 308 |
+
s["productive_minutes"] / 240.0
|
| 309 |
+
),
|
| 310 |
+
"smart_break_taker": self._strict_score(
|
| 311 |
+
s["good_breaks"] / max(total_breaks, 1)
|
| 312 |
+
),
|
| 313 |
+
}
|
| 314 |
|
| 315 |
return {
|
| 316 |
"task_id": self.task_id,
|