You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by jkbradley <gi...@git.apache.org> on 2014/09/30 23:37:39 UTC

[GitHub] spark pull request: [SPARK-3751] [mllib] DecisionTree: example upd...

GitHub user jkbradley opened a pull request:

    https://github.com/apache/spark/pull/2604

    [SPARK-3751] [mllib] DecisionTree: example update + print options

    DecisionTreeRunner functionality additions:
    * Allow user to pass in a test dataset
    * Do not print full model if the model is too large.
    
    As part of this, modify DecisionTreeModel and RandomForestModel to allow printing less info.  Proposed updates:
    * toString: prints model summary
    * toDebugString: prints full model (named after RDD.toDebugString)
    
    CC: @mengxr  @chouqin @manishamde @codedeft  Small update (whomever can take a look).  Thanks!

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jkbradley/spark dtrunner-update

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/2604.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2604
    
----
commit e007a952621208df1d2bc891e77d1e08ddc1cdaf
Author: Joseph K. Bradley <jo...@gmail.com>
Date:   2014-09-29T20:57:40Z

    Updated DecisionTreeRunner to accept a test dataset.

commit 22eac8cad5470207193fbf505d6bf3f82b3c1fd2
Author: Joseph K. Bradley <jo...@gmail.com>
Date:   2014-09-30T20:47:30Z

    Merge remote-tracking branch 'upstream/master' into dtrunner-update

commit 1d0d93db6471f02497673a31949885a2cc8feddb
Author: Joseph K. Bradley <jo...@gmail.com>
Date:   2014-09-30T21:27:09Z

    Updated DT and RF to print less when toString is called. Added toDebugString for verbose printing.

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-3751] [mllib] DecisionTree: example upd...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2604#issuecomment-57394723
  
      [QA tests have finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/21067/consoleFull) for   PR 2604 at commit [`1d0d93d`](https://github.com/apache/spark/commit/1d0d93db6471f02497673a31949885a2cc8feddb).
     * This patch **fails** unit tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-3751] [mllib] DecisionTree: example upd...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2604#discussion_r18262076
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/DecisionTreeRunner.scala ---
    @@ -170,16 +176,40 @@ object DecisionTreeRunner {
               val frac = classCounts(c) / numExamples.toDouble
               println(s"$c\t$frac\t${classCounts(c)}")
             }
    -        (examples, numClasses)
    +        (examples, classIndexMap, numClasses)
           }
           case Regression =>
    -        (origExamples, 0)
    +        (origExamples, null, 0)
           case _ =>
             throw new IllegalArgumentException("Algo ${params.algo} not supported.")
         }
     
    -    // Split into training, test.
    -    val splits = examples.randomSplit(Array(1.0 - params.fracTest, params.fracTest))
    +    // Create training, test sets.
    +    val splits = if (params.testInput != "") {
    --- End diff --
    
    I agree, it should, but I'd like to wait for another PR if that's OK.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-3751] [mllib] DecisionTree: example upd...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2604#issuecomment-57422106
  
      [QA tests have started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/21094/consoleFull) for   PR 2604 at commit [`b2b3c60`](https://github.com/apache/spark/commit/b2b3c600f8b66d2c877047faf9e70379339f4d45).
     * This patch merges cleanly.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-3751] [mllib] DecisionTree: example upd...

Posted by manishamde <gi...@git.apache.org>.
Github user manishamde commented on the pull request:

    https://github.com/apache/spark/pull/2604#issuecomment-57395157
  
    LGTM. I have made a general comments for all runners but it might be beyond the scope of this PR.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-3751] [mllib] DecisionTree: example upd...

Posted by manishamde <gi...@git.apache.org>.
Github user manishamde commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2604#discussion_r18252110
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/DecisionTreeRunner.scala ---
    @@ -170,16 +176,40 @@ object DecisionTreeRunner {
               val frac = classCounts(c) / numExamples.toDouble
               println(s"$c\t$frac\t${classCounts(c)}")
             }
    -        (examples, numClasses)
    +        (examples, classIndexMap, numClasses)
           }
           case Regression =>
    -        (origExamples, 0)
    +        (origExamples, null, 0)
           case _ =>
             throw new IllegalArgumentException("Algo ${params.algo} not supported.")
         }
     
    -    // Split into training, test.
    -    val splits = examples.randomSplit(Array(1.0 - params.fracTest, params.fracTest))
    +    // Create training, test sets.
    +    val splits = if (params.testInput != "") {
    --- End diff --
    
    This utility method should probably be in a common utils class and be used by all algorithm runners.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-3751] [mllib] DecisionTree: example upd...

Posted by manishamde <gi...@git.apache.org>.
Github user manishamde commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2604#discussion_r18261804
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/DecisionTreeRunner.scala ---
    @@ -206,32 +236,56 @@ object DecisionTreeRunner {
               minInfoGain = params.minInfoGain)
         if (params.numTrees == 1) {
           val model = DecisionTree.train(training, strategy)
    -      println(model)
    +      if (model.numNodes < 20) {
    +        println(model.toDebugString) // Print full model.
    +      } else {
    +        println(model) // Print model summary.
    +      }
           if (params.algo == Classification) {
    -        val accuracy =
    +        val trainAccuracy =
    +          new MulticlassMetrics(training.map(lp => (model.predict(lp.features), lp.label)))
    +            .precision
    --- End diff --
    
    Nevermind then. :-)


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-3751] [mllib] DecisionTree: example upd...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2604#issuecomment-57421801
  
      [QA tests have started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/21092/consoleFull) for   PR 2604 at commit [`07b1fae`](https://github.com/apache/spark/commit/07b1fae6d8dc51abf44db0d0260383f1a3885761).
     * This patch merges cleanly.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-3751] [mllib] DecisionTree: example upd...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2604#issuecomment-57426168
  
      [QA tests have finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/21092/consoleFull) for   PR 2604 at commit [`07b1fae`](https://github.com/apache/spark/commit/07b1fae6d8dc51abf44db0d0260383f1a3885761).
     * This patch **passes** unit tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-3751] [mllib] DecisionTree: example upd...

Posted by manishamde <gi...@git.apache.org>.
Github user manishamde commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2604#discussion_r18252633
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/DecisionTreeRunner.scala ---
    @@ -206,32 +236,56 @@ object DecisionTreeRunner {
               minInfoGain = params.minInfoGain)
         if (params.numTrees == 1) {
           val model = DecisionTree.train(training, strategy)
    -      println(model)
    +      if (model.numNodes < 20) {
    +        println(model.toDebugString) // Print full model.
    +      } else {
    +        println(model) // Print model summary.
    +      }
           if (params.algo == Classification) {
    -        val accuracy =
    +        val trainAccuracy =
    +          new MulticlassMetrics(training.map(lp => (model.predict(lp.features), lp.label)))
    +            .precision
    --- End diff --
    
    very minor: .precision can probably go in the previous line.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-3751] [mllib] DecisionTree: example upd...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2604#issuecomment-57426315
  
      [QA tests have finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/21094/consoleFull) for   PR 2604 at commit [`b2b3c60`](https://github.com/apache/spark/commit/b2b3c600f8b66d2c877047faf9e70379339f4d45).
     * This patch **passes** unit tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-3751] [mllib] DecisionTree: example upd...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/2604#issuecomment-57394730
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/21067/


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-3751] [mllib] DecisionTree: example upd...

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on the pull request:

    https://github.com/apache/spark/pull/2604#issuecomment-57431357
  
    LGTM. Merged into master. Thanks!


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-3751] [mllib] DecisionTree: example upd...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/2604#issuecomment-57426321
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/21094/


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-3751] [mllib] DecisionTree: example upd...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on the pull request:

    https://github.com/apache/spark/pull/2604#issuecomment-57421830
  
    @manishamde  Thank you for checking the PR!  I updated the Python API and tests to fix the doc test failure.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-3751] [mllib] DecisionTree: example upd...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/2604


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-3751] [mllib] DecisionTree: example upd...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2604#issuecomment-57388054
  
      [QA tests have started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/21067/consoleFull) for   PR 2604 at commit [`1d0d93d`](https://github.com/apache/spark/commit/1d0d93db6471f02497673a31949885a2cc8feddb).
     * This patch merges cleanly.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-3751] [mllib] DecisionTree: example upd...

Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2604#discussion_r18261691
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/DecisionTreeRunner.scala ---
    @@ -206,32 +236,56 @@ object DecisionTreeRunner {
               minInfoGain = params.minInfoGain)
         if (params.numTrees == 1) {
           val model = DecisionTree.train(training, strategy)
    -      println(model)
    +      if (model.numNodes < 20) {
    +        println(model.toDebugString) // Print full model.
    +      } else {
    +        println(model) // Print model summary.
    +      }
           if (params.algo == Classification) {
    -        val accuracy =
    +        val trainAccuracy =
    +          new MulticlassMetrics(training.map(lp => (model.predict(lp.features), lp.label)))
    +            .precision
    --- End diff --
    
    It does not actually fit, but I could rearrange the lines (putting more on the first of the 3 lines) if that is preferred.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-3751] [mllib] DecisionTree: example upd...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/2604#issuecomment-57426171
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/21092/


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org