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

    https://github.com/apache/spark/pull/15910#discussion_r89852751
  
    --- 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 --
    
    OK. Fix it in this PR?


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