Skip to content

DOC Clarify LeaveOneGroupOut#24159

Merged
glemaitre merged 3 commits intoscikit-learn:mainfrom
lucyleeow:doc_leave
Aug 24, 2022
Merged

DOC Clarify LeaveOneGroupOut#24159
glemaitre merged 3 commits intoscikit-learn:mainfrom
lucyleeow:doc_leave

Conversation

@lucyleeow
Copy link
Copy Markdown
Member

Reference Issues/PRs

closes #24148

What does this implement/fix? Explain your changes.

Removes the use of the term 'third party' in LeaveOneGroup out description and fixes a typo.
Happy to change wording

Any other comments?

Copy link
Copy Markdown
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR!

cross-validation folds.
:class:`LeaveOneGroupOut` is a cross-validation scheme where each split holds
out samples belonging to one specific group. Group information is
provided via an array of integers that encode the group of each sample.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think the groups need to be integers:

Suggested change
provided via an array of integers that encode the group of each sample.
provided via an array that encodes the group of each sample.

Code example:

import numpy as np
from sklearn.model_selection import LeaveOneGroupOut
X = np.array([[1, 2], [3, 4], [5, 6], [7, 8]])
y = np.array([1, 2, 1, 2])
groups = np.array(["one", "one", "two", "two"])
logo = LeaveOneGroupOut()
for train_index, test_index in logo.split(X, y, groups):
    print(groups[train_index], groups[test_index])

Provides train/test indices to split data such that each training set is
comprised of all samples except ones belonging to one specific group.
Arbitrary domain specific group information is provided via an array of
integers that encode the group of each sample.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here regarding integers.

@lucyleeow
Copy link
Copy Markdown
Member Author

Thanks! Should have checked and not assumed the old wording was correct!

Copy link
Copy Markdown
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thomasjpfan thomasjpfan added the Quick Review For PRs that are quick to review label Aug 11, 2022
@glemaitre glemaitre merged commit c9d6a27 into scikit-learn:main Aug 24, 2022
@glemaitre
Copy link
Copy Markdown
Member

Thanks @lucyleeow

@lucyleeow lucyleeow deleted the doc_leave branch August 25, 2022 00:01
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DOC LeaveOneGroupOut description confusing

3 participants