Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added numRuns
  • Loading branch information
FlytxtRnD committed Jun 25, 2015
commit 714acb5667753a934005591f7f928bdb0df06c4f
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,11 @@ class KMeans private (

val initStartTime = System.nanoTime()

val numRuns = if (initialModel.nonEmpty) runs else 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These values should be switched


val centers = initialModel match {
case Some(kMeansCenters) => {
Array.tabulate(runs)(r => kMeansCenters.clusterCenters
Array.tabulate(numRuns)(r => kMeansCenters.clusterCenters
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to use numRuns or Array.tabulate here since you know there is only 1 run

.map(s => new VectorWithNorm(s, Vectors.norm(s, 2.0))))
}
case None => {
Expand All @@ -227,10 +229,10 @@ class KMeans private (
logInfo(s"Initialization with $initializationMode took " + "%.3f".format(initTimeInSeconds) +
" seconds.")

val active = Array.fill(runs)(true)
val costs = Array.fill(runs)(0.0)
val active = Array.fill(numRuns)(true)
val costs = Array.fill(numRuns)(0.0)

var activeRuns = new ArrayBuffer[Int] ++ (0 until runs)
var activeRuns = new ArrayBuffer[Int] ++ (0 until numRuns)
var iteration = 0

val iterationStartTime = System.nanoTime()
Expand Down