zhengruifeng commented on a change in pull request #27758: [SPARK-31007][ML] 
KMeans optimization based on triangle-inequality
URL: https://github.com/apache/spark/pull/27758#discussion_r386785281
 
 

 ##########
 File path: 
mllib/src/main/scala/org/apache/spark/mllib/clustering/DistanceMeasure.scala
 ##########
 @@ -24,16 +24,60 @@ import org.apache.spark.mllib.util.MLUtils
 
 private[spark] abstract class DistanceMeasure extends Serializable {
 
+  /**
+   * Radii of centers used in triangle inequality to obtain useful bounds to 
find
+   * closest centers.
+   *
+   * @see <a 
href="https://www.aaai.org/Papers/ICML/2003/ICML03-022.pdf";>Charles Elkan,
+   *      Using the Triangle Inequality to Accelerate k-Means</a>
+   *
+   * @return Radii of centers. If distance between point x and center c is 
less than
+   *         the radius of center c, then center c is the closest center to 
point x.
+   */
+  def computeRadii(centers: Array[VectorWithNorm]): Array[Double] = {
 
 Review comment:
   You are right, I should remove this. Not all distance can be expected to 
have such triangle-inequality.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to