scikit-learn / scikit-learn/scikit-learn

Spherical K-means support (unit norm centroids and input)

Open
#31,450 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs Decision - Include Feature New Feature
Dominant language
Python
Stars
67.3k
Forks
27.4k
Avg merge
1d 15h
Merged PRs (30d)
58

Description

Describe the workflow you want to enable

Hi,
I was wondering if there is—or has been—any initiative to support cosine similarity in the KMeans implementation (i.e., spherical KMeans). I find the algorithm quite useful and would be happy to propose an implementation. The addition should be relatively straightforward.

Describe your proposed solution

Enable the use of cosine similarity with KMeans or implement a separate SphericalKMeans class.

Describe alternatives you've considered, if relevant

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing KMeans implementation and its tests, then determine whether cosine similarity belongs in KMeans or requires a separate SphericalKMeans class. Define the expected unit-norm behavior for inputs and centroids, and add coverage showing that the selected design produces the intended clustering results.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.