2
我正在通过示例HypothesisTestingKolmogorovSmirnovTestExample.scala查看spark,并且似乎无法找出CDF方面。Spark mllib.stat.Statistics - kolmogorovSmirnovTest CDF
他们的榜样:
import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.mllib.stat.Statistics
import org.apache.spark.rdd.RDD
val data: RDD[Double] = sc.parallelize(Seq(0.1, 0.15, 0.2, 0.3, 0.25)) // an RDD of sample data
val myCDF = Map(0.1 -> 0.2, 0.15 -> 0.6, 0.2 -> 0.05, 0.3 -> 0.05, 0.25 -> 0.1)
val testResult2 = Statistics.kolmogorovSmirnovTest(data, myCDF)
println(testResult2)
这将返回:
Very strong presumption against null hypothesis: Sample follows theoretical distribution.
这是有道理的 - 什么不就是当我试图把它不拒绝零:
val data: RDD[Double] = sc.parallelize(Seq(0.1, 0.15, 0.2, 0.3, 0.25)) // an RDD of sample data
val myCDF = Map(0.1 -> 0.1, 0.15 -> 0.15, 0.2 -> 0.2, 0.3 -> 0.3, 0.25 -> 0.25) //CDF matching the data distribution
val testResult2 = Statistics.kolmogorovSmirnovTest(data, myCDF)
println(testResult2)
This ALSO returns:
Very strong presumption against null hypothesis: Sample follows theoretical distribution.
什么给了? CDF和数据是完全相同的分布,是不是?为什么会被拒绝?我在做什么/做错了什么?