Class AbstractEvaluation
- java.lang.Object
-
- org.apache.commons.math4.legacy.fitting.leastsquares.AbstractEvaluation
-
- All Implemented Interfaces:
LeastSquaresProblem.Evaluation
public abstract class AbstractEvaluation extends Object implements LeastSquaresProblem.Evaluation
An implementation ofLeastSquaresProblem.Evaluation
that is designed for extension. All of the methods implemented here use the methods that are left unimplemented.TODO cache results?
- Since:
- 3.3
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getChiSquare()
Get the sum of the squares of the residuals.double
getCost()
Get the cost.RealMatrix
getCovariances(double threshold)
Get the covariance matrix of the optimized parameters.double
getReducedChiSquare(int numberOfFittedParameters)
Get the reduced chi-square.double
getRMS()
Get the normalized cost.RealVector
getSigma(double covarianceSingularityThreshold)
Get an estimate of the standard deviation of the parameters.-
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.math4.legacy.fitting.leastsquares.LeastSquaresProblem.Evaluation
getJacobian, getPoint, getResiduals
-
-
-
-
Method Detail
-
getCovariances
public RealMatrix getCovariances(double threshold)
Get the covariance matrix of the optimized parameters.
Note that this operation involves the inversion of theJTJ
matrix, whereJ
is the Jacobian matrix. Thethreshold
parameter is a way for the caller to specify that the result of this computation should be considered meaningless, and thus trigger an exception.- Specified by:
getCovariances
in interfaceLeastSquaresProblem.Evaluation
- Parameters:
threshold
- Singularity threshold.- Returns:
- the covariance matrix.
-
getSigma
public RealVector getSigma(double covarianceSingularityThreshold)
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])
, wherea[i]
is the optimized value of thei
-th parameter, andC
is the covariance matrix.- Specified by:
getSigma
in interfaceLeastSquaresProblem.Evaluation
- Parameters:
covarianceSingularityThreshold
- Singularity threshold (seecomputeCovariances
).- Returns:
- an estimate of the standard deviation of the optimized parameters
-
getRMS
public double getRMS()
Get the normalized cost. It is the square-root of the sum of squared of the residuals, divided by the number of measurements.- Specified by:
getRMS
in interfaceLeastSquaresProblem.Evaluation
- Returns:
- the cost.
-
getCost
public double getCost()
Get the cost. It is the square-root of theobjective function
.- Specified by:
getCost
in interfaceLeastSquaresProblem.Evaluation
- Returns:
- the cost.
- See Also:
LeastSquaresProblem.Evaluation.getResiduals()
,LeastSquaresProblem.Evaluation.getChiSquare()
-
getChiSquare
public double getChiSquare()
Get the sum of the squares of the residuals.- Specified by:
getChiSquare
in interfaceLeastSquaresProblem.Evaluation
- Returns:
- the cost.
- See Also:
LeastSquaresProblem.Evaluation.getResiduals()
,LeastSquaresProblem.Evaluation.getCost()
-
getReducedChiSquare
public double getReducedChiSquare(int numberOfFittedParameters)
Get the reduced chi-square.- Specified by:
getReducedChiSquare
in interfaceLeastSquaresProblem.Evaluation
- Parameters:
numberOfFittedParameters
- Number of fitted parameters.- Returns:
- the sum of the squares of the residuals divided by the number of degrees of freedom.
-
-