aboutsummaryrefslogtreecommitdiff
path: root/mllib
diff options
context:
space:
mode:
authorReynold Xin <reynoldx@gmail.com>2013-07-30 13:58:23 -0700
committerReynold Xin <reynoldx@gmail.com>2013-07-30 13:58:23 -0700
commit47011e685449edfe9f91d8f937a5d23d3b359baf (patch)
tree2f0208a3acf467a2518501a14435a8973ee21b42 /mllib
parente35966ae9a0db3cfed9c46923d939fcc3d4eec4e (diff)
downloadspark-47011e685449edfe9f91d8f937a5d23d3b359baf.tar.gz
spark-47011e685449edfe9f91d8f937a5d23d3b359baf.tar.bz2
spark-47011e685449edfe9f91d8f937a5d23d3b359baf.zip
Use a tigher bound in logistic regression unit test's prediction validation.
Diffstat (limited to 'mllib')
-rw-r--r--mllib/src/test/scala/spark/mllib/classification/LogisticRegressionSuite.scala7
1 files changed, 4 insertions, 3 deletions
diff --git a/mllib/src/test/scala/spark/mllib/classification/LogisticRegressionSuite.scala b/mllib/src/test/scala/spark/mllib/classification/LogisticRegressionSuite.scala
index d3fe58a382..8664263935 100644
--- a/mllib/src/test/scala/spark/mllib/classification/LogisticRegressionSuite.scala
+++ b/mllib/src/test/scala/spark/mllib/classification/LogisticRegressionSuite.scala
@@ -21,11 +21,12 @@ import scala.util.Random
import org.scalatest.BeforeAndAfterAll
import org.scalatest.FunSuite
+import org.scalatest.matchers.ShouldMatchers
import spark.SparkContext
-class LogisticRegressionSuite extends FunSuite with BeforeAndAfterAll {
+class LogisticRegressionSuite extends FunSuite with BeforeAndAfterAll with ShouldMatchers {
val sc = new SparkContext("local", "test")
override def afterAll() {
@@ -64,8 +65,8 @@ class LogisticRegressionSuite extends FunSuite with BeforeAndAfterAll {
val numOffPredictions = predictions.zip(input).filter { case (prediction, (expected, _)) =>
(prediction != expected)
}.size
- // At least 80% of the predictions should be on.
- assert(numOffPredictions < input.length / 5)
+ // At least 83% of the predictions should be on.
+ ((input.length - numOffPredictions).toDouble / input.length) should be > 0.83
}
// Test if we can correctly learn A, B where Y = logistic(A + B*X)