Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1673#discussion_r15628444
  
    --- Diff: mllib/src/main/scala/org/apache/spark/mllib/tree/model/Node.scala 
---
    @@ -91,4 +91,59 @@ class Node (
           }
         }
       }
    +
    +  /**
    +   * Get number of nodes in tree from this node, including leaf nodes.
    +   */
    +  def numNodesRecursive: Int = {
    +    if (isLeaf) {
    +      1
    +    } else {
    +      1 + leftNode.get.numNodesRecursive + rightNode.get.numNodesRecursive
    +    }
    +  }
    +
    +  /**
    +   * Get depth of tree from this node.
    +   * E.g.: Depth 0 means this is a leaf node.
    +   */
    +  def depthRecursive: Int = {
    --- End diff --
    
    `subtreeDepth`?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to