@Deprecated public class LevenbergMarquardtEstimator extends AbstractEstimator implements java.io.Serializable
This implementation should work even for over-determined systems (i.e. systems having more variables than equations). Over-determined systems are solved by ignoring the variables 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 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 int |
rank
Deprecated.
Rank of the jacobian matrix.
|
private static long |
serialVersionUID
Deprecated.
Serializable version identifier
|
private int |
solvedCols
Deprecated.
Number of solved variables.
|
cols, cost, DEFAULT_MAX_COST_EVALUATIONS, jacobian, measurements, parameters, residuals, rows
Constructor and Description |
---|
LevenbergMarquardtEstimator()
Deprecated.
Build an estimator for least squares problems.
|
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.
|
void |
estimate(EstimationProblem problem)
Deprecated.
Solve an estimation problem using the Levenberg-Marquardt algorithm.
|
private void |
qrDecomposition()
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.
|
void |
setCostRelativeTolerance(double costRelativeTolerance)
Deprecated.
Set the desired relative error in the sum of squares.
|
void |
setInitialStepBoundFactor(double initialStepBoundFactor)
Deprecated.
Set the positive input variable used in determining the initial step bound.
|
void |
setOrthoTolerance(double orthoTolerance)
Deprecated.
Set the desired max cosine on the orthogonality.
|
void |
setParRelativeTolerance(double parRelativeTolerance)
Deprecated.
Set the desired relative error in the approximate solution parameters.
|
getChiSquare, getCostEvaluations, getCovariances, getJacobianEvaluations, getRMS, guessParametersErrors, incrementJacobianEvaluationsCounter, initializeEstimate, setMaxCostEval, updateJacobian, updateResidualsAndCost
private static final long serialVersionUID
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 double initialStepBoundFactor
private double costRelativeTolerance
private double parRelativeTolerance
private double orthoTolerance
public LevenbergMarquardtEstimator()
The default values for the algorithm settings are:
initial step bound factor
: 100.0maximal cost evaluations
: 1000cost relative tolerance
: 1.0e-10parameters relative tolerance
: 1.0e-10orthogonality tolerance
: 1.0e-10public void setInitialStepBoundFactor(double initialStepBoundFactor)
initialStepBoundFactor
- initial step bound factorestimate(org.apache.commons.math.estimation.EstimationProblem)
public void setCostRelativeTolerance(double costRelativeTolerance)
costRelativeTolerance
- desired relative error in the sum of squaresestimate(org.apache.commons.math.estimation.EstimationProblem)
public void setParRelativeTolerance(double parRelativeTolerance)
parRelativeTolerance
- desired relative error
in the approximate solution parametersestimate(org.apache.commons.math.estimation.EstimationProblem)
public void setOrthoTolerance(double orthoTolerance)
orthoTolerance
- desired max cosine on the orthogonality
between the function vector and the columns of the jacobianestimate(org.apache.commons.math.estimation.EstimationProblem)
public void estimate(EstimationProblem problem) throws EstimationException
The algorithm used is a modified Levenberg-Marquardt one, based
on the MINPACK lmder
routine. The algorithm settings must have been set up before this method
is called with the setInitialStepBoundFactor(double)
,
AbstractEstimator.setMaxCostEval(int)
, setCostRelativeTolerance(double)
,
setParRelativeTolerance(double)
and setOrthoTolerance(double)
methods.
If these methods have not been called, the default values set up by the
constructor
will be used.
The authors of the original fortran function are:
Luc Maisonobe did the Java translation.
estimate
in interface Estimator
estimate
in class AbstractEstimator
problem
- estimation problem to solveEstimationException
- if convergence cannot be
reached with the specified algorithm settings or if there are more variables
than equationssetInitialStepBoundFactor(double)
,
setCostRelativeTolerance(double)
,
setParRelativeTolerance(double)
,
setOrthoTolerance(double)
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() throws EstimationException
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.
EstimationException
- 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