srowen commented on a change in pull request #27758: [SPARK-31007][ML][WIP]
KMeans optimization based on triangle-inequality
URL: https://github.com/apache/spark/pull/27758#discussion_r408157153
##########
File path:
mllib/src/main/scala/org/apache/spark/mllib/clustering/DistanceMeasure.scala
##########
@@ -17,23 +17,124 @@
package org.apache.spark.mllib.clustering
+import org.apache.spark.SparkContext
import org.apache.spark.annotation.Since
+import org.apache.spark.broadcast.Broadcast
import org.apache.spark.mllib.linalg.{Vector, Vectors}
import org.apache.spark.mllib.linalg.BLAS.{axpy, dot, scal}
import org.apache.spark.mllib.util.MLUtils
private[spark] abstract class DistanceMeasure extends Serializable {
+ /**
+ * Statistics used in triangle inequality to obtain useful bounds to find
closest centers.
+ * @param distance distance between two centers
+ */
+ def computeStatistics(distance: Double): Double
+
+ /**
+ * Statistics used in triangle inequality to obtain useful bounds to find
closest centers.
+ *
+ * @return A symmetric matrix containing statistics, matrix(i)(j) represents:
Review comment:
It might be too hard to implement, but if it's symmetric you only need half
this many elements to represent. The indexing becomes more complex though
----------------------------------------------------------------
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]