commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eric henon <eric.he...@univ-reims.fr>
Subject [math] Re: LevenbergMarquardtOptimizer
Date Wed, 17 Apr 2013 10:22:47 GMT

Thanks a lot Luc for your help !
I'm going to try this and come back to you
to tell you if it works.
Eric



Le 17 avr. 2013 à 10:24, Luc Maisonobe a écrit :

> Le 17/04/2013 10:08, Eric HENON a écrit :
>> Hello,
>> 
>> I'm trying to do a non linear
>> regression using the LevenbergMarquardtOptimizer.
>> 
>> I have copied the proposed Demo code at:
>> http://commons.apache.org/proper/commons-math/userguide/optimization.html
>> 
>> and I get the following error at the java
>> compilation time: 
>> 
>> "The method optimize(OptimizationData..) in the type AbstractLeastSquaresOptimizer
is not
>> applicable for the arguments (int, QuadraticProblem, double[], double[], double[])"
>> 
>> It seems that the optimize method employed in the Demo code is not
>> the appropriate one. 
> 
> You are right. This code correspond to the former API in the
> optimization package, which is still available but deprecated now. The
> new API is in the optim package and it is the one you use, which expect
> OptimizationData parameters.
> 
> You can try to wrap the arguments in the various implementations of the
> OptimizationData interface according to their meaning.
> 
> So you should end up with something like;
> 
>  lm.optimize(new MaxEval(maxEval),
>              new ModelFunction(function),
>              new ModelFunctionJacobian(jacobian),
>              new Target(target),
>              new Weight(weight),
>              new InitialGuess(initial));
> 
> hope this helps.
> 
> Luc
> 
>> 
>> I tried to change the imports, but that does not work.
>> 
>> Any help will be appreciated.
>> Thanks.
>> Eric
>> 
>> ****
>> ...
>> LevenbergMarquardtOptimizer optimizer = new LevenbergMarquardtOptimizer();
>> ...
>> PointVectorValuePair optimum = optimizer.optimize(100, problem, problem.calculateTarget(),
weights, initialSolution);
>> ****
>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 

Eric Henon
Professeur
Universite de Reims Champagne-Ardenne
Institut de Chimie Moleculaire de Reims
http://www.univ-reims.fr/ICMR
CNRS UMR 6229
UFR des Sciences Exactes et Naturelles
BP 1039
51687 Reims Cedex 2 (France)                            
Tél./Fax : + 33 (0) 3 26 91 84 97
eric.henon@univ-reims.fr


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message