Github user ericl commented on a diff in the pull request: https://github.com/apache/spark/pull/7574#discussion_r35397461 --- Diff: mllib/src/main/scala/org/apache/spark/ml/feature/RFormula.scala --- @@ -62,19 +77,60 @@ class RFormula(override val uid: String) /** @group getParam */ def getFormula: String = $(formula) - /** @group getParam */ - def setFeaturesCol(value: String): this.type = set(featuresCol, value) + override def fit(dataset: DataFrame): RFormulaModel = { + require(parsedFormula.isDefined, "Must call setFormula() first.") + val factorLevels = parsedFormula.get.terms.flatMap { term => + dataset.schema(term) match { + case column if column.dataType == StringType => + val idxTerm = term + "_idx_" + uid + val indexer = new StringIndexer().setInputCol(term).setOutputCol(idxTerm) + Some(term -> indexer.fit(dataset)) + case _ => + None --- End diff -- Done
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org