From 9facbe3ecbc14679b83053fa5f471dd50ab68fbd Mon Sep 17 00:00:00 2001 From: freeman Date: Sat, 25 Oct 2014 04:04:11 -0400 Subject: [PATCH] Bug fix --- .../org/apache/spark/mllib/clustering/StreamingKMeans.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mllib/src/main/scala/org/apache/spark/mllib/clustering/StreamingKMeans.scala b/mllib/src/main/scala/org/apache/spark/mllib/clustering/StreamingKMeans.scala index d1953a12dbe90..f3f528d356549 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/clustering/StreamingKMeans.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/clustering/StreamingKMeans.scala @@ -165,7 +165,7 @@ class StreamingKMeans( /** Initialize random centers, requiring only the number of dimensions. */ def setRandomCenters(d: Int): this.type = { val initialCenters = (0 until k).map(_ => Vectors.dense(Array.fill(d)(nextGaussian()))).toArray - val clusterCounts = Array.fill(0)(d).map(_.toLong) + val clusterCounts = Array.fill(this.k)(0).map(_.toLong) this.model = new StreamingKMeansModel(initialCenters, clusterCounts) this }