Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(alpha): enforce sample floors per split

xkam7ar8dc13d0a79b3
diff --git a/agent/src/factors/bench_runner_strict.py b/agent/src/factors/bench_runner_strict.py
index dd47dc948..9c01b60bb 100644
--- a/agent/src/factors/bench_runner_strict.py
+++ b/agent/src/factors/bench_runner_strict.py
@@ -250,6 +250,8 @@ def categorise_strict(
- ``alpha_t_train`` (Optional[float]) — None when no OOS split was run
- ``alpha_t_test`` (Optional[float]) — None when no OOS split was run
- ``ic_count`` (int)
+ - ``ic_count_train`` / ``ic_count_test`` (Optional[int]) — split
+ sample counts when OOS was run
Rules:
- ``alpha_t_full <= -thr`` → ``reversed_strict``
@@ -274,6 +276,17 @@ def categorise_strict(
t_test = row.get("alpha_t_test")
thr = thresholds.alpha_t_threshold
+ if t_test is not None:
+ train_count = row.get("ic_count_train")
+ test_count = row.get("ic_count_test")
+ if (
+ train_count is None
+ or test_count is None
+ or train_count < thresholds.min_ic_count
+ or test_count < thresholds.min_ic_count
+ ):
+ return "noise"
+
# Strict reversed: full sample alpha is significantly negative.
if t_full <= -thr:
return "reversed_strict"
diff --git a/agent/tests/factors/test_bench_strict.py b/agent/tests/factors/test_bench_strict.py
index 734f13b49..60593dc5a 100644
--- a/agent/tests/factors/test_bench_strict.py
+++ b/agent/tests/factors/test_bench_strict.py
@@ -126,6 +126,8 @@ def _row(**overrides: Any) -> dict[str, Any]:
"alpha_t_train": None,
"alpha_t_test": None,
"ic_count": 60,
+ "ic_count_train": 60,
+ "ic_count_test": 60,
}
base.update(overrides)
return base
@@ -156,6 +158,17 @@ def test_categorise_confirmed_alive_when_oos_also_passes() -> None:
assert categorise_strict(row) == "confirmed_alive"
+def test_categorise_rejects_underpowered_oos_split() -> None:
+ row = _row(
+ alpha_t_full=3.0,
+ alpha_t_train=3.0,
+ alpha_t_test=3.0,
+ ic_count_train=58,
+ ic_count_test=2,
+ )
+ assert categorise_strict(row) == "noise"
+
+
def test_categorise_short_ic_count_is_noise() -> None:
# Below min_ic_count even strong t-stats are downgraded.
row = _row(alpha_t_full=10.0, ic_count=10)