Github user yanboliang commented on a diff in the pull request:
https://github.com/apache/spark/pull/14109#discussion_r73301221
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala ---
@@ -958,14 +973,17 @@ private class LeastSquaresCostFun(
override def calculate(coefficients: BDV[Double]): (Double, BDV[Double])
= {
val coeffs = Vectors.fromBreeze(coefficients)
+ val bcFeaturesStd = instances.context.broadcast(featuresStd)
+ val bcFeaturesMean = instances.context.broadcast(featuresMean)
+ val bcCoeffs = instances.context.broadcast(coeffs)
--- End diff --
Can we move ```bcFeaturesStd``` and ```bcFeaturesMean``` out of
```calculate```? Since they are invariables during the iterations, we should
not broadcast them in each iterations.
Meanwhile, it's better to call ```destroy(blocking = false)``` to release
memory of broadcast variables in the right place and time.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]