Spaces:
Running
Running
fix scores strictly between 0 and 1 (not 0.0 or 1.0)
Browse files
tasks.py
CHANGED
|
@@ -154,7 +154,7 @@ class FloodYearComparisonTask(BaseTask):
|
|
| 154 |
notes.append("Causal explanation (+0.25)")
|
| 155 |
|
| 156 |
done = (self._rewarded_year and self._rewarded_areas and self._rewarded_reason) or step_num >= self.max_steps
|
| 157 |
-
return {"reward": float(min(reward,
|
| 158 |
"result": " | ".join(notes) if notes else "No criteria met.", "error": None}
|
| 159 |
|
| 160 |
def get_context(self) -> Dict[str, Any]:
|
|
@@ -211,7 +211,7 @@ class DistrictInundationTask(BaseTask):
|
|
| 211 |
|
| 212 |
done = (len(self._found) == len(r["chronic_districts"]) and
|
| 213 |
self._rewarded_area and self._rewarded_pop) or step_num >= self.max_steps
|
| 214 |
-
return {"reward": float(min(reward,
|
| 215 |
"result": " | ".join(notes) if notes else f"Districts found: {list(self._found)}", "error": None}
|
| 216 |
|
| 217 |
def get_context(self) -> Dict[str, Any]:
|
|
@@ -297,7 +297,7 @@ class FloodRiskForecastTask(BaseTask):
|
|
| 297 |
reward = max(reward, 0.0)
|
| 298 |
criteria = self._acc + self._zones + (self._named >= 2) + self._rain + self._year
|
| 299 |
done = criteria >= 4 or step_num >= self.max_steps
|
| 300 |
-
return {"reward": float(min(reward,
|
| 301 |
"result": " | ".join(notes) if notes else "No criteria met.", "error": None}
|
| 302 |
|
| 303 |
def get_context(self) -> Dict[str, Any]:
|
|
|
|
| 154 |
notes.append("Causal explanation (+0.25)")
|
| 155 |
|
| 156 |
done = (self._rewarded_year and self._rewarded_areas and self._rewarded_reason) or step_num >= self.max_steps
|
| 157 |
+
return {"reward": float(max(0.01, min(reward, 0.99))), "done": done,
|
| 158 |
"result": " | ".join(notes) if notes else "No criteria met.", "error": None}
|
| 159 |
|
| 160 |
def get_context(self) -> Dict[str, Any]:
|
|
|
|
| 211 |
|
| 212 |
done = (len(self._found) == len(r["chronic_districts"]) and
|
| 213 |
self._rewarded_area and self._rewarded_pop) or step_num >= self.max_steps
|
| 214 |
+
return {"reward": float(max(0.01, min(reward, 0.99))), "done": done,
|
| 215 |
"result": " | ".join(notes) if notes else f"Districts found: {list(self._found)}", "error": None}
|
| 216 |
|
| 217 |
def get_context(self) -> Dict[str, Any]:
|
|
|
|
| 297 |
reward = max(reward, 0.0)
|
| 298 |
criteria = self._acc + self._zones + (self._named >= 2) + self._rain + self._year
|
| 299 |
done = criteria >= 4 or step_num >= self.max_steps
|
| 300 |
+
return {"reward": float(max(0.01, min(reward, 0.99))), "done": done,
|
| 301 |
"result": " | ".join(notes) if notes else "No criteria met.", "error": None}
|
| 302 |
|
| 303 |
def get_context(self) -> Dict[str, Any]:
|