diff --git a/agents/triggers.py b/agents/triggers.py index 83609b23..0617408b 100644 --- a/agents/triggers.py +++ b/agents/triggers.py @@ -14,10 +14,13 @@ def should_check_data_leakage(agent, node: SearchNode) -> bool: metric_value = node.metric.value maximize = agent.metric_maximize + # Exact float equality almost never fires in practice: a leaked AUC lands + # on 0.99997, a leaked RMSE on 1.2e-08. Compare against a threshold instead, + # keeping the old exact-1.0 / exact-0.0 cases inside the new bounds. if maximize: - is_extreme = (metric_value == 1.0) + is_extreme = (metric_value >= agent.acfg.leakage_max_threshold) else: - is_extreme = (metric_value == 0.0) + is_extreme = (metric_value <= agent.acfg.leakage_min_threshold) if is_extreme: logger.info( diff --git a/config/__init__.py b/config/__init__.py index 66a24b24..28737424 100644 --- a/config/__init__.py +++ b/config/__init__.py @@ -102,6 +102,9 @@ class AgentConfig: use_evolution: bool = True use_fusion: bool = True use_aggregation: bool = True + # Bounds for the data-leakage trigger (see agents/triggers.py). + leakage_max_threshold: float = 0.999 + leakage_min_threshold: float = 1e-6 @dataclass class ExecConfig: timeout: int diff --git a/config/config.yaml b/config/config.yaml index 6ef3c1cc..37f6af13 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -56,6 +56,9 @@ agent: # --- Submission check --- check_data_leakage: True + # A metric at or beyond these bounds triggers the data-leakage check. + leakage_max_threshold: 0.999 + leakage_min_threshold: 1e-6 # --- Code gen mode --- use_diff_mode: True # Multi-Mode Codegen