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

    https://github.com/apache/spark/pull/20632#discussion_r169736202
  
    --- 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 --
    
    Imagine a full binary tree of 2 levels (7 nodes) with all identical 
predictions. It can be pruned down to one node, the root. But I think this 
logic would only prune the lowest level of nodes. Right? you're matching on 
nodes that have `LeafNode` children only.


---

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

Reply via email to