[GitHub] spark pull request #16264: [SPARK-18793] [SPARK-18794] [R] add spark.randomF...
Github user asfgit closed the pull request at: https://github.com/apache/spark/pull/16264 --- 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
[GitHub] spark pull request #16264: [SPARK-18793] [SPARK-18794] [R] add spark.randomF...
Github user mengxr commented on a diff in the pull request: https://github.com/apache/spark/pull/16264#discussion_r92257313 --- Diff: R/pkg/vignettes/sparkr-vignettes.Rmd --- @@ -526,6 +530,34 @@ gaussianFitted <- predict(gaussianGLM, carsDF) head(select(gaussianFitted, "model", "prediction", "mpg", "wt", "hp")) ``` + Random Forest + +`spark.randomForest` fits a [random forest](https://en.wikipedia.org/wiki/Random_forest) classification or regression model on a `SparkDataFrame`. +Users can call `summary` to get a summary of the fitted model, `predict` to make predictions, and `write.ml`/`read.ml` to save/load fitted models. + +In the following example, we use the `longley` dataset to train a random forest and make predictions: + +```{r} --- End diff -- updated --- 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
[GitHub] spark pull request #16264: [SPARK-18793] [SPARK-18794] [R] add spark.randomF...
Github user mengxr commented on a diff in the pull request: https://github.com/apache/spark/pull/16264#discussion_r92257291 --- Diff: R/pkg/vignettes/sparkr-vignettes.Rmd --- @@ -539,7 +539,7 @@ In the following example, we use the `longley` dataset to train a random forest ```{r} df <- createDataFrame(longley) -rfModel <- spark.randomForest(df, Employed ~ ., type = "regression", numTrees = 5) +rfModel <- spark.randomForest(df, Employed ~ ., type = "regression", maxDepth = 2, numTrees = 2) --- End diff -- The current length of the output seems fine (<40 lines). --- 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
[GitHub] spark pull request #16264: [SPARK-18793] [SPARK-18794] [R] add spark.randomF...
Github user felixcheung commented on a diff in the pull request: https://github.com/apache/spark/pull/16264#discussion_r92112001 --- Diff: R/pkg/vignettes/sparkr-vignettes.Rmd --- @@ -539,7 +539,7 @@ In the following example, we use the `longley` dataset to train a random forest ```{r} df <- createDataFrame(longley) -rfModel <- spark.randomForest(df, Employed ~ ., type = "regression", numTrees = 5) +rfModel <- spark.randomForest(df, Employed ~ ., type = "regression", maxDepth = 2, numTrees = 2) --- End diff -- you could also do this to limit output ```{r, include=FALSE} ops <- options() options(max.print=40) ``` there is another example in the vignettes --- 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