Skip to content

Commit 150889c

Browse files
committed
Fix up error messages in the MLUtilsSuite
1 parent 2cb90b3 commit 150889c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

mllib/src/test/scala/org/apache/spark/mllib/util/MLUtilsSuite.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,23 @@ class MLUtilsSuite extends FunSuite with LocalSparkContext {
120120
for (seed <- 1 to 5) {
121121
val foldedRdds = MLUtils.kFold(data, folds, seed)
122122
assert(foldedRdds.size === folds)
123-
foldedRdds.map{case (test, train) =>
123+
foldedRdds.map { case (test, train) =>
124124
val result = test.union(train).collect().sorted
125125
val testSize = test.collect().size.toFloat
126-
assert(testSize > 0, "Non empty test data")
126+
assert(testSize > 0, "empty test data")
127127
val p = 1 / folds.toFloat
128128
// Within 3 standard deviations of the mean
129129
val range = 3 * math.sqrt(100 * p * (1-p))
130130
val expected = 100 * p
131131
val lowerBound = expected - range
132132
val upperBound = expected + range
133133
assert(testSize > lowerBound,
134-
"Test data (" + testSize + ") smaller than expected (" + lowerBound +")" )
134+
s"Test data ($testSize) smaller than expected ($lowerBound)" )
135135
assert(testSize < upperBound,
136-
"Test data (" + testSize + ") larger than expected (" + upperBound +")" )
137-
assert(train.collect().size > 0, "Non empty training data")
136+
s"Test data ($testSize) larger than expected ($upperBound)" )
137+
assert(train.collect().size > 0, "empty training data")
138138
assert(result === collectedData,
139-
"Each training+test set combined contains all of the data")
139+
"Each training+test set combined should contain all of the data.")
140140
}
141141
// K fold cross validation should only have each element in the test set exactly once
142142
assert(foldedRdds.map(_._1).reduce((x,y) => x.union(y)).collect().sorted ===

0 commit comments

Comments
 (0)