commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject [2/2] [math] [MATH-839] Renamed cumulativeProbability(double, double) to probability(double, double) in IntegerDistribution and RealDistribution. Thanks to Gilles.
Date Wed, 25 Feb 2015 20:44:04 GMT
[MATH-839] Renamed cumulativeProbability(double, double) to probability(double, double) in
IntegerDistribution and RealDistribution. Thanks to Gilles.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/3fd9cf17
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/3fd9cf17
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/3fd9cf17

Branch: refs/heads/master
Commit: 3fd9cf1753a24587ee9d64d2133784adaa099219
Parents: 0351963
Author: Thomas Neidhart <thomas.neidhart@gmail.com>
Authored: Wed Feb 25 21:43:34 2015 +0100
Committer: Thomas Neidhart <thomas.neidhart@gmail.com>
Committed: Wed Feb 25 21:43:34 2015 +0100

----------------------------------------------------------------------
 src/changes/changes.xml                         |  4 +++
 .../AbstractIntegerDistribution.java            |  4 ++-
 .../distribution/AbstractRealDistribution.java  | 14 ---------
 .../math4/distribution/IntegerDistribution.java | 28 +++++++++--------
 .../distribution/LogNormalDistribution.java     | 11 -------
 .../math4/distribution/NormalDistribution.java  | 11 -------
 .../math4/distribution/ParetoDistribution.java  | 12 --------
 .../math4/distribution/RealDistribution.java    | 32 +++++++++-----------
 .../math4/random/EmpiricalDistribution.java     |  4 +--
 .../AbstractIntegerDistributionTest.java        |  6 ++--
 .../ExponentialDistributionTest.java            |  2 +-
 .../IntegerDistributionAbstractTest.java        |  2 +-
 .../RealDistributionAbstractTest.java           | 30 ++++++++----------
 .../math4/random/EmpiricalDistributionTest.java | 10 +++---
 .../math4/random/RandomDataGeneratorTest.java   |  4 +--
 15 files changed, 62 insertions(+), 112 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/3fd9cf17/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index af87c56..9b4744e 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -54,6 +54,10 @@ If the output is not quite correct, check for invisible trailing spaces!
     </release>
 
     <release version="4.0" date="XXXX-XX-XX" description="">
+      <action dev="tn" type="update" issue="MATH-839" due-to="Gilles Sadowski">
+        Renamed "cumulativeProbability(double, double)" to "probability(double, double)"
+        in "IntegerDistribution" and "RealDistribution".
+      </action>
       <action dev="tn" type="add" issue="MATH-1039" due-to="Aleksei Dievskii">
         Added logDensity(double) to RealDistribution and logProbability(int)
         to IntegerDistribution interface. The implementations have already been

http://git-wip-us.apache.org/repos/asf/commons-math/blob/3fd9cf17/src/main/java/org/apache/commons/math4/distribution/AbstractIntegerDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/AbstractIntegerDistribution.java
b/src/main/java/org/apache/commons/math4/distribution/AbstractIntegerDistribution.java
index 1b0f263..8afd164 100644
--- a/src/main/java/org/apache/commons/math4/distribution/AbstractIntegerDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/AbstractIntegerDistribution.java
@@ -56,8 +56,10 @@ public abstract class AbstractIntegerDistribution implements IntegerDistribution
      *
      * The default implementation uses the identity
      * <p>{@code P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)}</p>
+     *
+     * @since 4.0, was previously named cumulativeProbability
      */
-    public double cumulativeProbability(int x0, int x1) throws NumberIsTooLargeException
{
+    public double probability(int x0, int x1) throws NumberIsTooLargeException {
         if (x1 < x0) {
             throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
                     x0, x1, true);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/3fd9cf17/src/main/java/org/apache/commons/math4/distribution/AbstractRealDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/AbstractRealDistribution.java
b/src/main/java/org/apache/commons/math4/distribution/AbstractRealDistribution.java
index 9918df2..1c43540 100644
--- a/src/main/java/org/apache/commons/math4/distribution/AbstractRealDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/AbstractRealDistribution.java
@@ -59,20 +59,6 @@ implements RealDistribution, Serializable {
     }
 
     /**
-     * {@inheritDoc}
-     *
-     * The default implementation uses the identity
-     * <p>{@code P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)}</p>
-     *
-     * @deprecated As of 3.1 (to be removed in 4.0). Please use
-     * {@link #probability(double,double)} instead.
-     */
-    @Deprecated
-    public double cumulativeProbability(double x0, double x1) throws NumberIsTooLargeException
{
-        return probability(x0, x1);
-    }
-
-    /**
      * For a random variable {@code X} whose values are distributed according
      * to this distribution, this method returns {@code P(x0 < X <= x1)}.
      *

http://git-wip-us.apache.org/repos/asf/commons-math/blob/3fd9cf17/src/main/java/org/apache/commons/math4/distribution/IntegerDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/IntegerDistribution.java
b/src/main/java/org/apache/commons/math4/distribution/IntegerDistribution.java
index f1299c6..bd3d130 100644
--- a/src/main/java/org/apache/commons/math4/distribution/IntegerDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/IntegerDistribution.java
@@ -53,18 +53,6 @@ public interface IntegerDistribution {
 
     /**
      * For a random variable {@code X} whose values are distributed according
-     * to this distribution, this method returns {@code P(X <= x)}.  In other
-     * words, this method represents the (cumulative) distribution function
-     * (CDF) for this distribution.
-     *
-     * @param x the point at which the CDF is evaluated
-     * @return the probability that a random variable with this
-     * distribution takes a value less than or equal to {@code x}
-     */
-    double cumulativeProbability(int x);
-
-    /**
-     * For a random variable {@code X} whose values are distributed according
      * to this distribution, this method returns {@code P(x0 < X <= x1)}.
      *
      * @param x0 the exclusive lower bound
@@ -73,8 +61,22 @@ public interface IntegerDistribution {
      * will take a value between {@code x0} and {@code x1},
      * excluding the lower and including the upper endpoint
      * @throws NumberIsTooLargeException if {@code x0 > x1}
+     *
+     * @since 4.0, was previously named cumulativeProbability
      */
-    double cumulativeProbability(int x0, int x1) throws NumberIsTooLargeException;
+    double probability(int x0, int x1) throws NumberIsTooLargeException;
+
+    /**
+     * For a random variable {@code X} whose values are distributed according
+     * to this distribution, this method returns {@code P(X <= x)}.  In other
+     * words, this method represents the (cumulative) distribution function
+     * (CDF) for this distribution.
+     *
+     * @param x the point at which the CDF is evaluated
+     * @return the probability that a random variable with this
+     * distribution takes a value less than or equal to {@code x}
+     */
+    double cumulativeProbability(int x);
 
     /**
      * Computes the quantile function of this distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/3fd9cf17/src/main/java/org/apache/commons/math4/distribution/LogNormalDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/LogNormalDistribution.java
b/src/main/java/org/apache/commons/math4/distribution/LogNormalDistribution.java
index 1d246a2..fa84c98 100644
--- a/src/main/java/org/apache/commons/math4/distribution/LogNormalDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/LogNormalDistribution.java
@@ -254,17 +254,6 @@ public class LogNormalDistribution extends AbstractRealDistribution {
         return 0.5 + 0.5 * Erf.erf(dev / (shape * SQRT2));
     }
 
-    /**
-     * {@inheritDoc}
-     *
-     * @deprecated See {@link RealDistribution#cumulativeProbability(double,double)}
-     */
-    @Override@Deprecated
-    public double cumulativeProbability(double x0, double x1)
-        throws NumberIsTooLargeException {
-        return probability(x0, x1);
-    }
-
     /** {@inheritDoc} */
     @Override
     public double probability(double x0,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/3fd9cf17/src/main/java/org/apache/commons/math4/distribution/NormalDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/NormalDistribution.java b/src/main/java/org/apache/commons/math4/distribution/NormalDistribution.java
index efb828e..25b5aaa 100644
--- a/src/main/java/org/apache/commons/math4/distribution/NormalDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/NormalDistribution.java
@@ -205,17 +205,6 @@ public class NormalDistribution extends AbstractRealDistribution {
         return mean + standardDeviation * SQRT2 * Erf.erfInv(2 * p - 1);
     }
 
-    /**
-     * {@inheritDoc}
-     *
-     * @deprecated See {@link RealDistribution#cumulativeProbability(double,double)}
-     */
-    @Override@Deprecated
-    public double cumulativeProbability(double x0, double x1)
-        throws NumberIsTooLargeException {
-        return probability(x0, x1);
-    }
-
     /** {@inheritDoc} */
     @Override
     public double probability(double x0,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/3fd9cf17/src/main/java/org/apache/commons/math4/distribution/ParetoDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/ParetoDistribution.java b/src/main/java/org/apache/commons/math4/distribution/ParetoDistribution.java
index 8da23e7..69febbc 100644
--- a/src/main/java/org/apache/commons/math4/distribution/ParetoDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/ParetoDistribution.java
@@ -215,18 +215,6 @@ public class ParetoDistribution extends AbstractRealDistribution {
         return 1 - FastMath.pow(scale / x, shape);
     }
 
-    /**
-     * {@inheritDoc}
-     *
-     * @deprecated See {@link RealDistribution#cumulativeProbability(double,double)}
-     */
-    @Override
-    @Deprecated
-    public double cumulativeProbability(double x0, double x1)
-        throws NumberIsTooLargeException {
-        return probability(x0, x1);
-    }
-
     /** {@inheritDoc} */
     @Override
     protected double getSolverAbsoluteAccuracy() {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/3fd9cf17/src/main/java/org/apache/commons/math4/distribution/RealDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/RealDistribution.java b/src/main/java/org/apache/commons/math4/distribution/RealDistribution.java
index 728e2e3..5ba3717 100644
--- a/src/main/java/org/apache/commons/math4/distribution/RealDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/RealDistribution.java
@@ -37,6 +37,21 @@ public interface RealDistribution {
     double probability(double x);
 
     /**
+     * For a random variable {@code X} whose values are distributed according
+     * to this distribution, this method returns {@code P(x0 < X <= x1)}.
+     *
+     * @param x0 the exclusive lower bound
+     * @param x1 the inclusive upper bound
+     * @return the probability that a random variable with this distribution
+     * takes a value between {@code x0} and {@code x1},
+     * excluding the lower and including the upper endpoint
+     * @throws NumberIsTooLargeException if {@code x0 > x1}
+     *
+     * @since 4.0, was previously named cumulativeProbability
+     */
+    double probability(double x0, double x1) throws NumberIsTooLargeException;
+
+    /**
      * Returns the probability density function (PDF) of this distribution
      * evaluated at the specified point {@code x}. In general, the PDF is
      * the derivative of the {@link #cumulativeProbability(double) CDF}.
@@ -80,23 +95,6 @@ public interface RealDistribution {
     double cumulativeProbability(double x);
 
     /**
-     * For a random variable {@code X} whose values are distributed according
-     * to this distribution, this method returns {@code P(x0 < X <= x1)}.
-     *
-     * @param x0 the exclusive lower bound
-     * @param x1 the inclusive upper bound
-     * @return the probability that a random variable with this distribution
-     * takes a value between {@code x0} and {@code x1},
-     * excluding the lower and including the upper endpoint
-     * @throws NumberIsTooLargeException if {@code x0 > x1}
-     *
-     * @deprecated As of 3.1. In 4.0, this method will be renamed
-     * {@code probability(double x0, double x1)}.
-     */
-    @Deprecated
-    double cumulativeProbability(double x0, double x1) throws NumberIsTooLargeException;
-
-    /**
      * Computes the quantile function of this distribution. For a random
      * variable {@code X} distributed according to this distribution, the
      * returned value is

http://git-wip-us.apache.org/repos/asf/commons-math/blob/3fd9cf17/src/main/java/org/apache/commons/math4/random/EmpiricalDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/EmpiricalDistribution.java b/src/main/java/org/apache/commons/math4/random/EmpiricalDistribution.java
index 5e0e842..9458289 100644
--- a/src/main/java/org/apache/commons/math4/random/EmpiricalDistribution.java
+++ b/src/main/java/org/apache/commons/math4/random/EmpiricalDistribution.java
@@ -765,8 +765,8 @@ public class EmpiricalDistribution extends AbstractRealDistribution {
     private double kB(int i) {
         final double[] binBounds = getUpperBounds();
         final RealDistribution kernel = getKernel(binStats.get(i));
-        return i == 0 ? kernel.cumulativeProbability(min, binBounds[0]) :
-            kernel.cumulativeProbability(binBounds[i - 1], binBounds[i]);
+        return i == 0 ? kernel.probability(min, binBounds[0]) :
+            kernel.probability(binBounds[i - 1], binBounds[i]);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/3fd9cf17/src/test/java/org/apache/commons/math4/distribution/AbstractIntegerDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/AbstractIntegerDistributionTest.java
b/src/test/java/org/apache/commons/math4/distribution/AbstractIntegerDistributionTest.java
index 52e9680..e83403f 100644
--- a/src/test/java/org/apache/commons/math4/distribution/AbstractIntegerDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/AbstractIntegerDistributionTest.java
@@ -60,18 +60,18 @@ public class AbstractIntegerDistributionTest {
     }
 
     @Test
-    public void testCumulativeProbabilitiesRangeArguments() {
+    public void testProbabilitiesRangeArguments() {
         int lower = 0;
         int upper = 6;
         for (int i = 0; i < 2; i++) {
             // cum(0,6) = p(0 < X <= 6) = 1, cum(1,5) = 4/6, cum(2,4) = 2/6
             Assert.assertEquals(1 - p * 2 * i,
-                    diceDistribution.cumulativeProbability(lower, upper), 1E-12);
+                    diceDistribution.probability(lower, upper), 1E-12);
             lower++;
             upper--;
         }
         for (int i = 0; i < 6; i++) {
-            Assert.assertEquals(p, diceDistribution.cumulativeProbability(i, i+1), 1E-12);
+            Assert.assertEquals(p, diceDistribution.probability(i, i+1), 1E-12);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/3fd9cf17/src/test/java/org/apache/commons/math4/distribution/ExponentialDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/ExponentialDistributionTest.java
b/src/test/java/org/apache/commons/math4/distribution/ExponentialDistributionTest.java
index ea1a14f..465bfb5 100644
--- a/src/test/java/org/apache/commons/math4/distribution/ExponentialDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/ExponentialDistributionTest.java
@@ -86,7 +86,7 @@ public class ExponentialDistributionTest extends RealDistributionAbstractTest
{
 
     @Test
     public void testCumulativeProbability2() {
-        double actual = getDistribution().cumulativeProbability(0.25, 0.75);
+        double actual = getDistribution().probability(0.25, 0.75);
         Assert.assertEquals(0.0905214, actual, 10e-4);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/3fd9cf17/src/test/java/org/apache/commons/math4/distribution/IntegerDistributionAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/IntegerDistributionAbstractTest.java
b/src/test/java/org/apache/commons/math4/distribution/IntegerDistributionAbstractTest.java
index 895428d..8f09b13 100644
--- a/src/test/java/org/apache/commons/math4/distribution/IntegerDistributionAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/IntegerDistributionAbstractTest.java
@@ -262,7 +262,7 @@ public abstract class IntegerDistributionAbstractTest {
     @Test
     public void testIllegalArguments() {
         try {
-            distribution.cumulativeProbability(1, 0);
+            distribution.probability(1, 0);
             Assert.fail("Expecting MathIllegalArgumentException for bad cumulativeProbability
interval");
         } catch (MathIllegalArgumentException ex) {
             // expected

http://git-wip-us.apache.org/repos/asf/commons-math/blob/3fd9cf17/src/test/java/org/apache/commons/math4/distribution/RealDistributionAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/RealDistributionAbstractTest.java
b/src/test/java/org/apache/commons/math4/distribution/RealDistributionAbstractTest.java
index e6907bd..d4af05d 100644
--- a/src/test/java/org/apache/commons/math4/distribution/RealDistributionAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/RealDistributionAbstractTest.java
@@ -29,7 +29,6 @@ import org.apache.commons.math4.TestUtils;
 import org.apache.commons.math4.analysis.UnivariateFunction;
 import org.apache.commons.math4.analysis.integration.BaseAbstractUnivariateIntegrator;
 import org.apache.commons.math4.analysis.integration.IterativeLegendreGaussIntegrator;
-import org.apache.commons.math4.distribution.AbstractRealDistribution;
 import org.apache.commons.math4.distribution.RealDistribution;
 import org.apache.commons.math4.exception.MathIllegalArgumentException;
 import org.apache.commons.math4.exception.NumberIsTooLargeException;
@@ -52,7 +51,7 @@ import org.junit.Test;
  * defined by the arrays returned by the makeCumulativeXxx methods.
  * <p>
  * makeCumulativeTestPoints() -- arguments used to test cumulative probabilities
- * makeCumulativeTestValues() -- expected cumulative probabilites
+ * makeCumulativeTestValues() -- expected cumulative probabilities
  * makeDensityTestValues() -- expected density values at cumulativeTestPoints
  * makeInverseCumulativeTestPoints() -- arguments used to test inverse cdf
  * makeInverseCumulativeTestValues() -- expected inverse cdf values
@@ -61,7 +60,7 @@ import org.junit.Test;
  * test data, use the setXxx methods for the instance data in test cases and
  * call the verifyXxx methods to verify results.
  * <p>
- * Error tolerance can be overriden by implementing getTolerance().
+ * Error tolerance can be overridden by implementing getTolerance().
  * <p>
  * Test data should be validated against reference tables or other packages
  * where possible, and the source of the reference data and/or validation
@@ -181,21 +180,20 @@ public abstract class RealDistributionAbstractTest {
                 distribution.cumulativeProbability(cumulativeTestPoints[i]),
                 getTolerance());
         }
-        // verify cumulativeProbability(double, double)
-        // XXX In 4.0, "cumulativeProbability(double,double)" must be replaced with "probability"
(MATH-839).
+        // verify probability(double, double)
         for (int i = 0; i < cumulativeTestPoints.length; i++) {
             for (int j = 0; j < cumulativeTestPoints.length; j++) {
                 if (cumulativeTestPoints[i] <= cumulativeTestPoints[j]) {
                     TestUtils.assertEquals(cumulativeTestValues[j] - cumulativeTestValues[i],
-                        distribution.cumulativeProbability(cumulativeTestPoints[i], cumulativeTestPoints[j]),
+                        distribution.probability(cumulativeTestPoints[i], cumulativeTestPoints[j]),
                         getTolerance());
                 } else {
                     try {
-                        distribution.cumulativeProbability(cumulativeTestPoints[i], cumulativeTestPoints[j]);
+                        distribution.probability(cumulativeTestPoints[i], cumulativeTestPoints[j]);
                     } catch (NumberIsTooLargeException e) {
                         continue;
                     }
-                    Assert.fail("distribution.cumulativeProbability(double, double) should
have thrown an exception that second argument is too large");
+                    Assert.fail("distribution.probability(double, double) should have thrown
an exception that second argument is too large");
                 }
             }
         }
@@ -230,11 +228,10 @@ public abstract class RealDistributionAbstractTest {
      * Verifies that logarithmic density calculations match expected values
      */
     protected void verifyLogDensities() {
-        // FIXME: when logProbability methods are added to RealDistribution in 4.0, remove
cast below
         for (int i = 0; i < cumulativeTestPoints.length; i++) {
             TestUtils.assertEquals("Incorrect probability density value returned for "
                     + cumulativeTestPoints[i], logDensityTestValues[i],
-                    ((AbstractRealDistribution) distribution).logDensity(cumulativeTestPoints[i]),
+                    distribution.logDensity(cumulativeTestPoints[i]),
                     getTolerance());
         }
     }
@@ -285,9 +282,8 @@ public abstract class RealDistributionAbstractTest {
         for (int i=1; i < cumulativeTestPoints.length; i++) {
 
             // check that cdf(x, x) = 0
-            // XXX In 4.0, "cumulativeProbability(double,double)" must be replaced with "probability"
(MATH-839).
             TestUtils.assertEquals(0d,
-               distribution.cumulativeProbability
+               distribution.probability
                  (cumulativeTestPoints[i], cumulativeTestPoints[i]), tolerance);
 
             // check that P(a < X <= b) = P(X <= b) - P(X <= a)
@@ -295,9 +291,8 @@ public abstract class RealDistributionAbstractTest {
             double lower = FastMath.min(cumulativeTestPoints[i], cumulativeTestPoints[i -1]);
             double diff = distribution.cumulativeProbability(upper) -
                 distribution.cumulativeProbability(lower);
-            // XXX In 4.0, "cumulativeProbability(double,double)" must be replaced with "probability"
(MATH-839).
-            double direct = distribution.cumulativeProbability(lower, upper);
-            TestUtils.assertEquals("Inconsistent cumulative probabilities for ("
+            double direct = distribution.probability(lower, upper);
+            TestUtils.assertEquals("Inconsistent probability for ("
                     + lower + "," + upper + ")", diff, direct, tolerance);
         }
     }
@@ -308,8 +303,7 @@ public abstract class RealDistributionAbstractTest {
     @Test
     public void testIllegalArguments() {
         try {
-            // XXX In 4.0, "cumulativeProbability(double,double)" must be replaced with "probability"
(MATH-839).
-            distribution.cumulativeProbability(1, 0);
+            distribution.probability(1, 0);
             Assert.fail("Expecting MathIllegalArgumentException for bad cumulativeProbability
interval");
         } catch (MathIllegalArgumentException ex) {
             // expected
@@ -375,7 +369,7 @@ public abstract class RealDistributionAbstractTest {
         Collections.sort(integrationTestPoints);
         for (int i = 1; i < integrationTestPoints.size(); i++) {
             Assert.assertEquals(
-                    distribution.cumulativeProbability(  // FIXME @4.0 when rename happens
+                    distribution.probability(
                             integrationTestPoints.get(0), integrationTestPoints.get(i)),
                             integrator.integrate(
                                     1000000, // Triangle integrals are very slow to converge

http://git-wip-us.apache.org/repos/asf/commons-math/blob/3fd9cf17/src/test/java/org/apache/commons/math4/random/EmpiricalDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/EmpiricalDistributionTest.java
b/src/test/java/org/apache/commons/math4/random/EmpiricalDistributionTest.java
index 288264c..fd4bd5a 100644
--- a/src/test/java/org/apache/commons/math4/random/EmpiricalDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/random/EmpiricalDistributionTest.java
@@ -59,12 +59,10 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
     public void setUp() {
         super.setUp();
         empiricalDistribution = new EmpiricalDistribution(100);
-//         empiricalDistribution = new EmpiricalDistribution(100, new RandomDataImpl());
// XXX Deprecated API
         url = getClass().getResource("testData.txt");
         final ArrayList<Double> list = new ArrayList<Double>();
         try {
             empiricalDistribution2 = new EmpiricalDistribution(100);
-//             empiricalDistribution2 = new EmpiricalDistribution(100, new RandomDataImpl());
// XXX Deprecated API
             BufferedReader in =
                 new BufferedReader(new InputStreamReader(
                         url.openStream()));
@@ -351,8 +349,8 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
             // First bin has mass 11 / 10000, the rest have mass 10 / 10000.
             final double bMinus = bin == 0 ? 0 : (bin - 1) * binMass + firstBinMass;
             final RealDistribution kernel = findKernel(lower, upper);
-            final double withinBinKernelMass = kernel.cumulativeProbability(lower, upper);
-            final double kernelCum = kernel.cumulativeProbability(lower, testPoints[i]);
+            final double withinBinKernelMass = kernel.probability(lower, upper);
+            final double kernelCum = kernel.probability(lower, testPoints[i]);
             cumValues[i] = bMinus + (bin == 0 ? firstBinMass : binMass) * kernelCum/withinBinKernelMass;
         }
         return cumValues;
@@ -370,7 +368,7 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
                 binBounds[bin - 1];
             final double upper = binBounds[bin];
             final RealDistribution kernel = findKernel(lower, upper);
-            final double withinBinKernelMass = kernel.cumulativeProbability(lower, upper);
+            final double withinBinKernelMass = kernel.probability(lower, upper);
             final double density = kernel.density(testPoints[i]);
             densityValues[i] = density * (bin == 0 ? firstBinMass : binMass) / withinBinKernelMass;
  
         }
@@ -399,7 +397,7 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes
         final double[] upper = {5, 12, 1030, 5010, 10000};
         for (int i = 1; i < 5; i++) {
             Assert.assertEquals(
-                    distribution.cumulativeProbability( 
+                    distribution.probability( 
                             lower[i], upper[i]),
                             integrator.integrate(
                                     1000000, // Triangle integrals are very slow to converge

http://git-wip-us.apache.org/repos/asf/commons-math/blob/3fd9cf17/src/test/java/org/apache/commons/math4/random/RandomDataGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/RandomDataGeneratorTest.java b/src/test/java/org/apache/commons/math4/random/RandomDataGeneratorTest.java
index fda418c..c8f8813 100644
--- a/src/test/java/org/apache/commons/math4/random/RandomDataGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math4/random/RandomDataGeneratorTest.java
@@ -474,8 +474,8 @@ public class RandomDataGeneratorTest {
         double upperBinMass = 0;
         while (!widthSufficient) {
             binWidth++;
-            lowerBinMass = poissonDistribution.cumulativeProbability(lower - 1, lower + binWidth
- 1);
-            upperBinMass = poissonDistribution.cumulativeProbability(upper - binWidth - 1,
upper - 1);
+            lowerBinMass = poissonDistribution.probability(lower - 1, lower + binWidth -
1);
+            upperBinMass = poissonDistribution.probability(upper - binWidth - 1, upper -
1);
             widthSufficient = FastMath.min(lowerBinMass, upperBinMass) * sampleSize >=
minExpectedCount;
         }
 


Mime
View raw message