diff options
author | Yanbo Liang <ybliang8@gmail.com> | 2016-10-11 12:41:35 -0700 |
---|---|---|
committer | Joseph K. Bradley <joseph@databricks.com> | 2016-10-11 12:41:35 -0700 |
commit | 23405f324a8089f86ebcbede9bb32944137508e8 (patch) | |
tree | 4f413126dada2746cbdfd75457eb1a8a765f12f8 /mllib/src/main | |
parent | 07508bd01d16f3331be167ff92770d19c8b1f46a (diff) | |
download | spark-23405f324a8089f86ebcbede9bb32944137508e8.tar.gz spark-23405f324a8089f86ebcbede9bb32944137508e8.tar.bz2 spark-23405f324a8089f86ebcbede9bb32944137508e8.zip |
[SPARK-15153][ML][SPARKR] Fix SparkR spark.naiveBayes error when label is numeric type
## What changes were proposed in this pull request?
Fix SparkR ```spark.naiveBayes``` error when response variable of dataset is numeric type.
See details and how to reproduce this bug at [SPARK-15153](https://issues.apache.org/jira/browse/SPARK-15153).
## How was this patch tested?
Add unit test.
Author: Yanbo Liang <ybliang8@gmail.com>
Closes #15431 from yanboliang/spark-15153-2.
Diffstat (limited to 'mllib/src/main')
-rw-r--r-- | mllib/src/main/scala/org/apache/spark/ml/r/NaiveBayesWrapper.scala | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/ml/r/NaiveBayesWrapper.scala b/mllib/src/main/scala/org/apache/spark/ml/r/NaiveBayesWrapper.scala index d1a39fea76..4fdab2dd94 100644 --- a/mllib/src/main/scala/org/apache/spark/ml/r/NaiveBayesWrapper.scala +++ b/mllib/src/main/scala/org/apache/spark/ml/r/NaiveBayesWrapper.scala @@ -59,6 +59,7 @@ private[r] object NaiveBayesWrapper extends MLReadable[NaiveBayesWrapper] { def fit(formula: String, data: DataFrame, smoothing: Double): NaiveBayesWrapper = { val rFormula = new RFormula() .setFormula(formula) + .setForceIndexLabel(true) RWrapperUtils.checkDataColumns(rFormula, data) val rFormulaModel = rFormula.fit(data) // get labels and feature names from output schema |