public abstract class AbstractLeastSquaresOptimizer extends BaseAbstractMultivariateVectorOptimizer<DifferentiableMultivariateVectorFunction> implements DifferentiableMultivariateVectorOptimizer
DifferentiableMultivariateVectorFunction.jacobian()
of the function argument in method
optimize
and assumes that, in the matrix returned by the
value
method, the rows
iterate on the model functions while the columns iterate on the parameters; thus,
the numbers of rows is equal to the length of the target
array while the
number of columns is equal to the length of the startPoint
array.Modifier and Type | Field and Description |
---|---|
protected int |
cols
Number of columns of the jacobian matrix.
|
protected double |
cost
Cost value (square root of the sum of the residuals).
|
protected double[] |
objective
Current objective function value.
|
protected double[] |
point
Current point.
|
protected int |
rows
Number of rows of the jacobian matrix.
|
protected double[][] |
weightedResidualJacobian
Jacobian matrix of the weighted residuals.
|
protected double[] |
weightedResiduals
Weighted residuals
|
evaluations
Modifier | Constructor and Description |
---|---|
protected |
AbstractLeastSquaresOptimizer()
Simple constructor with default settings.
|
protected |
AbstractLeastSquaresOptimizer(ConvergenceChecker<PointVectorValuePair> checker) |
Modifier and Type | Method and Description |
---|---|
double |
getChiSquare()
Get a Chi-Square-like value assuming the N residuals follow N
distinct normal distributions centered on 0 and whose variances are
the reciprocal of the weights.
|
double[][] |
getCovariances()
Get the covariance matrix of the optimized parameters.
|
double[][] |
getCovariances(double threshold)
Get the covariance matrix of the optimized parameters.
|
int |
getJacobianEvaluations() |
double |
getRMS()
Get the Root Mean Square value.
|
double[] |
guessParametersErrors()
Guess the errors in optimized parameters.
|
PointVectorValuePair |
optimize(int maxEval,
DifferentiableMultivariateVectorFunction f,
double[] target,
double[] weights,
double[] startPoint)
Optimize an objective function.
|
protected void |
updateJacobian()
Update the jacobian matrix.
|
protected void |
updateResidualsAndCost()
Update the residuals array and cost function value.
|
computeObjectiveValue, doOptimize, getConvergenceChecker, getEvaluations, getMaxEvaluations, getStartPoint, getTargetRef, getWeightRef
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getConvergenceChecker, getEvaluations, getMaxEvaluations
protected double[][] weightedResidualJacobian
updateJacobian()
, but may be modified by the solver
in the derived class (the Levenberg-Marquardt optimizer
does this).protected int cols
protected int rows
protected double[] point
protected double[] objective
protected double[] weightedResiduals
protected double cost
protected AbstractLeastSquaresOptimizer()
SimpleVectorValueChecker
.protected AbstractLeastSquaresOptimizer(ConvergenceChecker<PointVectorValuePair> checker)
checker
- Convergence checker.public int getJacobianEvaluations()
protected void updateJacobian()
DimensionMismatchException
- if the Jacobian dimension does not
match problem dimension.protected void updateResidualsAndCost()
DimensionMismatchException
- if the dimension does not match the
problem dimension.TooManyEvaluationsException
- if the maximal number of evaluations is exceeded.public double getRMS()
public double getChiSquare()
public double[][] getCovariances()
SingularMatrixException
- if the covariance matrix cannot be computed (singular problem).getCovariances(double)
public double[][] getCovariances(double threshold)
JTJ
matrix, where J
is the
Jacobian matrix.
The threshold
parameter is a way for the caller to specify
that the result of this computation should be considered meaningless,
and thus trigger an exception.threshold
- Singularity threshold.SingularMatrixException
- if the covariance matrix cannot be computed (singular problem).public double[] guessParametersErrors()
SingularMatrixException
- if the covariances matrix cannot be computed.NumberIsTooSmallException
- if the number of degrees of freedom is not
positive, i.e. the number of measurements is less or equal to the number of
parameters.public PointVectorValuePair optimize(int maxEval, DifferentiableMultivariateVectorFunction f, double[] target, double[] weights, double[] startPoint)
∑weighti(objectivei - targeti)2
optimize
in interface BaseMultivariateVectorOptimizer<DifferentiableMultivariateVectorFunction>
optimize
in class BaseAbstractMultivariateVectorOptimizer<DifferentiableMultivariateVectorFunction>
maxEval
- Maximum number of function evaluations.f
- Objective function.target
- Target value for the objective functions at optimum.weights
- Weights for the least squares cost computation.startPoint
- Start point for optimization.Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.