Class LevenbergMarquardtOptimizer
- All Implemented Interfaces:
LeastSquaresOptimizer
This implementation should work even for over-determined systems (i.e. systems having more point than equations). Over-determined systems are solved by ignoring the point which have the smallest impact according to their jacobian column norm. Only the rank of the matrix and some loop bounds are changed to implement this.
The resolution engine is a simple translation of the MINPACK lmder routine with minor changes. The changes include the over-determined resolution, the use of inherited convergence checker and the Q.R. decomposition which has been rewritten following the algorithm described in the P. Lascaux and R. Theodor book Analyse numérique matricielle appliquée à l'art de l'ingénieur, Masson 1986.
The authors of the original fortran version are:
- Argonne National Laboratory. MINPACK project. March 1980
- Burton S. Garbow
- Kenneth E. Hillstrom
- Jorge J. More
Minpack Copyright Notice (1999) University of Chicago. All rights reserved |
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
|
- Since:
- 3.3
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer
LeastSquaresOptimizer.Optimum
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.LevenbergMarquardtOptimizer
(double initialStepBoundFactor, double costRelativeTolerance, double parRelativeTolerance, double orthoTolerance, double qrRankingThreshold) Construct an instance with all parameters specified. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Gets the value of a tuning parameter.double
Gets the value of a tuning parameter.double
Gets the value of a tuning parameter.double
Gets the value of a tuning parameter.double
Gets the value of a tuning parameter.optimize
(LeastSquaresProblem problem) Solve the non-linear least squares problem.withCostRelativeTolerance
(double newCostRelativeTolerance) withInitialStepBoundFactor
(double newInitialStepBoundFactor) withOrthoTolerance
(double newOrthoTolerance) Modifies the given parameter.withParameterRelativeTolerance
(double newParRelativeTolerance) withRankingThreshold
(double newQRRankingThreshold)
-
Constructor Details
-
LevenbergMarquardtOptimizer
public LevenbergMarquardtOptimizer()Default constructor.The default values for the algorithm settings are:
- Initial step bound factor: 100
- Cost relative tolerance: 1e-10
- Parameters relative tolerance: 1e-10
- Orthogonality tolerance: 1e-10
- QR ranking threshold:
Precision.SAFE_MIN
-
LevenbergMarquardtOptimizer
public LevenbergMarquardtOptimizer(double initialStepBoundFactor, double costRelativeTolerance, double parRelativeTolerance, double orthoTolerance, double qrRankingThreshold) Construct an instance with all parameters specified.- Parameters:
initialStepBoundFactor
- initial step bound factorcostRelativeTolerance
- cost relative toleranceparRelativeTolerance
- parameters relative toleranceorthoTolerance
- orthogonality toleranceqrRankingThreshold
- threshold in the QR decomposition. Columns with a 2 norm less than this threshold are considered to be all 0s.
-
-
Method Details
-
withInitialStepBoundFactor
- Parameters:
newInitialStepBoundFactor
- Positive input variable used in determining the initial step bound. This bound is set to the product of initialStepBoundFactor and the euclidean norm ofdiag * x
if non-zero, or else tonewInitialStepBoundFactor
itself. In most cases factor should lie in the interval(0.1, 100.0)
.100
is a generally recommended value. of the matrix is reduced.- Returns:
- a new instance.
-
withCostRelativeTolerance
- Parameters:
newCostRelativeTolerance
- Desired relative error in the sum of squares.- Returns:
- a new instance.
-
withParameterRelativeTolerance
- Parameters:
newParRelativeTolerance
- Desired relative error in the approximate solution parameters.- Returns:
- a new instance.
-
withOrthoTolerance
Modifies the given parameter.- Parameters:
newOrthoTolerance
- Desired max cosine on the orthogonality between the function vector and the columns of the Jacobian.- Returns:
- a new instance.
-
withRankingThreshold
- Parameters:
newQRRankingThreshold
- Desired threshold for QR ranking. If the squared norm of a column vector is smaller or equal to this threshold during QR decomposition, it is considered to be a zero vector and hence the rank of the matrix is reduced.- Returns:
- a new instance.
-
getInitialStepBoundFactor
public double getInitialStepBoundFactor()Gets the value of a tuning parameter.- Returns:
- the parameter's value.
- See Also:
-
getCostRelativeTolerance
public double getCostRelativeTolerance()Gets the value of a tuning parameter.- Returns:
- the parameter's value.
- See Also:
-
getParameterRelativeTolerance
public double getParameterRelativeTolerance()Gets the value of a tuning parameter.- Returns:
- the parameter's value.
- See Also:
-
getOrthoTolerance
public double getOrthoTolerance()Gets the value of a tuning parameter.- Returns:
- the parameter's value.
- See Also:
-
getRankingThreshold
public double getRankingThreshold()Gets the value of a tuning parameter.- Returns:
- the parameter's value.
- See Also:
-
optimize
Solve the non-linear least squares problem.- Specified by:
optimize
in interfaceLeastSquaresOptimizer
- Parameters:
problem
- the problem definition, including model function and convergence criteria.- Returns:
- The optimum.
-