forked from scikit-learn/scikit-learn
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't working
Description
User request
RepeatedKFold and RepeatedStratifiedKFold do not show correct repr string.
Description
Both classes currently inherit from _RepeatedSplits which lacks a repr. As a result, repr(...) returns the default object representation. Expected is a parameterized string, e.g.:
- RepeatedKFold(n_splits=5, n_repeats=10, random_state=None)
- RepeatedStratifiedKFold(n_splits=5, n_repeats=10, random_state=None)
Steps/Code to Reproduce
from sklearn.model_selection import RepeatedKFold, RepeatedStratifiedKFold
repr(RepeatedKFold())
repr(RepeatedStratifiedKFold())Expected Results
RepeatedKFold(n_splits=5, n_repeats=10, random_state=None)
RepeatedStratifiedKFold(n_splits=5, n_repeats=10, random_state=None)Actual Results
'<sklearn.model_selection._split.RepeatedKFold object at 0x...>'
'<sklearn.model_selection._split.RepeatedStratifiedKFold object at 0x...>'Specification (from research)
- File: sklearn/model_selection/_split.py
- Import helper: from ..utils._pprint import _build_repr
- Add repr in _RepeatedSplits:
def __repr__(self):
return _build_repr(self)- Regression tests (sklearn/model_selection/tests/test_repeated_split_repr.py):
- Assert default repr strings for RepeatedKFold and RepeatedStratifiedKFold using
with config_context(print_changed_only=False) - Assert non-default parameter combinations also render correctly
- Assert default repr strings for RepeatedKFold and RepeatedStratifiedKFold using
Notes
- Defaults assumed: n_splits=5, n_repeats=10, random_state=None
- One PR will implement this change and add tests, targeting branch scikit-learn__scikit-learn-14983.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working