-
Notifications
You must be signed in to change notification settings - Fork 128
Closed
Labels
Good first issueEasy issue to start to contribute to MAPIEEasy issue to start to contribute to MAPIE
Description
I have noticed that samples generated by the Subsample class all share the same random state.
Line 86 in 2d7fecb
| random_state=random_state, |
This suggests that all bootstraps are drawned with the same seed. However, quick experiments show that this is not the case.
Would it be possible to add a unit test to ensure that all samples drawn are different ? The same is true for blockbootstrap by the way.
Here is a suggestion :
import numpy as np
import pytest
from mapie.subsample import Subsample
def test_split_SubSample_different_amples() -> None:
"""Test that outputs of subsamplings are all different."""
X = np.array([0, 1, 2, 3])
cv = Subsample(n_resamplings=2, random_state=1)
trains = [x[0] for x in cv.split(X)]
tests = [x[1] for x in cv.split(X)]
with np.testing.assert_raises(AssertionError):
np.testing.assert_equal(trains[0], trains[1])
with np.testing.assert_raises(AssertionError):
np.testing.assert_equal(tests[0], tests[1])Metadata
Metadata
Assignees
Labels
Good first issueEasy issue to start to contribute to MAPIEEasy issue to start to contribute to MAPIE