org.apache.commons.math3.optimization.general

## Class AbstractLeastSquaresOptimizer

• ### Field Detail

• #### cols

@Deprecated
protected int cols
Deprecated. As of 3.1.
Number of columns of the jacobian matrix.
• #### rows

@Deprecated
protected int rows
Deprecated. As of 3.1.
Number of rows of the jacobian matrix.
• #### point

@Deprecated
protected double[] point
Deprecated. As of 3.1.
Current point.
• #### objective

@Deprecated
protected double[] objective
Deprecated. As of 3.1.
Current objective function value.
• #### cost

@Deprecated
protected double cost
Deprecated. As of 3.1. Field to become "private" in 4.0. Please use setCost(double).
Cost value (square root of the sum of the residuals).
• ### Method Detail

• #### getJacobianEvaluations

public int getJacobianEvaluations()
Deprecated.
Returns:
the number of evaluations of the Jacobian function.
• #### computeWeightedJacobian

protected RealMatrix computeWeightedJacobian(double[] params)
Deprecated.
Computes the Jacobian matrix.
Parameters:
params - Model parameters at which to compute the Jacobian.
Returns:
the weighted Jacobian: W1/2 J.
Throws:
DimensionMismatchException - if the Jacobian dimension does not match problem dimension.
Since:
3.1
• #### computeCost

protected double computeCost(double[] residuals)
Deprecated.
Computes the cost.
Parameters:
residuals - Residuals.
Returns:
the cost.
Since:
3.1
computeResiduals(double[])
• #### getRMS

public double getRMS()
Deprecated.
Get the Root Mean Square value. Get the Root Mean Square value, i.e. the root of the arithmetic mean of the square of all weighted residuals. This is related to the criterion that is minimized by the optimizer as follows: if c if the criterion, and n is the number of measurements, then the RMS is sqrt (c/n).
Returns:
RMS value
• #### getChiSquare

public 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.
Returns:
chi-square value
• #### getWeightSquareRoot

public RealMatrix getWeightSquareRoot()
Deprecated.
Gets the square-root of the weight matrix.
Returns:
the square-root of the weight matrix.
Since:
3.1
• #### setCost

protected void setCost(double cost)
Deprecated.
Sets the cost.
Parameters:
cost - Cost value.
Since:
3.1
• #### getCovariances

@Deprecated
public double[][] getCovariances(double threshold)
Get the covariance matrix of the optimized parameters.
Note that this operation involves the inversion of the 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.
Parameters:
threshold - Singularity threshold.
Returns:
the covariance matrix.
Throws:
SingularMatrixException - if the covariance matrix cannot be computed (singular problem).
• #### computeCovariances

public double[][] computeCovariances(double[] params,
double threshold)
Deprecated.
Get the covariance matrix of the optimized parameters.
Note that this operation involves the inversion of the 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.
Parameters:
params - Model parameters.
threshold - Singularity threshold.
Returns:
the covariance matrix.
Throws:
SingularMatrixException - if the covariance matrix cannot be computed (singular problem).
Since:
3.1
• #### guessParametersErrors

@Deprecated
public 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.

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.

Returns:
an estimate of the standard deviation of the optimized parameters
Throws:
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.
• #### computeSigma

public double[] computeSigma(double[] params,
double covarianceSingularityThreshold)
Deprecated.
Computes an estimate of the standard deviation of the parameters. The returned values are the square root of the diagonal coefficients of the covariance matrix, 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.
Parameters:
params - Model parameters.
covarianceSingularityThreshold - Singularity threshold (see computeCovariances).
Returns:
an estimate of the standard deviation of the optimized parameters
Throws:
SingularMatrixException - if the covariance matrix cannot be computed.
Since:
3.1
• #### computeResiduals

protected double[] computeResiduals(double[] objectiveValue)
Deprecated.
Computes the residuals. The residual is the difference between the observed (target) values and the model (objective function) value. There is one residual for each element of the vector-valued function.
Parameters:
objectiveValue - Value of the the objective function. This is the value returned from a call to computeObjectiveValue (whose array argument contains the model parameters).
Returns:
the residuals.
Throws:
DimensionMismatchException - if params has a wrong length.
Since:
3.1