Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19340#discussion_r161385643
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/clustering/KMeans.scala ---
    @@ -573,44 +705,45 @@ object KMeans {
       }
     
       /**
    -   * Returns the K-means cost of a given point against the given cluster 
centers.
    +   * @return whether a center converged or not, given the epsilon 
parameter.
        */
    -  private[mllib] def pointCost(
    -      centers: TraversableOnce[VectorWithNorm],
    -      point: VectorWithNorm): Double =
    -    findClosest(centers, point)._2
    +  override def isCenterConverged(
    +      oldCenter: VectorWithNorm,
    +      newCenter: VectorWithNorm,
    +      epsilon: Double): Boolean = {
    +    EuclideanDistanceMeasure.fastSquaredDistance(newCenter, oldCenter) <= 
epsilon * epsilon
    --- End diff --
    
    Do we need to override default `isCenterConverged` here? Seems to me it is 
equal to the default one.


---

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

Reply via email to