Skip to content

Commit

Permalink
Fix a test problem
Browse files Browse the repository at this point in the history
  • Loading branch information
srowen committed Sep 3, 2016
1 parent dbed7d7 commit 0a51e1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ class KMeans private (

bcCenters.destroy(blocking = false)

val myWeights = centers.indices.map(countMap(_).toDouble).toArray
val myWeights = centers.indices.map(countMap.getOrElse(_, 0L).toDouble).toArray
LocalKMeans.kMeansPlusPlus(0, centers.toArray, myWeights, k, 30)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class KMeansSuite extends SparkFunSuite with MLlibTestSparkContext {

// Make sure code runs.
var model = KMeans.train(data, k = 2, maxIterations = 1)
assert(model.clusterCenters.size === 2)
assert(model.clusterCenters.size === 1)
}

test("more clusters than points") {
Expand All @@ -87,7 +87,7 @@ class KMeansSuite extends SparkFunSuite with MLlibTestSparkContext {

// Make sure code runs.
var model = KMeans.train(data, k = 3, maxIterations = 1)
assert(model.clusterCenters.size === 3)
assert(model.clusterCenters.size === 2)
}

test("deterministic initialization") {
Expand Down

0 comments on commit 0a51e1e

Please sign in to comment.