You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2021/09/26 23:08:49 UTC
[commons-math] 02/03: MATH-1462: Reproduce the infinite quantile bug
This is an automated email from the ASF dual-hosted git repository.
erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git
commit d4de59a15a73e585ae74481bd1fb1265286d3955
Author: Maciej Kwidzinski <mk...@atlassian.com>
AuthorDate: Fri Sep 17 13:58:19 2021 +0200
MATH-1462: Reproduce the infinite quantile bug
---
.../distribution/EmpiricalDistributionTest.java | 24 ++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/distribution/EmpiricalDistributionTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/distribution/EmpiricalDistributionTest.java
index b51a8ec..4f26e4e 100644
--- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/distribution/EmpiricalDistributionTest.java
+++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/distribution/EmpiricalDistributionTest.java
@@ -474,4 +474,28 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
v = ed.inverseCumulativeProbability(p);
Assert.assertTrue("p=" + p + " => v=" + v, v < 6350);
}
+
+ @Test
+ public void testMath1462InfiniteQuantile() {
+ final double[] data = {
+ 18054, 17548, 17350, 17860, 17827, 17653, 18113, 18405, 17746,
+ 17647, 18160, 17955, 17705, 17890, 17974, 17857, 13287, 18645,
+ 17775, 17730, 17996, 18263, 17861, 17161, 17717, 18134, 18669,
+ 18340, 17221, 18292, 18146, 17520, 18207, 17829, 18206, 13301,
+ 18257, 17626, 18358, 18340, 18320, 17852, 17804, 17577, 17718,
+ 18099, 13395, 17763, 17911, 17978, 12935, 17519, 17550, 18728,
+ 18518, 17698, 18739, 18553, 17982, 18113, 17974, 17961, 17645,
+ 17867, 17890, 17498, 18718, 18191, 18177, 17923, 18164, 18155,
+ 6212, 5961, 711
+ };
+
+ final EmpiricalDistribution ed = EmpiricalDistribution.from(1000, data);
+
+ double v;
+ double p;
+
+ p = 0.32;
+ v = ed.inverseCumulativeProbability(p);
+ Assert.assertTrue("p=" + p + " => v=" + v, Double.isFinite(v));
+ }
}