From 9cb4e9bae4c1ac104d089e242684bdd3bc33df25 Mon Sep 17 00:00:00 2001 From: OVVO-Financial Date: Wed, 15 Jul 2026 21:38:49 -0400 Subject: [PATCH 1/2] Replace obsolete Boost seed-invariance test --- tests/parity/test_boost.py | 46 +++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/tests/parity/test_boost.py b/tests/parity/test_boost.py index 23d07d5b..9c06ff77 100644 --- a/tests/parity/test_boost.py +++ b/tests/parity/test_boost.py @@ -55,12 +55,8 @@ def test_nns_boost_ivs_test_none_matches_r() -> None: depth=None, features_only=False, ) - # random_seed is pinned for determinism. The deterministic feature-set path - # still draws from the CV-split RNG for iterations above n_rows/4, so an - # unseeded call left this assertion theoretically seed-sensitive even though - # the boosted result is empirically seed-invariant here (see - # test_nns_boost_ivs_test_none_is_seed_invariant). Pinning the seed removes - # any residual flakiness without altering the matched values. + # Use the default seed 123 to match R NNS.boost and its delegated NNS.stack + # folds. actual = nns_boost( variable, y, @@ -73,38 +69,38 @@ def test_nns_boost_ivs_test_none_matches_r() -> None: @pytest.mark.parity -def test_nns_boost_ivs_test_none_is_seed_invariant() -> None: - # Regression guard for the previously reported cache-parity failure: the - # depth=None / feature_importance=False boosted result must be identical - # across seeds (and an unseeded call), so the parity comparison cannot be - # destabilised by RNG draws on the CV-split path. +@pytest.mark.parametrize("seed", [0, 1, 4, 42, 1234]) +def test_nns_boost_ivs_test_none_is_seed_reproducible(seed: int) -> None: + """Reusing a seed reproduces the delegated NNS.stack estimate.""" x = np.linspace(-2.0, 2.0, 24) variable = np.column_stack((x, np.sin(x), np.cos(x))) y = x + np.sin(x) + 0.25 * np.cos(x) - baseline = np.asarray( + first = np.asarray( nns_boost( variable, y, learner_trials=10, cv_size=0.25, feature_importance=False, + random_seed=seed, )["results"], dtype=np.float64, ) - for seed in (None, 0, 1, 4, 42, 1234): - result = np.asarray( - nns_boost( - variable, - y, - learner_trials=10, - cv_size=0.25, - feature_importance=False, - random_seed=seed, - )["results"], - dtype=np.float64, - ) - np.testing.assert_array_equal(result, baseline) + + second = np.asarray( + nns_boost( + variable, + y, + learner_trials=10, + cv_size=0.25, + feature_importance=False, + random_seed=seed, + )["results"], + dtype=np.float64, + ) + + np.testing.assert_array_equal(first, second) @pytest.mark.parity From b2b05b7de6659baaca630b3f189aed1c6336c143 Mon Sep 17 00:00:00 2001 From: OVVO-Financial Date: Wed, 15 Jul 2026 21:43:58 -0400 Subject: [PATCH 2/2] Replace obsolete Boost seed-invariance test --- tests/parity/test_boost.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/parity/test_boost.py b/tests/parity/test_boost.py index 9c06ff77..42d1f03f 100644 --- a/tests/parity/test_boost.py +++ b/tests/parity/test_boost.py @@ -63,6 +63,7 @@ def test_nns_boost_ivs_test_none_matches_r() -> None: learner_trials=10, cv_size=0.25, feature_importance=False, + random_seed=123, ) _assert_boost_matches(actual, expected)