FIX: In the regression setting, cv=LeaveOneGroupOut() and cv=LeavePGroupsOut() are not working #696
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request fixes an issue where the
_MapieRegressor
internal class did not supportLeaveOneGroupOut
andLeavePGroupsOut
as a valid cross-validation strategy. This was due to incorrect passing of thegroups
parameter to the_check_no_agg_cv
logic, which has now been corrected.Fixes #542
Type of change
Please remove options that are irrelevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
test_group_cv_output_shape
, which:Imports and applies
LeaveOneGroupOut
andLeavePGroupsOut
with groups passed to.fit()
Asserts that predicted intervals have the correct shape
Note: Now that the
_MapieRegressor
is an internal class, classes likeSplitConformalRegressor
class in the v1 API wraps_MapieRegressor
usingcv="prefit"
. This change does not directly affect it, but in future refactors, I think the handling of CV and group parameters could be carefully unified, given thatSplitConformalRegressor
inherits from_MapieRegressor
.Checklist
make lint
make type-check
make tests
make coverage
make doc
make doctest