Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FIX Bisecting kmeans when data has 1 feature - #27243

Merged
jjerphan merged 3 commits into
scikit-learn:mainfrom
jeremiedbb:fix-bisecting-kmeans
Sep 1, 2023
Merged

FIX Bisecting kmeans when data has 1 feature#27243
jjerphan merged 3 commits into
scikit-learn:mainfrom
jeremiedbb:fix-bisecting-kmeans

Conversation

@jeremiedbb

Copy link
Copy Markdown
Member

Fixes #27236

@jeremiedbb jeremiedbb added the Quick Review For PRs that are quick to review label Aug 30, 2023
@jeremiedbb jeremiedbb added this to the 1.3.1 milestone Aug 30, 2023
@github-actions

github-actions Bot commented Aug 30, 2023

Copy link
Copy Markdown

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: c868db0. Link to the linter CI: here

Comment thread doc/whats_new/v1.3.rst Outdated
Comment thread sklearn/cluster/_bisect_k_means.py

@betatim betatim left a comment

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.

Looks reasonable to me. The thing I don't understand is why this only happens if n_features=1. Wouldn't it happen always when n_features != 2?

@jeremiedbb

Copy link
Copy Markdown
Member Author

When n_features > 2 we allocate an array to big but since we only access the first 2 elements later there's no out of bound issue

@betatim

betatim commented Aug 30, 2023

Copy link
Copy Markdown
Member

Ah yes. So there is a bug for n_features > 2, but we don't "observe" it.

@jeremiedbb

Copy link
Copy Markdown
Member Author

Ah yes. So there is a bug for n_features > 2, but we don't "observe" it.

I wouldn't call it a bug but a sub-optimal memory management 😄

@jjerphan jjerphan left a comment

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.

LGTM.

Is predict also affected?

@jeremiedbb

Copy link
Copy Markdown
Member Author

Is predict also affected?

Nope

@jjerphan jjerphan changed the title Fix bisecting kmeans when data has 1 feature FIX Bisecting kmeans when data has 1 feature Sep 1, 2023
@jjerphan
jjerphan merged commit 8b7756e into scikit-learn:main Sep 1, 2023
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Sep 5, 2023
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Sep 18, 2023
jeremiedbb added a commit that referenced this pull request Sep 20, 2023
REDVM pushed a commit to REDVM/scikit-learn that referenced this pull request Nov 16, 2023
@jeremiedbb
jeremiedbb deleted the fix-bisecting-kmeans branch September 3, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:cluster Quick Review For PRs that are quick to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BisectingKmeans - intertia per cluster

3 participants