Github user yanboliang commented on a diff in the pull request:
https://github.com/apache/spark/pull/15910#discussion_r88777030
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/r/LogisticRegressionWrapper.scala ---
@@ -84,14 +93,12 @@ private[r] object LogisticRegressionWrapper
val rFormula = new RFormula()
.setFormula(formula)
- RWrapperUtils.checkDataColumns(rFormula, data)
+ .setForceIndexLabel(true)
+ checkDataColumns(rFormula, data)
val rFormulaModel = rFormula.fit(data)
- // get feature names from output schema
- val schema = rFormulaModel.transform(data).schema
- val featureAttrs =
AttributeGroup.fromStructField(schema(rFormulaModel.getFeaturesCol))
- .attributes.get
- val features = featureAttrs.map(_.name.get)
+ // get labels and feature names from output schema
+ val (features, labels) = getFeaturesAndLabels(rFormulaModel, data)
// assemble and fit the pipeline
val logisticRegression = new LogisticRegression()
--- End diff --
off-topic, but I think it's a bug. We should not allow users pass
```fitIntercept``` to control whether to fit intercept, this should be handled
by formula. For example, if users specify formula ```y ~ a + b + c - 1```, then
the model should be fitted w/o intercept. Could you please fix this bug as
well? Thanks.
---
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]