-
- Downloads
[SPARK-20307][SPARKR] SparkR: pass on setHandleInvalid to spark.mllib...
[SPARK-20307][SPARKR] SparkR: pass on setHandleInvalid to spark.mllib functions that use StringIndexer ## What changes were proposed in this pull request? For randomForest classifier, if test data contains unseen labels, it will throw an error. The StringIndexer already has the handleInvalid logic. The patch add a new method to set the underlying StringIndexer handleInvalid logic. This patch should also apply to other classifiers. This PR focuses on the main logic and randomForest classifier. I will do follow-up PR for other classifiers. ## How was this patch tested? Add a new unit test based on the error case in the JIRA. Author: wangmiao1981 <wm624@hotmail.com> Closes #18496 from wangmiao1981/handle.
Showing
- R/pkg/R/mllib_tree.R 9 additions, 2 deletionsR/pkg/R/mllib_tree.R
- R/pkg/tests/fulltests/test_mllib_tree.R 17 additions, 0 deletionsR/pkg/tests/fulltests/test_mllib_tree.R
- mllib/src/main/scala/org/apache/spark/ml/feature/RFormula.scala 25 additions, 0 deletions...src/main/scala/org/apache/spark/ml/feature/RFormula.scala
- mllib/src/main/scala/org/apache/spark/ml/r/RandomForestClassificationWrapper.scala 3 additions, 1 deletion...apache/spark/ml/r/RandomForestClassificationWrapper.scala
- mllib/src/test/scala/org/apache/spark/ml/feature/StringIndexerSuite.scala 1 addition, 1 deletion...cala/org/apache/spark/ml/feature/StringIndexerSuite.scala
Please register or sign in to comment