Skip to content

Delta SVM regression test depends on ambient NumPy random state #687

Closed

Description

@DresdenGman

tests/test_regression.py::test_regression_delta_svm depends on the ambient NumPy random state. It calls delta.bias_reduced_delta, whose raw bootstrap uses np.random.randint, but does not request the existing set_seed fixture in the same test file.

This can cause unrelated PRs to fail CI. For example, this job on #686 reported approximately (0.570223, 0.037019) against (0.6335098492, 0.0266406119), outside the existing atol=0.05.

I checked upstream aa2c554 locally with Python 3.14.6, NumPy 2.4.3 and SciPy 1.17.1. Setting ambient seeds 7 and 999 before calling the unmodified test produced respectively (0.6565344550, 0.0355505640) and (0.6726879613, 0.0374086056). Both happened to pass; these probes demonstrate dependence on random state, not an estimated failure frequency.

Applying the file's existing set_seed fixture before either run produced identical results: (0.6397107392, 0.0361985523). The fixture already seeds the legacy generator with 123456.

The proposed correction is to request that fixture in this test. No change to the algorithm, bootstrap count, expected values or tolerance is needed. This is separate from #681, which concerns Latin sampling in test_discrepancy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions