|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math3.optimization.direct.BaseAbstractMultivariateVectorOptimizer<DifferentiableMultivariateVectorFunction>
org.apache.commons.math3.optimization.general.AbstractLeastSquaresOptimizer
public abstract class AbstractLeastSquaresOptimizer
Base class for implementing least squares optimizers.
It handles the boilerplate methods associated to thresholds settings,
jacobian and error estimation.
This class uses the 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.
Field Summary | |
---|---|
protected int |
cols
Number of columns of the jacobian matrix. |
protected double |
cost
Cost value (square root of the sum of the residuals). |
private static double |
DEFAULT_SINGULARITY_THRESHOLD
Singularity threshold (cf. |
private int |
jacobianEvaluations
Number of evaluations of the Jacobian. |
private MultivariateMatrixFunction |
jF
Objective function derivatives. |
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 |
Fields inherited from class org.apache.commons.math3.optimization.direct.BaseAbstractMultivariateVectorOptimizer |
---|
evaluations |
Constructor Summary | |
---|---|
protected |
AbstractLeastSquaresOptimizer()
Simple constructor with default settings. |
protected |
AbstractLeastSquaresOptimizer(ConvergenceChecker<PointVectorValuePair> checker)
|
Method Summary | |
---|---|
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. |
Methods inherited from class org.apache.commons.math3.optimization.direct.BaseAbstractMultivariateVectorOptimizer |
---|
computeObjectiveValue, doOptimize, getConvergenceChecker, getEvaluations, getMaxEvaluations, getStartPoint, getTargetRef, getWeightRef |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.commons.math3.optimization.BaseOptimizer |
---|
getConvergenceChecker, getEvaluations, getMaxEvaluations |
Field Detail |
---|
private static final double DEFAULT_SINGULARITY_THRESHOLD
getCovariances(double)
).
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
private MultivariateMatrixFunction jF
private int jacobianEvaluations
Constructor Detail |
---|
protected AbstractLeastSquaresOptimizer()
SimpleVectorValueChecker
.
protected AbstractLeastSquaresOptimizer(ConvergenceChecker<PointVectorValuePair> checker)
checker
- Convergence checker.Method Detail |
---|
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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |