Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In the regression setting, cv=LeaveOneGroupOut() and cv=LeavePGroupsOut() are not working #542

Open
Valentin-Laurent opened this issue Nov 21, 2024 · 0 comments
Labels
Backlog This is in the MAPIE team development backlog, yet to be prioritised. Good first issue Easy issue to start to contribute to MAPIE Other or internal If no other grey tag is relevant or if issue from the MAPIE team

Comments

@Valentin-Laurent
Copy link
Collaborator

Describe the bug
In the regression setting, cv=LeaveOneGroupOut() and cv=LeavePGroupsOut() are not working

To Reproduce
Script to reproduce the behavior:

from mapie.regression import MapieRegressor
from sklearn.datasets import load_iris
from sklearn.model_selection import *

X, y = load_iris(return_X_y=True)
groups = [0]*30 + [1]*30 + [2]*30 + [3]*30 + [4]*30

working = MapieRegressor(cv=GroupKFold())
working.fit(X, y, groups=groups)

not_working = MapieRegressor(cv=LeaveOneGroupOut()) # Same issue with LeavePGroupsOut(n_groups=n)
not_working.fit(X, y, groups=groups)

Additional context
The bug seems to come from this line of code, where check_no_agg_cv is not called with groups
self.use_split_method_ = check_no_agg_cv(X, self.cv, self.no_agg_cv_)

Simply adding groups here may solve the issue

@Valentin-Laurent Valentin-Laurent added Good first issue Easy issue to start to contribute to MAPIE Backlog This is in the MAPIE team development backlog, yet to be prioritised. Other or internal If no other grey tag is relevant or if issue from the MAPIE team labels Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backlog This is in the MAPIE team development backlog, yet to be prioritised. Good first issue Easy issue to start to contribute to MAPIE Other or internal If no other grey tag is relevant or if issue from the MAPIE team
Projects
None yet
Development

No branches or pull requests

1 participant