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

    https://github.com/apache/spark/pull/15212#discussion_r93726320
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/mllib/feature/ChiSqSelectorSuite.scala ---
    @@ -27,61 +27,240 @@ class ChiSqSelectorSuite extends SparkFunSuite with 
MLlibTestSparkContext {
     
       /*
        *  Contingency tables
    -   *  feature0 = {8.0, 0.0}
    +   *  feature0 = {6.0, 0.0, 8.0}
        *  class  0 1 2
    -   *    8.0||1|0|1|
    -   *    0.0||0|2|0|
    +   *    6.0||1|0|0|
    +   *    0.0||0|3|0|
    +   *    8.0||0|0|2|
    +   *  degree of freedom = 4, statistic = 12, pValue = 0.017
        *
        *  feature1 = {7.0, 9.0}
        *  class  0 1 2
        *    7.0||1|0|0|
    -   *    9.0||0|2|1|
    +   *    9.0||0|3|2|
    +   *  degree of freedom = 2, statistic = 6, pValue = 0.049
        *
    -   *  feature2 = {0.0, 6.0, 8.0, 5.0}
    +   *  feature2 = {0.0, 6.0, 3.0, 8.0}
        *  class  0 1 2
        *    0.0||1|0|0|
    -   *    6.0||0|1|0|
    +   *    6.0||0|1|2|
    +   *    3.0||0|1|0|
        *    8.0||0|1|0|
    -   *    5.0||0|0|1|
    +   *  degree of freedom = 6, statistic = 8.66, pValue = 0.193
    +   *
    +   *  feature3 = {7.0, 0.0, 5.0, 4.0}
    +   *  class  0 1 2
    +   *    7.0||1|0|0|
    +   *    0.0||0|2|0|
    +   *    5.0||0|1|1|
    +   *    4.0||0|0|1|
    +   *  degree of freedom = 6, statistic = 9.5, pValue = 0.147
    +   *
    +   *  feature4 = {6.0, 5.0, 4.0, 0.0}
    +   *  class  0 1 2
    +   *    6.0||1|1|0|
    +   *    5.0||0|2|0|
    +   *    4.0||0|0|1|
    +   *    0.0||0|0|1|
    +   *  degree of freedom = 6, statistic = 8.0, pValue = 0.238
    +   *
    +   *  feature5 = {0.0, 9.0, 5.0, 4.0}
    +   *  class  0 1 2
    +   *    0.0||1|0|1|
    +   *    9.0||0|1|0|
    +   *    5.0||0|1|0|
    +   *    4.0||0|1|1|
    +   *  degree of freedom = 6, statistic = 5, pValue = 0.54
        *
        *  Use chi-squared calculator from Internet
        */
     
    -  test("ChiSqSelector transform test (sparse & dense vector)") {
    +  test("ChiSqSelector transform by KBest test (sparse & dense vector)") {
         val labeledDiscreteData = sc.parallelize(
    --- End diff --
    
    Many test functions need ```labeledDiscreteData```, we can refactor it out 
of the function and make other functions shared the same dataset instance.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to