Skip to content

Commit

Permalink
Some code clean up.
Browse files Browse the repository at this point in the history
Author: DB Tsai <[email protected]>

Closes apache#5794 from dbtsai/clean and squashes the following commits:

ad639dd [DB Tsai] Indentation
834d527 [DB Tsai] Some code clean up.
  • Loading branch information
DB Tsai authored and rxin committed Apr 30, 2015
1 parent 5553198 commit ba49eb1
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)}

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

x.foreach {
case v =>
var i = 0
while (i < v.length) {
v(i) = (v(i) - 0.5) * math.sqrt(12.0 * xVariance(i)) + xMean(i)
i += 1
}
x.foreach { v =>
var i = 0
while (i < v.length) {
v(i) = (v(i) - 0.5) * math.sqrt(12.0 * xVariance(i)) + xMean(i)
i += 1
}
}

val y = x.map { xi =>
Expand Down

0 comments on commit ba49eb1

Please sign in to comment.