Skip to content

Commit

Permalink
for loop to While loop
Browse files Browse the repository at this point in the history
  • Loading branch information
techaddict committed Apr 23, 2014
1 parent 0a6d8e9 commit 07a4f6b
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ class DecisionTree (private val strategy: Strategy) extends Serializable with Lo
parentImpurities: Array[Double],
filters: Array[List[Filter]]): Unit = {
// 0 corresponds to the left child node and 1 corresponds to the right child node.
// TODO: Convert to while loop
for (i <- 0 to 1) {
var i = 0
while (i <= 1) {
// Calculate the index of the node from the node level and the index at the current level.
val nodeIndex = scala.math.pow(2, level + 1).toInt - 1 + 2 * index + i
if (level < maxDepth - 1) {
Expand All @@ -164,6 +164,7 @@ class DecisionTree (private val strategy: Strategy) extends Serializable with Lo
logDebug("Filter = " + filter)
}
}
i += 1
}
}
}
Expand Down

0 comments on commit 07a4f6b

Please sign in to comment.