Skip to content

Commit

Permalink
add all cases to UT
Browse files Browse the repository at this point in the history
  • Loading branch information
mgaido91 committed Jan 23, 2018
1 parent 7894609 commit ebc6d16
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,20 @@ class BucketizerSuite extends SparkFunSuite with MLlibTestSparkContext with Defa
val df = Seq((0.5, 0.3), (0.5, -0.4)).toDF("feature1", "feature2")
ParamsSuite.testExclusiveParams(new Bucketizer, df, ("inputCol", "feature1"),
("inputCols", Array("feature1", "feature2")))
ParamsSuite.testExclusiveParams(new Bucketizer, df, ("outputCol", "result1"),
ParamsSuite.testExclusiveParams(new Bucketizer, df, ("inputCol", "feature1"),
("outputCol", "result1"), ("splits", Array(-0.5, 0.0, 0.5)),
("outputCols", Array("result1", "result2")))
ParamsSuite.testExclusiveParams(new Bucketizer, df, ("splits", Array(-0.5, 0.0, 0.5)),
ParamsSuite.testExclusiveParams(new Bucketizer, df, ("inputCol", "feature1"),
("outputCol", "result1"), ("splits", Array(-0.5, 0.0, 0.5)),
("splitsArray", Array(Array(-0.5, 0.0, 0.5), Array(-0.5, 0.0, 0.5))))

// this should fail because at least one of inputCol and inputCols must be set
ParamsSuite.testExclusiveParams(new Bucketizer, df, ("outputCol", "feature1"),
("splits", Array(-0.5, 0.0, 0.5)))

// the following should fail because not all the params are set
ParamsSuite.testExclusiveParams(new Bucketizer, df, ("inputCol", "feature1"),
("outputCol", "result1"))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ object ParamsSuite extends SparkFunSuite {
paramsAndValues.foreach { case (paramName, paramValue) =>
m.set(m.getParam(paramName), paramValue)
}
val e = intercept[IllegalArgumentException] {
intercept[IllegalArgumentException] {
m match {
case t: Transformer => t.transform(dataset)
case e: Estimator[_] => e.fit(dataset)
Expand Down

0 comments on commit ebc6d16

Please sign in to comment.