srowen commented on a change in pull request #28772:
URL: https://github.com/apache/spark/pull/28772#discussion_r438377687
##########
File path:
mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala
##########
@@ -961,51 +962,48 @@ class LinearRegressionSummary private[regression] (
private val privateModel: LinearRegressionModel,
private val diagInvAtWA: Array[Double]) extends Serializable {
- @transient private val metrics = new RegressionMetrics(
- predictions
- .select(col(predictionCol), col(labelCol).cast(DoubleType))
- .rdd
- .map { case Row(pred: Double, label: Double) => (pred, label) },
- !privateModel.getFitIntercept)
+ @transient private val metrics = {
+ val weightCol =
+ if (!privateModel.isDefined(privateModel.weightCol) ||
privateModel.getWeightCol.isEmpty) {
+ lit(1.0)
+ } else {
+ checkNonNegativeWeight(col(privateModel.getWeightCol).cast(DoubleType))
Review comment:
Is this check needed -- would the regression implementation have already
checked it? OK if not.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]