You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by rx...@apache.org on 2015/04/30 06:48:01 UTC
spark git commit: Some code clean up.
Repository: spark
Updated Branches:
refs/heads/master 5553198fe -> ba49eb162
Some code clean up.
Author: DB Tsai <db...@netflix.com>
Closes #5794 from dbtsai/clean and squashes the following commits:
ad639dd [DB Tsai] Indentation
834d527 [DB Tsai] Some code clean up.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/ba49eb16
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/ba49eb16
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/ba49eb16
Branch: refs/heads/master
Commit: ba49eb1625b1190d8aaf2c55dc1f6309ac3e080c
Parents: 5553198
Author: DB Tsai <db...@netflix.com>
Authored: Wed Apr 29 21:44:41 2015 -0700
Committer: Reynold Xin <rx...@databricks.com>
Committed: Wed Apr 29 21:44:41 2015 -0700
----------------------------------------------------------------------
.../spark/mllib/util/LinearDataGenerator.scala | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/ba49eb16/mllib/src/main/scala/org/apache/spark/mllib/util/LinearDataGenerator.scala
----------------------------------------------------------------------
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 91c2f4c..b1a4517 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,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 =>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org