aboutsummaryrefslogtreecommitdiff
path: root/mllib/src/test/scala/org/apache
diff options
context:
space:
mode:
Diffstat (limited to 'mllib/src/test/scala/org/apache')
-rw-r--r--mllib/src/test/scala/org/apache/spark/ml/classification/MultilayerPerceptronClassifierSuite.scala17
1 files changed, 17 insertions, 0 deletions
diff --git a/mllib/src/test/scala/org/apache/spark/ml/classification/MultilayerPerceptronClassifierSuite.scala b/mllib/src/test/scala/org/apache/spark/ml/classification/MultilayerPerceptronClassifierSuite.scala
index 5df8e6a847..53c7a559e3 100644
--- a/mllib/src/test/scala/org/apache/spark/ml/classification/MultilayerPerceptronClassifierSuite.scala
+++ b/mllib/src/test/scala/org/apache/spark/ml/classification/MultilayerPerceptronClassifierSuite.scala
@@ -43,6 +43,23 @@ class MultilayerPerceptronClassifierSuite
).toDF("features", "label")
}
+ test("Input Validation") {
+ val mlpc = new MultilayerPerceptronClassifier()
+ intercept[IllegalArgumentException] {
+ mlpc.setLayers(Array[Int]())
+ }
+ intercept[IllegalArgumentException] {
+ mlpc.setLayers(Array[Int](1))
+ }
+ intercept[IllegalArgumentException] {
+ mlpc.setLayers(Array[Int](0, 1))
+ }
+ intercept[IllegalArgumentException] {
+ mlpc.setLayers(Array[Int](1, 0))
+ }
+ mlpc.setLayers(Array[Int](1, 1))
+ }
+
test("XOR function learning as binary classification problem with two outputs.") {
val layers = Array[Int](2, 5, 2)
val trainer = new MultilayerPerceptronClassifier()