commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r592695 - in /commons/proper/math/trunk/src/test/org/apache/commons/math/estimation: GaussNewtonEstimatorTest.java LevenbergMarquardtEstimatorTest.java
Date Wed, 07 Nov 2007 10:56:52 GMT
Author: luc
Date: Wed Nov  7 02:56:52 2007
New Revision: 592695

URL: http://svn.apache.org/viewvc?rev=592695&view=rev
Log:
improved test coverage

Modified:
    commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/GaussNewtonEstimatorTest.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/LevenbergMarquardtEstimatorTest.java

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/GaussNewtonEstimatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/GaussNewtonEstimatorTest.java?rev=592695&r1=592694&r2=592695&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/GaussNewtonEstimatorTest.java
(original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/GaussNewtonEstimatorTest.java
Wed Nov  7 02:56:52 2007
@@ -417,8 +417,11 @@
     GaussNewtonEstimator estimator = new GaussNewtonEstimator(100, 1.0e-6, 1.0e-6);
     estimator.estimate(problem);
     assertEquals(0, estimator.getRMS(problem), 1.0e-10);
-    assertEquals(2.0, p[0].getEstimate(), 1.0e-10);
-    assertEquals(1.0, p[1].getEstimate(), 1.0e-10);
+    EstimatedParameter[] all = problem.getAllParameters();
+    for (int i = 0; i < all.length; ++i) {
+        assertEquals(all[i].getName().equals("p0") ? 2.0 : 1.0,
+                     all[i].getEstimate(), 1.0e-10);
+    }
 
   }
 

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/LevenbergMarquardtEstimatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/LevenbergMarquardtEstimatorTest.java?rev=592695&r1=592694&r2=592695&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/LevenbergMarquardtEstimatorTest.java
(original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/estimation/LevenbergMarquardtEstimatorTest.java
Wed Nov  7 02:56:52 2007
@@ -453,8 +453,11 @@
       circle.addPoint(110.0, -20.0);
       circle.addPoint( 35.0,  15.0);
       circle.addPoint( 45.0,  97.0);
-      checkEstimate(circle, 100.0, 1000, 1.0e-10, 1.0e-10, 1.0e-10, false);
-      checkEstimate(circle, 1.0e-12, 10, 1.0e-20, 1.0e-20, 1.0e-20, true);
+      checkEstimate(circle, 0.1, 10, 1.0e-14, 1.0e-16, 1.0e-10, false);
+      checkEstimate(circle, 0.1, 10, 1.0e-15, 1.0e-17, 1.0e-10, true);
+      checkEstimate(circle, 0.1,  5, 1.0e-15, 1.0e-16, 1.0e-10, true);
+      circle.addPoint(300, -300);
+      checkEstimate(circle, 0.1, 20, 1.0e-18, 1.0e-16, 1.0e-10, true);
   }
 
   private void checkEstimate(EstimationProblem problem,
@@ -471,7 +474,6 @@
         estimator.estimate(problem);
         assertTrue(! shouldFail);
       } catch (EstimationException ee) {
-          System.out.println(ee.getClass().getName() + " " + ee.getMessage());
         assertTrue(shouldFail);
       } catch (Exception e) {
         fail("wrong exception type caught");



Mime
View raw message