diff --git a/mllib/src/main/scala/org/apache/spark/mllib/util/LinearDataGenerator.scala b/mllib/src/main/scala/org/apache/spark/mllib/util/LinearDataGenerator.scala index 91c2f4ccd3d17..0a013ce764ca6 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/util/LinearDataGenerator.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/util/LinearDataGenerator.scala @@ -75,8 +75,8 @@ object LinearDataGenerator { seed: Int, eps: Double = 0.1): Seq[LabeledPoint] = { generateLinearInput(intercept, weights, - Array.fill[Double](weights.size)(0.0), - Array.fill[Double](weights.size)(1.0 / 3.0), + Array.fill[Double](weights.length)(0.0), + Array.fill[Double](weights.length)(1.0 / 3.0), nPoints, seed, eps)} /** @@ -105,8 +105,7 @@ object LinearDataGenerator { val x = Array.fill[Array[Double]](nPoints)( Array.fill[Double](weights.length)(rnd.nextDouble())) - x.foreach { - case v => + x.foreach { v => var i = 0 while (i < v.length) { v(i) = (v(i) - 0.5) * math.sqrt(12.0 * xVariance(i)) + xMean(i)