fix: honor explicit calibration horizon
This commit is contained in:
@@ -8,6 +8,7 @@ from tools.calibrate_torch_thresholds import (
|
||||
_average_selected_predictions,
|
||||
_apply_platt_calibration,
|
||||
_build_torch_model,
|
||||
_calibration_horizon,
|
||||
_calibration_symbols,
|
||||
_choose_recommendation,
|
||||
_full_backtest,
|
||||
@@ -78,6 +79,14 @@ def test_calibration_symbols_reject_malformed_artifact_symbols() -> None:
|
||||
assert _calibration_symbols("", (), {"symbols": []}) == []
|
||||
|
||||
|
||||
def test_explicit_calibration_horizon_selects_existing_multi_horizon_output() -> None:
|
||||
entry = {"target_horizon": 12, "target_horizons": [3, 6, 12, 24]}
|
||||
|
||||
assert _calibration_horizon(entry, 24, explicit=True) == 24
|
||||
assert _calibration_horizon(entry, 20, explicit=True) == 24
|
||||
assert _calibration_horizon(entry, 24, explicit=False) == 12
|
||||
|
||||
|
||||
def test_calibration_does_not_fallback_to_too_few_trades() -> None:
|
||||
selected = _choose_recommendation(
|
||||
[_result(trades=1, average=2.0, total=2.0, profit_factor=999.0)],
|
||||
|
||||
Reference in New Issue
Block a user