You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "Israelobuk (via GitHub)" <gi...@apache.org> on 2026/08/07 18:21:01 UTC

[PR] [MLLIB] Exclude zero-weight observations from KMeans initialization [spark]

Israelobuk opened a new pull request, #57857:
URL: https://github.com/apache/spark/pull/57857

   ## What changes were proposed in this pull request?
   
   This change prevents zero-weight observations from influencing KMeans centroid initialization.
   
   The row solver now excludes zero-weight observations before RANDOM or k-means|| initialization. The block solver now carries `weightCol` into initialization and excludes zero-weight observations there as well.
   
   ## Why are the changes needed?
   
   Weighted KMeans ignores zero-weight observations during cluster updates, but initialization could still select them as candidate centers. This meant adding a zero-weight outlier could change the fitted model.
   
   ## Does this PR introduce any user-facing changes?
   
   It makes initialization consistent with the existing weighted update semantics: zero-weight observations no longer affect the fitted clusters.
   
   ## How was this patch tested?
   
   A regression test compares datasets with and without an extreme zero-weight outlier across ROW and BLOCK solvers and RANDOM and k-means|| initialization.
   
   `git diff --check` passes. The focused Spark suite could not run in the available Windows environment because WSL `/bin/bash` is unavailable.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [MINOR][MLLIB] Exclude zero-weight observations from KMeans initialization [spark]

Posted by "Israelobuk (via GitHub)" <gi...@apache.org>.
Israelobuk closed pull request #57857: [MINOR][MLLIB] Exclude zero-weight observations from KMeans initialization
URL: https://github.com/apache/spark/pull/57857


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org