Skip to content

Commit

Permalink
fix RF warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Peng Meng committed Aug 7, 2017
1 parent e08d06b commit f15f35e
Showing 1 changed file with 6 additions and 3 deletions.
Expand Up @@ -1089,7 +1089,8 @@ private[spark] object RandomForest extends Logging {
var numNodesInGroup = 0
// If maxMemoryInMB is set very small, we want to still try to split 1 node,
// so we allow one iteration if memUsage == 0.
while (nodeStack.nonEmpty && (memUsage < maxMemoryUsage || memUsage == 0)) {
var flag = true
while (nodeStack.nonEmpty && flag) {
val (treeIndex, node) = nodeStack.top
// Choose subset of features for node (if subsampling).
val featureSubset: Option[Array[Int]] = if (metadata.subsamplingFeatures) {
Expand All @@ -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
}
numNodesInGroup += 1
memUsage += nodeMemUsage
}
if (memUsage > maxMemoryUsage) {
// If maxMemoryUsage is 0, we should still allow splitting 1 node.
Expand Down

0 comments on commit f15f35e

Please sign in to comment.