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

    https://github.com/apache/spark/pull/20786#discussion_r175959353
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/tree/treeModels.scala ---
    @@ -212,15 +212,13 @@ private[ml] object TreeEnsembleModel {
       def computeFeatureImportance(
           node: Node,
           importances: OpenHashMap[Int, Double]): Unit = {
    -    node match {
    -      case n: InternalNode =>
    -        val feature = n.split.featureIndex
    -        val scaledGain = n.gain * n.impurityStats.count
    -        importances.changeValue(feature, scaledGain, _ + scaledGain)
    -        computeFeatureImportance(n.leftChild, importances)
    -        computeFeatureImportance(n.rightChild, importances)
    -      case n: LeafNode =>
    -      // do nothing
    +    if (node.isInstanceOf[InternalNode]) {
    --- End diff --
    
    Why change this?  It may be better to use match-case since that will give 
warnings if we ever add new types of nodes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to