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

    https://github.com/apache/spark/pull/20632#discussion_r169735198
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/tree/Node.scala ---
    @@ -287,6 +291,34 @@ private[tree] class LearningNode(
         }
       }
     
    +  /**
    +   * @return true iff the node is a leaf.
    +   */
    +  private def isLeafNode(): Boolean = leftChild.isEmpty && 
rightChild.isEmpty
    +
    +  // the set of (leaf) predictions appearing in the subtree rooted at the 
given node.
    +  private lazy val leafPredictions: Set[Double] = {
    --- End diff --
    
    What other cases are there that I'm missing? For one thing, the current 
tests pass with this change. 
    
    This will prune a subtree of arbitrary depth that has a single distinct 
prediction in its leaf nodes.


---

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

Reply via email to