aboutsummaryrefslogtreecommitdiff
path: root/mllib
diff options
context:
space:
mode:
authorWeichenXu <WeichenXu123@outlook.com>2016-07-12 09:23:59 +0100
committerSean Owen <sowen@cloudera.com>2016-07-12 09:23:59 +0100
commitfc11c509e234c5414687f7fbd13af113a1f52f10 (patch)
treec7320d078c85f86bab8f12ca49f4d537f09373c3 /mllib
parentc9a6762150cfd62691a6361e05d2839b110fe8d0 (diff)
downloadspark-fc11c509e234c5414687f7fbd13af113a1f52f10.tar.gz
spark-fc11c509e234c5414687f7fbd13af113a1f52f10.tar.bz2
spark-fc11c509e234c5414687f7fbd13af113a1f52f10.zip
[MINOR][ML] update comment where is inconsistent with code in ml.regression.LinearRegression
## What changes were proposed in this pull request? In `train` method of `ml.regression.LinearRegression` when handling situation `std(label) == 0` the code replace `std(label)` with `mean(label)` but the relative comment is inconsistent, I update it. ## How was this patch tested? N/A Author: WeichenXu <WeichenXu123@outlook.com> Closes #14121 from WeichenXu123/update_lr_comment.
Diffstat (limited to 'mllib')
-rw-r--r--mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala b/mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala
index 0a4d98cab6..0477f71f32 100644
--- a/mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala
+++ b/mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala
@@ -263,7 +263,7 @@ class LinearRegression @Since("1.3.0") (@Since("1.3.0") override val uid: String
}
// if y is constant (rawYStd is zero), then y cannot be scaled. In this case
- // setting yStd=1.0 ensures that y is not scaled anymore in l-bfgs algorithm.
+ // setting yStd=abs(yMean) ensures that y is not scaled anymore in l-bfgs algorithm.
val yStd = if (rawYStd > 0) rawYStd else math.abs(yMean)
val featuresMean = featuresSummarizer.mean.toArray
val featuresStd = featuresSummarizer.variance.toArray.map(math.sqrt)