在Apache Spark中结合approxQuantile的双样本KS检验
Two-sample KS test with approxQuantile in Apache Spark
AI总结:
针对大数据下双样本KS检验需全量排序的难题,基于Apache Spark的approxQuantile方法提出用ε-近似分位数构建近似CDF的KS检验变体,推导了误差界,实现简洁高效。
摘要:
经典的柯尔莫哥洛夫-斯米尔诺夫(Kolmogorov-Smirnov,KS)双样本检验被广泛用于检验经验样本是否来自同一分布。尽管大多数统计软件包都提供了该检验的实现,但在大数据场景下执行该检验颇具挑战性,因为它需要对数据进行全量排序。流行的大数据处理系统Apache Spark提供了单样本KS检验,但未提供双样本版本。此外,近期的Spark版本提供了approxQuantile方法,用于查询ε-近似分位数。我们以approxQuantile为基础,提出了经典KS双样本检验的一种变体,该方法通过ε-近似分位数构建近似累积分布函数(CDF)。我们推导了近似CDF的误差界,并说明了如何利用该信息执行KS检验。该方法的伪代码仅需15行可执行代码,Python实现见附录。
英文摘要:
The classical two-sample test of Kolmogorov-Smirnov (KS) is widely used to test whether empirical samples come from the same distribution. Even though most statistical packages provide an implementation, carrying out the test in big data settings can be challenging because it requires a full sort of the data. The popular Apache Spark system for big data processing provides a 1-sample KS test, but not the 2-sample version. Moreover, recent Spark versions provide the approxQuantile method for querying $ε$-approximate quantiles. We build on approxQuantile to propose a variation of the classical Kolmogorov-Smirnov two-sample test that constructs approximate cumulative distribution functions (CDF) from $ε$-approximate quantiles. We derive error bounds of the approximate CDF and show how to use this information to carry out KS tests. Psuedocode for the approach requires 15 executable lines. A Python implementation appears in the appendix.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。