commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Evan Ward (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MATH-949) LevenbergMarquardtOptimizer reports 0 iterations
Date Tue, 19 Mar 2013 17:21:19 GMT

    [ https://issues.apache.org/jira/browse/MATH-949?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13606543#comment-13606543
] 

Evan Ward commented on MATH-949:
--------------------------------

I can confirm that I get reasonable values now. For the above test case I get 24 iterations
and 42 evaluations. I'm not an expert, so I don't know if these are the right numbers...

Thanks for the fast fix!
                
> LevenbergMarquardtOptimizer reports 0 iterations
> ------------------------------------------------
>
>                 Key: MATH-949
>                 URL: https://issues.apache.org/jira/browse/MATH-949
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.2
>            Reporter: Evan Ward
>
> The method LevenbergMarquardtOptimizer.getIterations() does not report the correct number
of iterations; It always returns 0. A quick look at the code shows that only SimplexOptimizer
calls BaseOptimizer.incrementEvaluationsCount()
> I've put a test case below. Notice how the evaluations count is correctly incremented,
but the iterations count is not.
> {noformat}
>     @Test
>     public void testGetIterations() {
>         // setup
>         LevenbergMarquardtOptimizer otim = new LevenbergMarquardtOptimizer();
>         // action
>         otim.optimize(new MaxEval(100), new Target(new double[] { 1 }),
>                 new Weight(new double[] { 1 }), new InitialGuess(
>                         new double[] { 3 }), new ModelFunction(
>                         new MultivariateVectorFunction() {
>                             @Override
>                             public double[] value(double[] point)
>                                     throws IllegalArgumentException {
>                                 return new double[] { FastMath.pow(point[0], 4) };
>                             }
>                         }), new ModelFunctionJacobian(
>                         new MultivariateMatrixFunction() {
>                             @Override
>                             public double[][] value(double[] point)
>                                     throws IllegalArgumentException {
>                                 return new double[][] { { 0.25 * FastMath.pow(
>                                         point[0], 3) } };
>                             }
>                         }));
>         // verify
>         assertThat(otim.getEvaluations(), greaterThan(1));
>         assertThat(otim.getIterations(), greaterThan(1));
>     }
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message