We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 21e7ff7 commit c40eba3Copy full SHA for c40eba3
mllib/src/main/scala/org/apache/spark/ml/optim/WeightedLeastSquares.scala
@@ -439,9 +439,12 @@ private[ml] object WeightedLeastSquares {
439
440
/**
441
* Weighted population standard deviation of labels.
442
- * We prevent variance from negative value caused by numerical error.
443
*/
444
- def bStd: Double = math.sqrt(math.max(bbSum / wSum - bBar * bBar, 0.0))
+ def bStd: Double = {
+ // We prevent variance from negative value caused by numerical error.
445
+ val variance = math.max(bbSum / wSum - bBar * bBar, 0.0)
446
+ math.sqrt(variance)
447
+ }
448
449
450
* Weighted mean of (label * features).
0 commit comments