Skip to content
Snippets Groups Projects
Commit ba49eb16 authored by DB Tsai's avatar DB Tsai Committed by Reynold Xin
Browse files

Some code clean up.

Author: DB Tsai <dbt@netflix.com>

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

ad639dd [DB Tsai] Indentation
834d527 [DB Tsai] Some code clean up.
parent 5553198f
No related branches found
No related tags found
No related merge requests found
...@@ -75,8 +75,8 @@ object LinearDataGenerator { ...@@ -75,8 +75,8 @@ object LinearDataGenerator {
seed: Int, seed: Int,
eps: Double = 0.1): Seq[LabeledPoint] = { eps: Double = 0.1): Seq[LabeledPoint] = {
generateLinearInput(intercept, weights, generateLinearInput(intercept, weights,
Array.fill[Double](weights.size)(0.0), Array.fill[Double](weights.length)(0.0),
Array.fill[Double](weights.size)(1.0 / 3.0), Array.fill[Double](weights.length)(1.0 / 3.0),
nPoints, seed, eps)} nPoints, seed, eps)}
/** /**
...@@ -105,13 +105,12 @@ object LinearDataGenerator { ...@@ -105,13 +105,12 @@ object LinearDataGenerator {
val x = Array.fill[Array[Double]](nPoints)( val x = Array.fill[Array[Double]](nPoints)(
Array.fill[Double](weights.length)(rnd.nextDouble())) Array.fill[Double](weights.length)(rnd.nextDouble()))
x.foreach { x.foreach { v =>
case v => var i = 0
var i = 0 while (i < v.length) {
while (i < v.length) { v(i) = (v(i) - 0.5) * math.sqrt(12.0 * xVariance(i)) + xMean(i)
v(i) = (v(i) - 0.5) * math.sqrt(12.0 * xVariance(i)) + xMean(i) i += 1
i += 1 }
}
} }
val y = x.map { xi => val y = x.map { xi =>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment