Skip to content

Commit ba49eb1

Browse files
DB Tsairxin
authored andcommitted
Some code clean up.
Author: DB Tsai <[email protected]> Closes #5794 from dbtsai/clean and squashes the following commits: ad639dd [DB Tsai] Indentation 834d527 [DB Tsai] Some code clean up.
1 parent 5553198 commit ba49eb1

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

mllib/src/main/scala/org/apache/spark/mllib/util/LinearDataGenerator.scala

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ object LinearDataGenerator {
7575
seed: Int,
7676
eps: Double = 0.1): Seq[LabeledPoint] = {
7777
generateLinearInput(intercept, weights,
78-
Array.fill[Double](weights.size)(0.0),
79-
Array.fill[Double](weights.size)(1.0 / 3.0),
78+
Array.fill[Double](weights.length)(0.0),
79+
Array.fill[Double](weights.length)(1.0 / 3.0),
8080
nPoints, seed, eps)}
8181

8282
/**
@@ -105,13 +105,12 @@ object LinearDataGenerator {
105105
val x = Array.fill[Array[Double]](nPoints)(
106106
Array.fill[Double](weights.length)(rnd.nextDouble()))
107107

108-
x.foreach {
109-
case v =>
110-
var i = 0
111-
while (i < v.length) {
112-
v(i) = (v(i) - 0.5) * math.sqrt(12.0 * xVariance(i)) + xMean(i)
113-
i += 1
114-
}
108+
x.foreach { v =>
109+
var i = 0
110+
while (i < v.length) {
111+
v(i) = (v(i) - 0.5) * math.sqrt(12.0 * xVariance(i)) + xMean(i)
112+
i += 1
113+
}
115114
}
116115

117116
val y = x.map { xi =>

0 commit comments

Comments
 (0)