Class LevenbergMarquardtOptimizer
Constraints are not supported: the call to
optimize
will throw
MathUnsupportedOperationException
if bounds are passed to it.
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:
- 2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate double[]
Deprecated.Coefficients of the Householder transforms vectors.private final double
Deprecated.Desired relative error in the sum of squares.private double[]
Deprecated.Diagonal elements of the R matrix in the Q.R.private final double
Deprecated.Positive input variable used in determining the initial step bound.private double[]
Deprecated.Norms of the columns of the jacobian matrix.private double[]
Deprecated.Parameters evolution direction associated with lmPar.private double
Deprecated.Levenberg-Marquardt parameter.private final double
Deprecated.Desired max cosine on the orthogonality between the function vector and the columns of the jacobian.private final double
Deprecated.Desired relative error in the approximate solution parameters.private int[]
Deprecated.Columns permutation array.private final double
Deprecated.Threshold for QR ranking.private int
Deprecated.Rank of the jacobian matrix.private int
Deprecated.Number of solved point.private static final double
Deprecated.Twice the "epsilon machine".private double[][]
Deprecated.Weighted Jacobian.private double[]
Deprecated.Weighted residuals.Fields inherited from class org.apache.commons.math3.optim.BaseOptimizer
evaluations, iterations
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Build an optimizer for least squares problems with default values for all the tuning parameters (see theother contructor
.LevenbergMarquardtOptimizer
(double costRelativeTolerance, double parRelativeTolerance, double orthoTolerance) Deprecated.Build an optimizer for least squares problems with default values for some of the tuning parameters (see theother contructor
.LevenbergMarquardtOptimizer
(double initialStepBoundFactor, double costRelativeTolerance, double parRelativeTolerance, double orthoTolerance, double threshold) Deprecated.The arguments control the behaviour of the default convergence checking procedure.LevenbergMarquardtOptimizer
(double initialStepBoundFactor, ConvergenceChecker<PointVectorValuePair> checker, double costRelativeTolerance, double parRelativeTolerance, double orthoTolerance, double threshold) Deprecated.Constructor that allows the specification of a custom convergence checker, in addition to the standard ones.Deprecated.Constructor that allows the specification of a custom convergence checker. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Deprecated.private void
determineLMDirection
(double[] qy, double[] diag, double[] lmDiag, double[] work) Deprecated.Solve a*x = b and d*x = 0 in the least squares sense.private void
determineLMParameter
(double[] qy, double delta, double[] diag, double[] work1, double[] work2, double[] work3) Deprecated.Determine the Levenberg-Marquardt parameter.protected PointVectorValuePair
Deprecated.Performs the bulk of the optimization algorithm.private void
qrDecomposition
(RealMatrix jacobian) Deprecated.Decompose a matrix A as A.P = Q.R using Householder transforms.private void
qTy
(double[] y) Deprecated.Compute the product Qt.y for some Q.R.Methods inherited from class org.apache.commons.math3.optim.nonlinear.vector.jacobian.AbstractLeastSquaresOptimizer
computeCost, computeCovariances, computeResiduals, computeSigma, computeWeightedJacobian, getChiSquare, getRMS, getWeightSquareRoot, optimize, parseOptimizationData, setCost
Methods inherited from class org.apache.commons.math3.optim.nonlinear.vector.JacobianMultivariateVectorOptimizer
computeJacobian
Methods inherited from class org.apache.commons.math3.optim.nonlinear.vector.MultivariateVectorOptimizer
computeObjectiveValue, getTarget, getTargetSize, getWeight
Methods inherited from class org.apache.commons.math3.optim.BaseMultivariateOptimizer
getLowerBound, getStartPoint, getUpperBound
Methods inherited from class org.apache.commons.math3.optim.BaseOptimizer
getConvergenceChecker, getEvaluations, getIterations, getMaxEvaluations, getMaxIterations, incrementEvaluationCount, incrementIterationCount, optimize
-
Field Details
-
TWO_EPS
private static final double TWO_EPSDeprecated.Twice the "epsilon machine". -
solvedCols
private int solvedColsDeprecated.Number of solved point. -
diagR
private double[] diagRDeprecated.Diagonal elements of the R matrix in the Q.R. decomposition. -
jacNorm
private double[] jacNormDeprecated.Norms of the columns of the jacobian matrix. -
beta
private double[] betaDeprecated.Coefficients of the Householder transforms vectors. -
permutation
private int[] permutationDeprecated.Columns permutation array. -
rank
private int rankDeprecated.Rank of the jacobian matrix. -
lmPar
private double lmParDeprecated.Levenberg-Marquardt parameter. -
lmDir
private double[] lmDirDeprecated.Parameters evolution direction associated with lmPar. -
initialStepBoundFactor
private final double initialStepBoundFactorDeprecated.Positive input variable used in determining the initial step bound. -
costRelativeTolerance
private final double costRelativeToleranceDeprecated.Desired relative error in the sum of squares. -
parRelativeTolerance
private final double parRelativeToleranceDeprecated.Desired relative error in the approximate solution parameters. -
orthoTolerance
private final double orthoToleranceDeprecated.Desired max cosine on the orthogonality between the function vector and the columns of the jacobian. -
qrRankingThreshold
private final double qrRankingThresholdDeprecated.Threshold for QR ranking. -
weightedResidual
private double[] weightedResidualDeprecated.Weighted residuals. -
weightedJacobian
private double[][] weightedJacobianDeprecated.Weighted Jacobian.
-
-
Constructor Details
-
LevenbergMarquardtOptimizer
public LevenbergMarquardtOptimizer()Deprecated.Build an optimizer for least squares problems with default values for all the tuning parameters (see theother contructor
. 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
Deprecated.Constructor that allows the specification of a custom convergence checker. Note that all the usual convergence checks will be disabled. 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
- Parameters:
checker
- Convergence checker.
-
LevenbergMarquardtOptimizer
public LevenbergMarquardtOptimizer(double initialStepBoundFactor, ConvergenceChecker<PointVectorValuePair> checker, double costRelativeTolerance, double parRelativeTolerance, double orthoTolerance, double threshold) Deprecated.Constructor that allows the specification of a custom convergence checker, in addition to the standard ones.- Parameters:
initialStepBoundFactor
- 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 toinitialStepBoundFactor
itself. In most cases factor should lie in the interval(0.1, 100.0)
.100
is a generally recommended value.checker
- Convergence checker.costRelativeTolerance
- Desired relative error in the sum of squares.parRelativeTolerance
- Desired relative error in the approximate solution parameters.orthoTolerance
- Desired max cosine on the orthogonality between the function vector and the columns of the Jacobian.threshold
- 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.
-
LevenbergMarquardtOptimizer
public LevenbergMarquardtOptimizer(double costRelativeTolerance, double parRelativeTolerance, double orthoTolerance) Deprecated.Build an optimizer for least squares problems with default values for some of the tuning parameters (see theother contructor
. The default values for the algorithm settings are:- Initial step bound factor}: 100
- QR ranking threshold}:
Precision.SAFE_MIN
- Parameters:
costRelativeTolerance
- Desired relative error in the sum of squares.parRelativeTolerance
- Desired relative error in the approximate solution parameters.orthoTolerance
- Desired max cosine on the orthogonality between the function vector and the columns of the Jacobian.
-
LevenbergMarquardtOptimizer
public LevenbergMarquardtOptimizer(double initialStepBoundFactor, double costRelativeTolerance, double parRelativeTolerance, double orthoTolerance, double threshold) Deprecated.The arguments control the behaviour of the default convergence checking procedure. Additional criteria can defined through the setting of aConvergenceChecker
.- Parameters:
initialStepBoundFactor
- 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 toinitialStepBoundFactor
itself. In most cases factor should lie in the interval(0.1, 100.0)
.100
is a generally recommended value.costRelativeTolerance
- Desired relative error in the sum of squares.parRelativeTolerance
- Desired relative error in the approximate solution parameters.orthoTolerance
- Desired max cosine on the orthogonality between the function vector and the columns of the Jacobian.threshold
- 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.
-
-
Method Details
-
doOptimize
Deprecated.Performs the bulk of the optimization algorithm.- Specified by:
doOptimize
in classBaseOptimizer<PointVectorValuePair>
- Returns:
- the point/value pair giving the optimal value of the objective function.
-
determineLMParameter
private void determineLMParameter(double[] qy, double delta, double[] diag, double[] work1, double[] work2, double[] work3) Deprecated.Determine the Levenberg-Marquardt parameter.This implementation is a translation in Java of the MINPACK lmpar routine.
This method sets the lmPar and lmDir attributes.
The authors of the original fortran function are:
- Argonne National Laboratory. MINPACK project. March 1980
- Burton S. Garbow
- Kenneth E. Hillstrom
- Jorge J. More
Luc Maisonobe did the Java translation.
- Parameters:
qy
- array containing qTydelta
- upper bound on the euclidean norm of diagR * lmDirdiag
- diagonal matrixwork1
- work arraywork2
- work arraywork3
- work array
-
determineLMDirection
private void determineLMDirection(double[] qy, double[] diag, double[] lmDiag, double[] work) Deprecated.Solve a*x = b and d*x = 0 in the least squares sense.This implementation is a translation in Java of the MINPACK qrsolv routine.
This method sets the lmDir and lmDiag attributes.
The authors of the original fortran function are:
- Argonne National Laboratory. MINPACK project. March 1980
- Burton S. Garbow
- Kenneth E. Hillstrom
- Jorge J. More
Luc Maisonobe did the Java translation.
- Parameters:
qy
- array containing qTydiag
- diagonal matrixlmDiag
- diagonal elements associated with lmDirwork
- work array
-
qrDecomposition
Deprecated.Decompose a matrix A as A.P = Q.R using Householder transforms.As suggested in the P. Lascaux and R. Theodor book Analyse numérique matricielle appliquée à l'art de l'ingénieur (Masson, 1986), instead of representing the Householder transforms with uk unit vectors such that:
Hk = I - 2uk.ukt
we use k non-unit vectors such that:Hk = I - betakvk.vkt
where vk = ak - alphak ek. The betak coefficients are provided upon exit as recomputing them from the vk vectors would be costly.This decomposition handles rank deficient cases since the tranformations are performed in non-increasing columns norms order thanks to columns pivoting. The diagonal elements of the R matrix are therefore also in non-increasing absolute values order.
- Parameters:
jacobian
- Weighted Jacobian matrix at the current point.- Throws:
ConvergenceException
- if the decomposition cannot be performed
-
qTy
private void qTy(double[] y) Deprecated.Compute the product Qt.y for some Q.R. decomposition.- Parameters:
y
- vector to multiply (will be overwritten with the result)
-
checkParameters
private void checkParameters()Deprecated.- Throws:
MathUnsupportedOperationException
- if bounds were passed to theoptimize
method.
-
org.apache.commons.math3.fitting.leastsquares
package (cf. MATH-1008).