在 Python 中使用 3D 数据实施 2 样本 KS 测试

Implementing a 2-sample KS test with 3D data in Python

我有两个 3D 分布,我想 运行 一个 Kolmogorov–Smirnov test on these two samples to measure their similarity. scipy.stats has an implementation of a 2-sample K-S tests implemented in 1 dimension and I found an implementation in 2 dimensions,但是 none 3 维(或 N 维)。

有人可以为 3D 分布实现 2 个样本的 K-S 检验吗?

KS 测试不容易泛化到多个维度;参见 the Wikipedia article on the KS test on that question。即使您可以找到或创建合适的泛化,我想知道您是否真的想这样做,因为显着性检验通常对大型数据集毫无用处。

如果您想量化分布之间的差异,我的建议是考虑基于熵的量,例如互信息或 Kullback-Leibler 散度。

也许你可以在这里详细说明你的目标是什么。