Uh oh!
There was an error while loading. Please reload this page.
[SPARK-15767][R][ML] Decision Tree Regression wrapper in SparkR - #13690
[SPARK-15767][R][ML] Decision Tree Regression wrapper in SparkR#13690vectorijk wants to merge 7 commits into
Conversation
SparkQA
commented
Jun 15, 2016
Test build #60600 has finished for PR 13690 at commit
|
SparkQA
commented
Jun 22, 2016
Test build #61050 has finished for PR 13690 at commit
|
felixcheung
commented
Aug 11, 2016
Hi @vectorijk would you be interested in continuing this work? |
vectorijk
commented
Aug 14, 2016
Yes, sure. But I'm in a vacation this week. I will keep working on this and On Thu, Aug 11, 2016, 19:46 Felix Cheung notifications@github.com wrote:
|
felixcheung
commented
Aug 17, 2016
Great! based on earlier discussions we might want to call this |
ping @vectorijk Have you started working on the random forest wrapper. If not and you feel busy, I can also work on that :) |
junyangq
commented
Aug 22, 2016
Also, if you need any help with this PR, just let me know and we may work together to make it. |
vectorijk
commented
Aug 23, 2016
@junyangq I have started working on random forest wrapper. I will open PR as soon as possible. Also, I'll update this PR very soon. Thanks. |
junyangq
commented
Aug 23, 2016
Sounds great. Thank you @vectorijk |
378607f to
f8b3484CompareSparkQA
commented
Sep 1, 2016
Test build #64777 has finished for PR 13690 at commit
|
SparkQA
commented
Sep 1, 2016
Test build #64776 has finished for PR 13690 at commit
|
shivaram
commented
Sep 3, 2016
@vectorijk Is this ready for another round of review ? |
felixcheung
commented
Sep 23, 2016
@vectorijk hi - would you have time to update this? |
felixcheung
commented
Sep 29, 2016
hi @vectorijk - would you have time to update this? If not, I will try to follow up basing on your work. |
vectorijk
commented
Sep 29, 2016
@felixcheung I'll update the changes in this two days. |
There was a problem hiding this comment.
I think this has been updated to use an internal function - could you check?
felixcheung
commented
Sep 29, 2016
Thanks! Aside from having to rebase, there are some left over of "spark.rpart", a few some changes and also would be great to add tests for this. |
2835a7a to
b18b718CompareSparkQA
commented
Oct 6, 2016
Test build #66438 has finished for PR 13690 at commit
|
SparkQA
commented
Oct 6, 2016
Test build #66442 has finished for PR 13690 at commit
|
SparkQA
commented
Oct 6, 2016
Test build #66448 has finished for PR 13690 at commit
|
vectorijk
commented
Oct 6, 2016
@felixcheung@shivaram@junyangq It's ready for the review. |
felixcheung
commented
Oct 7, 2016
could you fix the test failure? |
| #' @seealso \link{spark.als}, \link{spark.gaussianMixture}, \link{spark.isoreg}, \link{spark.kmeans}, | ||
| #' @seealso \link{spark.lda}, \link{spark.mlp}, \link{spark.naiveBayes}, \link{spark.survreg} | ||
| #' @seealso \link{spark.lda}, \link{spark.mlp}, \link{spark.naiveBayes}, \link{spark.survreg}, | ||
| #' @seealso \link{spark.decisionTree}, |
| #' @seealso \link{spark.glm}, \link{glm}, | ||
| #' @seealso \link{spark.als}, \link{spark.gaussianMixture}, \link{spark.isoreg}, \link{spark.kmeans}, | ||
| #' @seealso \link{spark.mlp}, \link{spark.naiveBayes}, \link{spark.survreg} | ||
| #' @seealso \link{spark.mlp}, \link{spark.naiveBayes}, \link{spark.survreg}, \link{spark.decisionTree} |
| setMethod("spark.decisionTree", signature(data = "SparkDataFrame", formula = "formula"), | ||
| function(data, formula, type = c("regression", "classification"), | ||
| maxDepth = 5, maxBins = 32 ) { | ||
| formula <- paste(deparse(formula), collapse = "") |
There was a problem hiding this comment.
use match.arg to check type?
https://stat.ethz.ch/R-manual/R-devel/library/base/html/match.arg.html
| test_that("spark.decisionTree Regression", { | ||
| data <- suppressWarnings(createDataFrame(longley)) | ||
| model <- spark.decisionTree(data, Employed~., "regression", maxDepth = 5, maxBins = 16) |
There was a problem hiding this comment.
could be more readable as Employed ~ . (with spaces)
There was a problem hiding this comment.
addressed comments above
SparkQA
commented
Oct 8, 2016
Test build #66567 has finished for PR 13690 at commit
|
| }) | ||
| test_that("spark.decisionTree Regression", { | ||
| data <- suppressWarnings(createDataFrame(longley)) |
There was a problem hiding this comment.
please add a test for print (see spark.glm)
| #' a SparkDataFrame. Users can call \code{summary} to get a summary of the fitted Decision Tree | ||
| #' model, \code{predict} to make predictions on new data, and \code{write.ml}/\code{read.ml} to | ||
| #' save/load fitted models. | ||
| #' For more details, see \href{https://en.wikipedia.org/wiki/Decision_tree_learning}{Decision Tree} |
There was a problem hiding this comment.
could you point this url to the Spark programming guide, like http://spark.apache.org/docs/latest/ml-classification-regression.html
| #' @param data a SparkDataFrame for training. | ||
| #' @param formula a symbolic description of the model to be fitted. Currently only a few formula | ||
| #' operators are supported, including '~', ':', '+', and '-'. | ||
| #' @param type type of model to fit |
There was a problem hiding this comment.
please add the types supported, eg. one of "regression" or "classification" as the type of model
| #' | ||
| #' # fit a Decision Tree Regression Model | ||
| #' model <- spark.decisionTree(data, Employed ~ ., type = "regression", maxDepth = 5, maxBins = 16) | ||
| #' |
There was a problem hiding this comment.
Could we add an example for "classification" too?
| #' @note spark.decisionTree since 2.1.0 | ||
| setMethod("spark.decisionTree", signature(data = "SparkDataFrame", formula = "formula"), | ||
| function(data, formula, type = c("regression", "classification"), | ||
| maxDepth = 5, maxBins = 32 ) { |
| #' Save the Decision Tree Classification model to the input path. | ||
| #' | ||
| #' @param object A fitted Decision tree classification model |
There was a problem hiding this comment.
could you check the output doc by running create-doc.sh - I think this will duplicate the object when the @rdname is changed - in that case, just have one instance of this and say "regression or classification model"
| #' which means throw exception if the output path exists. | ||
| #' | ||
| #' @aliases write.ml,DecisionTreeClassificationModel,character-method | ||
| #' @rdname spark.decisionTreeClassification |
There was a problem hiding this comment.
change to @rdname spark.decisionTree
| #' @export | ||
| #' @note summary(DecisionTreeRegressionModel) since 2.1.0 | ||
| setMethod("summary", signature(object = "DecisionTreeRegressionModel"), | ||
| function(object, ...) { |
There was a problem hiding this comment.
do not put ... in signature here
| val rFormula = new RFormula() | ||
| .setFormula(formula) | ||
| .setFeaturesCol("features") |
There was a problem hiding this comment.
could you take a look at another model wrapper (like NaiveBayesWrapper) and RWrapperUtils on how to handle DataFrame column name - this shouldn't be hardcoded here?
| val rFormula = new RFormula() | ||
| .setFormula(formula) | ||
| .setFeaturesCol("features") |
| #' @export | ||
| #' @note summary(DecisionTreeClassificationModel) since 2.1.0 | ||
| setMethod("summary", signature(object = "DecisionTreeClassificationModel"), | ||
| function(object, ...) { |
shivaram
commented
Nov 10, 2016
@felixcheung@vectorijk Should we close this PR ? |
vectorijk
commented
Nov 11, 2016
@shivaram I will update this today. |
HyukjinKwon
commented
Nov 29, 2016
gentle ping @vectorijk |
Closesapache#15736Closesapache#16309Closesapache#16485Closesapache#16502Closesapache#16196Closesapache#16498Closesapache#12380Closesapache#16764Closesapache#14394Closesapache#14204Closesapache#14027Closesapache#13690Closesapache#16279 Author: Sean Owen <sowen@cloudera.com> Closesapache#16778 from srowen/CloseStalePRs.
What changes were proposed in this pull request?
Implement a wrapper in SparkR to support decision tree regression. R's naive Decision Tree Regression implementation is from package rpart with signature
rpart(formula, dataframe, method="anova"). I propose we could implement API likespark.rpart(dataframe, formula, ...). After having implemented decision tree classification, we could refactor this two into an API more likerpart().How was this patch tested?
Test with unit test in SparkR