Skip to content
Snippets Groups Projects
Commit fc11c509 authored by WeichenXu's avatar WeichenXu Committed by Sean Owen
Browse files

[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.
parent c9a67621
No related branches found
No related tags found
No related merge requests found
...@@ -263,7 +263,7 @@ class LinearRegression @Since("1.3.0") (@Since("1.3.0") override val uid: String ...@@ -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 // 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 yStd = if (rawYStd > 0) rawYStd else math.abs(yMean)
val featuresMean = featuresSummarizer.mean.toArray val featuresMean = featuresSummarizer.mean.toArray
val featuresStd = featuresSummarizer.variance.toArray.map(math.sqrt) val featuresStd = featuresSummarizer.variance.toArray.map(math.sqrt)
......
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