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

    https://github.com/apache/spark/pull/10355#discussion_r47933490
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/ml/classification/DecisionTreeClassifierSuite.scala
 ---
    @@ -275,6 +274,40 @@ class DecisionTreeClassifierSuite extends 
SparkFunSuite with MLlibTestSparkConte
         val model = dt.fit(df)
       }
     
    +  test("DecisionTree should support all NumericType labels") {
    +    val dfWithIntLabels = 
TreeTests.setMetadata(sqlContext.createDataFrame(Seq(
    +      (0, Vectors.dense(0, 2, 3)),
    +      (1, Vectors.dense(0, 3, 1)),
    +      (0, Vectors.dense(0, 2, 2)),
    +      (1, Vectors.dense(0, 3, 9)),
    +      (0, Vectors.dense(0, 2, 6))
    +    )).toDF("label", "features"), 2)
    +
    +    val dfWithFloatLabels = 
TreeTests.setMetadata(sqlContext.createDataFrame(Seq(
    +      (0f, Vectors.dense(0, 2, 3)),
    +      (1f, Vectors.dense(0, 3, 1)),
    +      (0f, Vectors.dense(0, 2, 2)),
    +      (1f, Vectors.dense(0, 3, 9)),
    +      (0f, Vectors.dense(0, 2, 6))
    +    )).toDF("label", "features"), 2)
    +
    +    val dfWithLongLabels = 
TreeTests.setMetadata(sqlContext.createDataFrame(Seq(
    +      (0L, Vectors.dense(0, 2, 3)),
    +      (1L, Vectors.dense(0, 3, 1)),
    +      (0L, Vectors.dense(0, 2, 2)),
    +      (1L, Vectors.dense(0, 3, 9)),
    +      (0L, Vectors.dense(0, 2, 6))
    +    )).toDF("label", "features"), 2)
    +
    +    val dt = new DecisionTreeClassifier()
    +      .setLabelCol("label")
    +      .setFeaturesCol("features")
    +
    +    dt.fit(dfWithIntLabels)
    +    dt.fit(dfWithFloatLabels)
    +    dt.fit(dfWithLongLabels)
    +  }
    --- End diff --
    
    I'm not sure it's not clear what this test is checking for. It looks like 
it just checks that no errors are thrown during training the tree. Maybe we 
should train a tree with a data frame with `DoubleType` as the column and check 
equality between training trees with other label column types?
    
    ```scala
    val doubleModel = dt.fit(dfWithDoubleLabels)
    val intModel = dt.fit(dfWithIntLabels)
    TreeTests.checkEqual(doubleModel, intModel)
    ```


---
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.
---

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

Reply via email to