[GitHub] spark pull request #18868: [SPARK-21638][ML]Fix RF/GBT Warning message error

2017-08-10 Thread asfgit
Github user asfgit closed the pull request at:

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


---
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 #18868: [SPARK-21638][ML]Fix RF/GBT Warning message error

2017-08-07 Thread srowen
Github user srowen commented on a diff in the pull request:

https://github.com/apache/spark/pull/18868#discussion_r131613912
  
--- Diff: 
mllib/src/main/scala/org/apache/spark/ml/tree/impl/RandomForest.scala ---
@@ -1107,9 +1108,11 @@ private[spark] object RandomForest extends Logging {
 mutableTreeToNodeToIndexInfo
   .getOrElseUpdate(treeIndex, new mutable.HashMap[Int, 
NodeIndexInfo]())(node.id)
   = new NodeIndexInfo(numNodesInGroup, featureSubset)
+numNodesInGroup += 1
+memUsage += nodeMemUsage
+  } else {
+flag = false
--- End diff --

Yeah that's fine, it makes sense.


---
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 #18868: [SPARK-21638][ML]Fix RF/GBT Warning message error

2017-08-07 Thread mpjlu
Github user mpjlu commented on a diff in the pull request:

https://github.com/apache/spark/pull/18868#discussion_r131605981
  
--- Diff: 
mllib/src/main/scala/org/apache/spark/ml/tree/impl/RandomForest.scala ---
@@ -1107,9 +1108,11 @@ private[spark] object RandomForest extends Logging {
 mutableTreeToNodeToIndexInfo
   .getOrElseUpdate(treeIndex, new mutable.HashMap[Int, 
NodeIndexInfo]())(node.id)
   = new NodeIndexInfo(numNodesInGroup, featureSubset)
+numNodesInGroup += 1
+memUsage += nodeMemUsage
+  } else {
+flag = false
--- End diff --

We cannot clear stack here, because the nodes in the stack are used for all 
iteration. 
Native scala doesn't support break, we have to import other package to use 
break, seems not necessary. 
We cannot use nodeStack.pop at the top, because we don't know whether it 
can be grouped here.
How about change "flag" to "groupDone" means Group is done, don't need to 
loop again.


---
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 #18868: [SPARK-21638][ML]Fix RF/GBT Warning message error

2017-08-07 Thread srowen
Github user srowen commented on a diff in the pull request:

https://github.com/apache/spark/pull/18868#discussion_r131603462
  
--- Diff: 
mllib/src/main/scala/org/apache/spark/ml/tree/impl/RandomForest.scala ---
@@ -1107,9 +1108,11 @@ private[spark] object RandomForest extends Logging {
 mutableTreeToNodeToIndexInfo
   .getOrElseUpdate(treeIndex, new mutable.HashMap[Int, 
NodeIndexInfo]())(node.id)
   = new NodeIndexInfo(numNodesInGroup, featureSubset)
+numNodesInGroup += 1
+memUsage += nodeMemUsage
+  } else {
+flag = false
--- End diff --

"flag" isn't that descriptive. What about simply clearing the stack to make 
the loop terminate naturally? or a break?

Actually can the loop just use `nodeStack.pop()` at the top? it isn't 
necessary to peek at it with top and then later decide to pop. It can be 
removed no matter what.


---
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 #18868: [SPARK-21638][ML]Fix RF/GBT Warning message error

2017-08-07 Thread mpjlu
GitHub user mpjlu opened a pull request:

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

[SPARK-21638][ML]Fix RF/GBT Warning message error

## What changes were proposed in this pull request?

When train RF model, there are many warning messages like this:

> WARN  RandomForest: Tree learning is using approximately 268492800 bytes 
per iteration, which exceeds requested limit maxMemoryUsage=268435456. This 
allows splitting 2622 nodes in this iteration.

This warning message is unnecessary and the data is not accurate.

Actually, if all the nodes cannot split in one iteration, it will show this 
warning. For most of the case, all the nodes cannot split just in one 
iteration, so for most of the case, it will show this warning for each 
iteration.

## How was this patch tested?
The existing UT


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

$ git pull https://github.com/mpjlu/spark fixRFwarning

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

https://github.com/apache/spark/pull/18868.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 #18868


commit f15f35e53115babd48357ec256f81e92e3480a6e
Author: Peng Meng 
Date:   2017-08-07T08:05:24Z

fix RF warning




---
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