@Deprecated public class LevenbergMarquardtOptimizer extends AbstractLeastSquaresOptimizer
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:
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:
|
Modifier and Type | Field and Description |
---|---|
private double[] |
beta
Deprecated.
Coefficients of the Householder transforms vectors.
|
private double |
costRelativeTolerance
Deprecated.
Desired relative error in the sum of squares.
|
private double[] |
diagR
Deprecated.
Diagonal elements of the R matrix in the Q.R.
|
private double |
initialStepBoundFactor
Deprecated.
Positive input variable used in determining the initial step bound.
|
private double[] |
jacNorm
Deprecated.
Norms of the columns of the jacobian matrix.
|
private double[] |
lmDir
Deprecated.
Parameters evolution direction associated with lmPar.
|
private double |
lmPar
Deprecated.
Levenberg-Marquardt parameter.
|
private double |
orthoTolerance
Deprecated.
Desired max cosine on the orthogonality between the function vector
and the columns of the jacobian.
|
private double |
parRelativeTolerance
Deprecated.
Desired relative error in the approximate solution parameters.
|
private int[] |
permutation
Deprecated.
Columns permutation array.
|
private double |
qrRankingThreshold
Deprecated.
Threshold for QR ranking.
|
private int |
rank
Deprecated.
Rank of the jacobian matrix.
|
private int |
solvedCols
Deprecated.
Number of solved point.
|
private double[][] |
weightedJacobian
Deprecated.
Weighted Jacobian.
|
private double[] |
weightedResidual
Deprecated.
Weighted residuals.
|
cols, cost, objective, point, rows, weightedResidualJacobian, weightedResiduals
evaluations
Constructor and Description |
---|
LevenbergMarquardtOptimizer()
Deprecated.
Build an optimizer for least squares problems with default values
for all the tuning parameters (see the
other contructor . |
LevenbergMarquardtOptimizer(ConvergenceChecker<PointVectorValuePair> checker)
Deprecated.
Constructor that allows the specification of a custom convergence
checker.
|
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.
|
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 the
other contructor . |
LevenbergMarquardtOptimizer(double initialStepBoundFactor,
double costRelativeTolerance,
double parRelativeTolerance,
double orthoTolerance,
double threshold)
Deprecated.
The arguments control the behaviour of the default convergence checking
procedure.
|
Modifier and Type | Method and Description |
---|---|
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 |
doOptimize()
Deprecated.
Perform 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.
|
computeCost, computeCovariances, computeResiduals, computeSigma, computeWeightedJacobian, getChiSquare, getCovariances, getCovariances, getJacobianEvaluations, getRMS, getWeightSquareRoot, guessParametersErrors, optimize, optimize, optimizeInternal, setCost, setUp, updateJacobian, updateResidualsAndCost
computeObjectiveValue, getConvergenceChecker, getEvaluations, getMaxEvaluations, getObjectiveFunction, getStartPoint, getTarget, getTargetRef, getWeight, getWeightRef, optimize, optimizeInternal, optimizeInternal
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getConvergenceChecker, getEvaluations, getMaxEvaluations
private int solvedCols
private double[] diagR
private double[] jacNorm
private double[] beta
private int[] permutation
private int rank
private double lmPar
private double[] lmDir
private final double initialStepBoundFactor
private final double costRelativeTolerance
private final double parRelativeTolerance
private final double orthoTolerance
private final double qrRankingThreshold
private double[] weightedResidual
private double[][] weightedJacobian
public LevenbergMarquardtOptimizer()
other contructor
.
The default values for the algorithm settings are:
Precision.SAFE_MIN
public LevenbergMarquardtOptimizer(ConvergenceChecker<PointVectorValuePair> checker)
Precision.SAFE_MIN
checker
- Convergence checker.public LevenbergMarquardtOptimizer(double initialStepBoundFactor, ConvergenceChecker<PointVectorValuePair> checker, double costRelativeTolerance, double parRelativeTolerance, double orthoTolerance, double threshold)
initialStepBoundFactor
- Positive input variable used in
determining the initial step bound. This bound is set to the
product of initialStepBoundFactor and the euclidean norm of
diag * x
if non-zero, or else to initialStepBoundFactor
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.public LevenbergMarquardtOptimizer(double costRelativeTolerance, double parRelativeTolerance, double orthoTolerance)
other contructor
.
The default values for the algorithm settings are:
Precision.SAFE_MIN
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.public LevenbergMarquardtOptimizer(double initialStepBoundFactor, double costRelativeTolerance, double parRelativeTolerance, double orthoTolerance, double threshold)
ConvergenceChecker
.initialStepBoundFactor
- Positive input variable used in
determining the initial step bound. This bound is set to the
product of initialStepBoundFactor and the euclidean norm of
diag * x
if non-zero, or else to initialStepBoundFactor
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.protected PointVectorValuePair doOptimize()
doOptimize
in class BaseAbstractMultivariateVectorOptimizer<DifferentiableMultivariateVectorFunction>
private void determineLMParameter(double[] qy, double delta, double[] diag, double[] work1, double[] work2, double[] work3)
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:
Luc Maisonobe did the Java translation.
qy
- array containing qTydelta
- upper bound on the euclidean norm of diagR * lmDirdiag
- diagonal matrixwork1
- work arraywork2
- work arraywork3
- work arrayprivate void determineLMDirection(double[] qy, double[] diag, double[] lmDiag, double[] work)
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:
Luc Maisonobe did the Java translation.
qy
- array containing qTydiag
- diagonal matrixlmDiag
- diagonal elements associated with lmDirwork
- work arrayprivate void qrDecomposition(RealMatrix jacobian) throws ConvergenceException
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.uktwe use k non-unit vectors such that:
Hk = I - betakvk.vktwhere 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.
jacobian
- Weighted Jacobian matrix at the current point.ConvergenceException
- if the decomposition cannot be performedprivate void qTy(double[] y)
y
- vector to multiply (will be overwritten with the result)Copyright (c) 2003-2014 Apache Software Foundation