File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed
mllib/src/main/scala/org/apache/spark/mllib/clustering Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ class KMeansModel (val clusterCenters: Array[Vector]) extends Serializable {
2929
3030 /** Total number of clusters. */
3131 def k : Int = clusterCenters.length
32+ val ccWithNorm : Array [BreezeVectorWithNorm ] = clusterCenters.map(new BreezeVectorWithNorm (_))
3233
3334 /** Returns the cluster index that a given point belongs to. */
3435 def predict (point : Vector ): Int = {
@@ -43,7 +44,7 @@ class KMeansModel (val clusterCenters: Array[Vector]) extends Serializable {
4344 }
4445
4546 def predict2 (point : Vector ): (Int , Double ) = {
46- KMeans .findClosest(clusterCentersWithNorm , new BreezeVectorWithNorm (point))
47+ KMeans .findClosest(ccWithNorm , new BreezeVectorWithNorm (point))
4748 }
4849
4950 /** Maps given points to their cluster indices. */
You can’t perform that action at this time.
0 commit comments