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和數據是完全相同的分佈,是不是?爲什麼會被拒絕?我在做什麼/做錯了什麼?