Top Description Fields Constructors Methods
org.apache.commons.math3.fitting.leastsquares

pack-priv Class OptimumImpl

extends Object
implements Optimum
Class Inheritance
All Implemented Interfaces
org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer.Optimum, org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation
Imports
org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer.Optimum, .LeastSquaresProblem.Evaluation, org.apache.commons.math3.linear.RealMatrix, .RealVector

A pedantic implementation of Optimum.
Since
3.3

Field Summary

Modifier and TypeField and Description
private final int
evaluations

number of evaluations to compute this optimum

private final int
iterations

number of iterations to compute this optimum

private final LeastSquaresProblem.Evaluation
value

abscissa and ordinate

Constructor Summary

AccessConstructor and Description
pack-priv
OptimumImpl(final LeastSquaresProblem.Evaluation
the function value
value
,
final int
number of times the function was evaluated
evaluations
,
final int
number of iterations of the algorithm
iterations
)

Construct an optimum from an evaluation and the values of the counters.

Method Summary

Modifier and TypeMethod and Description
public double
public RealMatrix
getCovariances(double
Singularity threshold.
threshold
)

Implements org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation.getCovariances.

Get the covariance matrix of the optimized parameters.

public int
getEvaluations()

Implements org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer.Optimum.getEvaluations.

Get the number of times the model was evaluated in order to produce this optimum.

public int
getIterations()

Implements org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer.Optimum.getIterations.

Get the number of times the algorithm iterated in order to produce this optimum.

public RealMatrix
public RealVector
getPoint()

Implements org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation.getPoint.

Get the abscissa (independent variables) of this evaluation.

public RealVector
public double
public RealVector
getSigma(double
Singularity threshold (see computeCovariances).
covarianceSingularityThreshold
)

Implements org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation.getSigma.

Get an estimate of the standard deviation of the parameters.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

evaluationsback to summary
private final int evaluations

number of evaluations to compute this optimum

iterationsback to summary
private final int iterations

number of iterations to compute this optimum

valueback to summary
private final LeastSquaresProblem.Evaluation value

abscissa and ordinate

Constructor Detail

OptimumImplback to summary
pack-priv OptimumImpl(final LeastSquaresProblem.Evaluation value, final int evaluations, final int iterations)

Construct an optimum from an evaluation and the values of the counters.

Parameters
value:LeastSquaresProblem.Evaluation

the function value

evaluations:int

number of times the function was evaluated

iterations:int

number of iterations of the algorithm

Method Detail

getCostback to summary
public double getCost()

Implements org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation.getCost.

Doc from org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation.getCost.

Get the cost.

Returns:double

the cost.

getCovariancesback to summary
public RealMatrix getCovariances(double threshold)

Implements org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation.getCovariances.

Doc from org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation.getCovariances.

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:double

Singularity threshold.

Returns:RealMatrix

the covariance matrix.

getEvaluationsback to summary
public int getEvaluations()

Implements org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer.Optimum.getEvaluations.

Doc from org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer.Optimum.getEvaluations.

Get the number of times the model was evaluated in order to produce this optimum.

Returns:int

the number of model (objective) function evaluations

getIterationsback to summary
public int getIterations()

Implements org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer.Optimum.getIterations.

Doc from org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer.Optimum.getIterations.

Get the number of times the algorithm iterated in order to produce this optimum. In general least squares it is common to have one evaluation per iterations.

Returns:int

the number of iterations

getJacobianback to summary
public RealMatrix getJacobian()

Implements org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation.getJacobian.

Doc from org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation.getJacobian.

Get the weighted Jacobian matrix.

Returns:RealMatrix

the weighted Jacobian: W1/2 J.

getPointback to summary
public RealVector getPoint()

Implements org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation.getPoint.

Doc from org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation.getPoint.

Get the abscissa (independent variables) of this evaluation.

Returns:RealVector

the point provided to evaluate(RealVector).

getResidualsback to summary
public RealVector getResiduals()

Implements org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation.getResiduals.

Doc from org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation.getResiduals.

Get the weighted 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. The raw residuals are then multiplied by the square root of the weight matrix.

Returns:RealVector

the weighted residuals: W1/2 K.

getRMSback to summary
public double getRMS()

Implements org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation.getRMS.

Doc from org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation.getRMS.

Get the normalized cost. It is the square-root of the sum of squared of the residuals, divided by the number of measurements.

Returns:double

the cost.

getSigmaback to summary
public RealVector getSigma(double covarianceSingularityThreshold)

Implements org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation.getSigma.

Doc from org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation.getSigma.

Get 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
covarianceSingularityThreshold:double

Singularity threshold (see computeCovariances).

Returns:RealVector

an estimate of the standard deviation of the optimized parameters