Skip to content

Commit 51a237b

Browse files
committed
address review
1 parent 2ed94de commit 51a237b

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

mllib/src/test/scala/org/apache/spark/ml/clustering/GaussianMixtureSuite.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,16 @@ class GaussianMixtureSuite extends SparkFunSuite with MLlibTestSparkContext
5454
}
5555

5656
test("gmm fails on high dimensional data") {
57-
val ctx = spark.sqlContext
58-
import ctx.implicits._
5957
val df = Seq(
6058
Vectors.sparse(GaussianMixture.MAX_NUM_FEATURES + 1, Array(0, 4), Array(3.0, 8.0)),
6159
Vectors.sparse(GaussianMixture.MAX_NUM_FEATURES + 1, Array(1, 5), Array(4.0, 9.0)))
6260
.map(Tuple1.apply).toDF("features")
6361
val gm = new GaussianMixture()
64-
intercept[IllegalArgumentException] {
65-
gm.fit(df)
62+
withClue(s"GMM should restrict the maximum number of features to be < " +
63+
s"${GaussianMixture.MAX_NUM_FEATURES}") {
64+
intercept[IllegalArgumentException] {
65+
gm.fit(df)
66+
}
6667
}
6768
}
6869

mllib/src/test/scala/org/apache/spark/mllib/clustering/GaussianMixtureSuite.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ class GaussianMixtureSuite extends SparkFunSuite with MLlibTestSparkContext {
3131
Vectors.sparse(GaussianMixture.MAX_NUM_FEATURES + 1, Array(0, 4), Array(3.0, 8.0)),
3232
Vectors.sparse(GaussianMixture.MAX_NUM_FEATURES + 1, Array(1, 5), Array(4.0, 9.0))))
3333
val gm = new GaussianMixture()
34-
intercept[IllegalArgumentException] {
35-
gm.run(rdd)
34+
withClue(s"GMM should restrict the maximum number of features to be < " +
35+
s"${GaussianMixture.MAX_NUM_FEATURES}") {
36+
intercept[IllegalArgumentException] {
37+
gm.run(rdd)
38+
}
3639
}
3740
}
3841

0 commit comments

Comments
 (0)