Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-18036

Decision Trees do not handle edge cases

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2.0
    • Component/s: ML, MLlib
    • Labels:
      None

      Description

      Decision trees/GBT/RF do not handle edge cases such as constant features or empty features. For example:

      val dt = new DecisionTreeRegressor()
      val data = Seq(LabeledPoint(1.0, Vectors.dense(Array.empty[Double]))).toDF()
      dt.fit(data)
      
      java.lang.UnsupportedOperationException: empty.max
        at scala.collection.TraversableOnce$class.max(TraversableOnce.scala:229)
        at scala.collection.mutable.ArrayOps$ofInt.max(ArrayOps.scala:234)
        at org.apache.spark.ml.tree.impl.DecisionTreeMetadata$.buildMetadata(DecisionTreeMetadata.scala:207)
        at org.apache.spark.ml.tree.impl.RandomForest$.run(RandomForest.scala:105)
        at org.apache.spark.ml.regression.DecisionTreeRegressor.train(DecisionTreeRegressor.scala:93)
        at org.apache.spark.ml.regression.DecisionTreeRegressor.train(DecisionTreeRegressor.scala:46)
        at org.apache.spark.ml.Predictor.fit(Predictor.scala:90)
        ... 52 elided
      
      

      as well as

      val dt = new DecisionTreeRegressor()
      val data = Seq(LabeledPoint(1.0, Vectors.dense(0.0, 0.0, 0.0))).toDF()
      dt.fit(data)
      
      java.lang.UnsupportedOperationException: empty.maxBy
      at scala.collection.TraversableOnce$class.maxBy(TraversableOnce.scala:236)
      at scala.collection.SeqViewLike$AbstractTransformed.maxBy(SeqViewLike.scala:37)
      at org.apache.spark.ml.tree.impl.RandomForest$.binsToBestSplit(RandomForest.scala:846)
      

        Attachments

          Activity

            People

            • Assignee:
              imatiach Ilya Matiach
              Reporter:
              sethah Seth Hendrickson
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: