Skip to content

Commit

Permalink
Add the validation for runs
Browse files Browse the repository at this point in the history
  • Loading branch information
yu-iskw committed Jul 1, 2015
1 parent e41989c commit 444c289
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ private[clustering] trait KMeansParams
* return the best clustering found over any run. Default: 1.
* @group param
*/
val runs = new Param[Int](this, "runs", "number of runs of the algorithm to execute in parallel")
val runs = new Param[Int](this, "runs", "number of runs of the algorithm to execute in parallel",
(value: Int) => value >= 1)

/** @group getParam */
def getRuns: Int = $(runs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ class KMeansSuite extends SparkFunSuite with MLlibTestSparkContext {
intercept[IllegalArgumentException] {
new KMeans().setInitializationSteps(0)
}
intercept[IllegalArgumentException] {
new KMeans().setRuns(0)
}
}

test("fit & transform") {
Expand Down

0 comments on commit 444c289

Please sign in to comment.