public class LeastSquaresConverter extends Object implements MultivariateFunction
vectorial objective functions
to scalar objective functions
when the goal is to minimize them. MultivariateFunction
interface and can therefore be
minimized by any optimizer supporting scalar objectives functions.This is one way
to perform a least square estimation. There are other ways to do this without using
this converter, as some optimization algorithms directly support vectorial objective
functions. MultivariateFunction
,
MultivariateVectorFunction
Constructor and Description |
---|
LeastSquaresConverter(MultivariateVectorFunction functionIn,
double[] observationsIn)
Builds a simple converter for uncorrelated residuals with identical
weights.
|
LeastSquaresConverter(MultivariateVectorFunction functionIn,
double[] observationsIn,
double[] weightsIn)
Builds a simple converter for uncorrelated residuals with the
specified weights.
|
LeastSquaresConverter(MultivariateVectorFunction functionIn,
double[] observationsIn,
RealMatrix scaleIn)
Builds a simple converter for correlated residuals with the
specified weights.
|
public LeastSquaresConverter(MultivariateVectorFunction functionIn, double[] observationsIn)
functionIn
- vectorial residuals function to wrapobservationsIn
- observations to be compared to objective function to compute residualspublic LeastSquaresConverter(MultivariateVectorFunction functionIn, double[] observationsIn, double[] weightsIn)
The scalar objective function value is computed as:
objective = ∑weighti(observationi-objectivei)2
Weights can be used for example to combine residuals with different standard deviations. As an example, consider a residuals array in which even elements are angular measurements in degrees with a 0.01° standard deviation and odd elements are distance measurements in meters with a 15m standard deviation. In this case, the weights array should be initialized with value 1.0/(0.012) in the even elements and 1.0/(15.02) in the odd elements (i.e. reciprocals of variances).
The array computed by the objective function, the observations array and the weights array must have consistent
sizes or a DimensionMismatchException
will be triggered while computing the scalar objective.
functionIn
- vectorial residuals function to wrapobservationsIn
- observations to be compared to objective function to compute residualsweightsIn
- weights to apply to the residualsDimensionMismatchException
- if the observations vector and the weights
vector dimensions do not match (objective function dimension is checked only when
the value(double[])
method is called)public LeastSquaresConverter(MultivariateVectorFunction functionIn, double[] observationsIn, RealMatrix scaleIn)
The scalar objective function value is computed as:
objective = yTy with y = scale×(observation-objective)
The array computed by the objective function, the observations array and the the scaling matrix must have
consistent sizes or a DimensionMismatchException
will be triggered while computing the scalar objective.
functionIn
- vectorial residuals function to wrapobservationsIn
- observations to be compared to objective function to compute residualsscaleIn
- scaling matrixDimensionMismatchException
- if the observations vector and the scale
matrix dimensions do not match (objective function dimension is checked only when
the value(double[])
method is called)public double value(double[] point)
value
in interface MultivariateFunction
point
- Point at which the function must be evaluated.Copyright © 2017 CNES. All rights reserved.