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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to