-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
We should raise an error message when n_groups > actual number of groups #7681
Copy link
Copy link
Closed
Labels
EasyWell-defined and straightforward way to resolveWell-defined and straightforward way to resolve
Milestone
Description
In LeaveOneGroupOut and LeavePGroupsOut, when the groups supplied at split time has fewer than or equal to n_groups, we should raise an error.
>>> import numpy as np
>>> from sklearn.model_selection import LeaveOneGroupOut, LeavePGroupsOut
>>> X = y = groups = np.ones(10)
>>> list(LeaveOneGroupOut.split(X, y, groups))
[(array([], dtype=int64), array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]))]
>>> list(LeavePGroupsOut(n_groups=5).split(X, y, groups))
[]This was like that before in the cross_validation module too. I think we should raise an appropriate error message in both cases (LeavePGroupsOut and LeaveOneGroupOut)?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
EasyWell-defined and straightforward way to resolveWell-defined and straightforward way to resolve