|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.math3.optimization.direct.BaseAbstractMultivariateVectorOptimizer<DifferentiableMultivariateVectorFunction> org.apache.commons.math3.optimization.general.AbstractLeastSquaresOptimizer
@Deprecated 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 constructs the Jacobian matrix of the function argument in method
optimize
and assumes that the rows of that matrix iterate on the model
functions while the columns iterate on the parameters; thus, the numbers
of rows is equal to the dimension of the
Target
while
the number of columns is equal to the dimension of the
InitialGuess
.
Field Summary | |
---|---|
protected int |
cols
Deprecated. As of 3.1. |
protected double |
cost
Deprecated. As of 3.1. Field to become "private" in 4.0. Please use setCost(double) . |
protected double[] |
objective
Deprecated. As of 3.1. |
protected double[] |
point
Deprecated. As of 3.1. |
protected int |
rows
Deprecated. As of 3.1. |
protected double[][] |
weightedResidualJacobian
Deprecated. As of 3.1. To be removed in 4.0. Please use computeWeightedJacobian(double[]) instead. |
protected double[] |
weightedResiduals
Deprecated. As of 3.1. |
Fields inherited from class org.apache.commons.math3.optimization.direct.BaseAbstractMultivariateVectorOptimizer |
---|
evaluations |
Constructor Summary | |
---|---|
protected |
AbstractLeastSquaresOptimizer()
Deprecated. See SimpleValueChecker.SimpleValueChecker() |
protected |
AbstractLeastSquaresOptimizer(ConvergenceChecker<PointVectorValuePair> checker)
Deprecated. |
Method Summary | |
---|---|
protected double |
computeCost(double[] residuals)
Deprecated. Computes the cost. |
double[][] |
computeCovariances(double[] params,
double threshold)
Deprecated. Get the covariance matrix of the optimized parameters. |
protected double[] |
computeResiduals(double[] objectiveValue)
Deprecated. Computes the residuals. |
double[] |
computeSigma(double[] params,
double covarianceSingularityThreshold)
Deprecated. Computes an estimate of the standard deviation of the parameters. |
protected RealMatrix |
computeWeightedJacobian(double[] params)
Deprecated. Computes the Jacobian matrix. |
double |
getChiSquare()
Deprecated. 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()
Deprecated. As of 3.1. Please use computeCovariances(double[],double)
instead. |
double[][] |
getCovariances(double threshold)
Deprecated. As of 3.1. Please use computeCovariances(double[],double)
instead. |
int |
getJacobianEvaluations()
Deprecated. |
double |
getRMS()
Deprecated. Get the Root Mean Square value. |
RealMatrix |
getWeightSquareRoot()
Deprecated. Gets the square-root of the weight matrix. |
double[] |
guessParametersErrors()
Deprecated. as of version 3.1, computeSigma(double[],double) should be used
instead. It should be emphasized that guessParametersErrors and
computeSigma are not strictly equivalent. |
PointVectorValuePair |
optimize(int maxEval,
DifferentiableMultivariateVectorFunction f,
double[] target,
double[] weights,
double[] startPoint)
Deprecated. As of 3.1. Please use optimize(int,MultivariateDifferentiableVectorFunction,OptimizationData...)
instead. |
PointVectorValuePair |
optimize(int maxEval,
MultivariateDifferentiableVectorFunction f,
double[] target,
double[] weights,
double[] startPoint)
Deprecated. As of 3.1. Please use optimize(int,MultivariateDifferentiableVectorFunction,OptimizationData...)
instead. |
protected PointVectorValuePair |
optimizeInternal(int maxEval,
MultivariateDifferentiableVectorFunction f,
OptimizationData... optData)
Deprecated. As of 3.1. Override is necessary only until this class's generic argument is changed to MultivariateDifferentiableVectorFunction . |
protected void |
setCost(double cost)
Deprecated. Sets the cost. |
protected void |
setUp()
Deprecated. Method which a subclass must override whenever its internal state depend on the input parsed by this base
class. |
protected void |
updateJacobian()
Deprecated. As of 3.1. Please use computeWeightedJacobian(double[])
instead. |
protected void |
updateResidualsAndCost()
Deprecated. As of 3.1. Please use computeResiduals(double[]) ,
BaseAbstractMultivariateVectorOptimizer.computeObjectiveValue(double[]) , computeCost(double[])
and setCost(double) instead. |
Methods inherited from class org.apache.commons.math3.optimization.direct.BaseAbstractMultivariateVectorOptimizer |
---|
computeObjectiveValue, doOptimize, getConvergenceChecker, getEvaluations, getMaxEvaluations, getObjectiveFunction, getStartPoint, getTarget, getTargetRef, getWeight, getWeightRef, optimize, optimizeInternal, optimizeInternal |
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 |
---|
@Deprecated protected double[][] weightedResidualJacobian
computeWeightedJacobian(double[])
instead.updateJacobian()
, but may be modified by the solver
in the derived class (the Levenberg-Marquardt optimizer
does this).
@Deprecated protected int cols
@Deprecated protected int rows
@Deprecated protected double[] point
@Deprecated protected double[] objective
@Deprecated protected double[] weightedResiduals
@Deprecated protected double cost
setCost(double)
.
Constructor Detail |
---|
@Deprecated protected AbstractLeastSquaresOptimizer()
SimpleValueChecker.SimpleValueChecker()
SimpleVectorValueChecker
.
protected AbstractLeastSquaresOptimizer(ConvergenceChecker<PointVectorValuePair> checker)
checker
- Convergence checker.Method Detail |
---|
public int getJacobianEvaluations()
@Deprecated protected void updateJacobian()
computeWeightedJacobian(double[])
instead.
DimensionMismatchException
- if the Jacobian dimension does not
match problem dimension.protected RealMatrix computeWeightedJacobian(double[] params)
params
- Model parameters at which to compute the Jacobian.
DimensionMismatchException
- if the Jacobian dimension does not
match problem dimension.@Deprecated protected void updateResidualsAndCost()
computeResiduals(double[])
,
BaseAbstractMultivariateVectorOptimizer.computeObjectiveValue(double[])
, computeCost(double[])
and setCost(double)
instead.
DimensionMismatchException
- if the dimension does not match the
problem dimension.
TooManyEvaluationsException
- if the maximal number of evaluations is exceeded.protected double computeCost(double[] residuals)
residuals
- Residuals.
computeResiduals(double[])
public double getRMS()
public double getChiSquare()
public RealMatrix getWeightSquareRoot()
protected void setCost(double cost)
cost
- Cost value.@Deprecated public double[][] getCovariances()
computeCovariances(double[],double)
instead.
SingularMatrixException
- if the covariance matrix cannot be computed (singular problem).getCovariances(double)
@Deprecated public double[][] getCovariances(double threshold)
computeCovariances(double[],double)
instead.
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[][] computeCovariances(double[] params, 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.
params
- Model parameters.threshold
- Singularity threshold.
SingularMatrixException
- if the covariance matrix cannot be computed (singular problem).@Deprecated public double[] guessParametersErrors()
computeSigma(double[],double)
should be used
instead. It should be emphasized that guessParametersErrors
and
computeSigma
are not strictly equivalent.
Returns an estimate of the standard deviation of each parameter. The
returned values are the so-called (asymptotic) standard errors on the
parameters, defined as sd(a[i]) = sqrt(S / (n - m) * C[i][i])
,
where a[i]
is the optimized value of the i
-th parameter,
S
is the minimized value of the sum of squares objective function
(as returned by getChiSquare()
), n
is the number of
observations, m
is the number of parameters and C
is the
covariance matrix.
See also Wikipedia, or MathWorld, equations (34) and (35) for a particular case.
SingularMatrixException
- if the covariance 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 double[] computeSigma(double[] params, double covarianceSingularityThreshold)
sd(a[i]) ~= sqrt(C[i][i])
, where a[i]
is the optimized value of the i
-th parameter, and C
is
the covariance matrix.
params
- Model parameters.covarianceSingularityThreshold
- Singularity threshold (see
computeCovariances
).
SingularMatrixException
- if the covariance matrix cannot be computed.@Deprecated public PointVectorValuePair optimize(int maxEval, DifferentiableMultivariateVectorFunction f, double[] target, double[] weights, double[] startPoint)
optimize(int,MultivariateDifferentiableVectorFunction,OptimizationData...)
instead.
∑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.
@Deprecated public PointVectorValuePair optimize(int maxEval, MultivariateDifferentiableVectorFunction f, double[] target, double[] weights, double[] startPoint)
optimize(int,MultivariateDifferentiableVectorFunction,OptimizationData...)
instead.
∑weighti(objectivei - targeti)2
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.maxEval
- Maximum number of function evaluations.
DimensionMismatchException
- if the start point dimension is wrong.
TooManyEvaluationsException
- if the maximal number of evaluations is exceeded.
NullArgumentException
- if
any argument is null
.@Deprecated protected PointVectorValuePair optimizeInternal(int maxEval, MultivariateDifferentiableVectorFunction f, OptimizationData... optData)
MultivariateDifferentiableVectorFunction
.
∑weighti(objectivei - targeti)2
maxEval
- Allowed number of evaluations of the objective function.f
- Objective function.optData
- Optimization data. The following data will be looked for:
TooManyEvaluationsException
- if
the maximal number of evaluations is exceeded.
DimensionMismatchException
- if the target, and weight arguments
have inconsistent dimensions.BaseAbstractMultivariateVectorOptimizer.optimizeInternal(int,MultivariateVectorFunction,OptimizationData[])
protected void setUp()
input
parsed by this base
class.
It will be called after the parsing step performed in the
optimize
method and just before BaseAbstractMultivariateVectorOptimizer.doOptimize()
.
setUp
in class BaseAbstractMultivariateVectorOptimizer<DifferentiableMultivariateVectorFunction>
protected double[] computeResiduals(double[] objectiveValue)
objectiveValue
- Value of the the objective function. This is
the value returned from a call to
computeObjectiveValue
(whose array argument contains the model parameters).
DimensionMismatchException
- if params
has a wrong
length.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |