Github user dbtsai commented on a diff in the pull request:
https://github.com/apache/spark/pull/8884#discussion_r41808061
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala ---
@@ -130,9 +131,54 @@ class LinearRegression(override val uid: String)
def setWeightCol(value: String): this.type = set(weightCol, value)
setDefault(weightCol -> "")
+ /**
+ * Set the solver algorithm used for optimization.
+ * In case of linear regression, this can be "l-bfgs", "normal" and
"auto".
+ * The default value is "auto" which means that the solver algorithm is
+ * selected automatically.
+ * @group setParam
+ */
+ def setSolver(value: String): this.type = set(solver, value)
+ setDefault(solver -> "auto")
+
override protected def train(dataset: DataFrame): LinearRegressionModel
= {
+ // Extract the number of features before deciding optimization solver.
+ val numFeatures = dataset.select(col($(featuresCol))).limit(1).map {
+ case Row(features: Vector) =>
+ features.size
--- End diff --
move `features.size` to the line of `case Row...`
---
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]