Github user thunterdb commented on a diff in the pull request:
https://github.com/apache/spark/pull/11549#discussion_r55592623
--- Diff: mllib/src/main/scala/org/apache/spark/ml/r/SparkRWrappers.scala
---
@@ -17,15 +17,41 @@
package org.apache.spark.ml.api.r
+import org.apache.spark.SparkException
import org.apache.spark.ml.{Pipeline, PipelineModel}
import org.apache.spark.ml.attribute._
import org.apache.spark.ml.classification.{LogisticRegression,
LogisticRegressionModel}
import org.apache.spark.ml.clustering.{KMeans, KMeansModel}
import org.apache.spark.ml.feature.{RFormula, VectorAssembler}
-import org.apache.spark.ml.regression.{LinearRegression,
LinearRegressionModel}
+import org.apache.spark.ml.regression._
import org.apache.spark.sql.DataFrame
private[r] object SparkRWrappers {
+ def fitGLM(
+ value: String,
+ df: DataFrame,
+ family: String,
+ lambda: Double,
+ solver: String): PipelineModel = {
+ if (solver.trim != "irls") throw new SparkException("Currently only
support irls")
+
+ val formula = new RFormula().setFormula(value)
+ val regex =
"^\\s*(\\w+)\\s*(\\(\\s*link\\s*=\\s*\"(\\w+)\"\\s*\\))?\\s*$".r
+ val estimator = family match {
+ case regex(familyName, group2, linkName) =>
--- End diff --
I am confused: why do you need a regex here? I do not see anything special
on the other side in R.
---
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]