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

Skip to content

DOC Correct K-Means inertia summation bounds in documentation#34440

Open
imKartik5451 wants to merge 1 commit into
scikit-learn:mainfrom
imKartik5451:fix-kmeans-inertia-doc
Open

DOC Correct K-Means inertia summation bounds in documentation#34440
imKartik5451 wants to merge 1 commit into
scikit-learn:mainfrom
imKartik5451:fix-kmeans-inertia-doc

Conversation

@imKartik5451

Copy link
Copy Markdown

Description

This PR corrects the summation bounds in the K-Means inertia formula in the clustering documentation.

The previous notation used:

\sum_{i=0}^{n}

which includes n + 1 terms.

This changes the bounds to:

\sum_{i=0}^{n-1}

which correctly represents n samples while remaining consistent with zero-based indexing used throughout scikit-learn.

Fixes #34299

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Thank you for opening your first pull request to scikit-learn! 🎉

To help get your contribution reviewed, please make sure that:

  • You have filled out the pull request template.
  • The pull request addresses an existing issue that is ready for
    contribution (e.g. not tagged as "Needs Triage", "Needs Decision", ...).
    If you are proposing a new feature, please open an issue to discuss it first.
  • There are no other open pull requests already targeting the same issue.
  • You have followed the pull request checklist.
    In particular, linting and tests should pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possible indexing inconsistency in K-Means inertia summation formula

2 participants