Github user sethah commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15314#discussion_r82092672
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala ---
    @@ -186,7 +201,11 @@ class LinearRegression @Since("1.3.0") 
(@Since("1.3.0") override val uid: String
       override protected def train(dataset: Dataset[_]): LinearRegressionModel 
= {
         // Extract the number of features before deciding optimization solver.
         val numFeatures = 
dataset.select(col($(featuresCol))).first().getAs[Vector](0).size
    -    val w = if (!isDefined(weightCol) || $(weightCol).isEmpty) lit(1.0) 
else col($(weightCol))
    +    val w = if (!isDefined(weightCol) || $(weightCol).isEmpty) {
    --- End diff --
    
    we copy this code a lot. It would be nice to leave this as a common method, 
but since we've made it a shared param, there isn't really a way to add a 
method to the param to the `HasWeightCol` trait. Not sure if there is a nice 
way to do this. cc @holdenk


---
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]

Reply via email to