java.lang.Object
org.apache.commons.math3.fitting.leastsquares.OptimumImpl
All Implemented Interfaces:
LeastSquaresOptimizer.Optimum, LeastSquaresProblem.Evaluation

class OptimumImpl extends Object implements LeastSquaresOptimizer.Optimum
A pedantic implementation of LeastSquaresOptimizer.Optimum.
Since:
3.3
  • Field Details

    • value

      private final LeastSquaresProblem.Evaluation value
      abscissa and ordinate
    • evaluations

      private final int evaluations
      number of evaluations to compute this optimum
    • iterations

      private final int iterations
      number of iterations to compute this optimum
  • Constructor Details

    • OptimumImpl

      OptimumImpl(LeastSquaresProblem.Evaluation value, int evaluations, int iterations)
      Construct an optimum from an evaluation and the values of the counters.
      Parameters:
      value - the function value
      evaluations - number of times the function was evaluated
      iterations - number of iterations of the algorithm
  • Method Details

    • getEvaluations

      public int getEvaluations()
      Get the number of times the model was evaluated in order to produce this optimum.
      Specified by:
      getEvaluations in interface LeastSquaresOptimizer.Optimum
      Returns:
      the number of model (objective) function evaluations
    • getIterations

      public int 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.
      Specified by:
      getIterations in interface LeastSquaresOptimizer.Optimum
      Returns:
      the number of iterations
    • getCovariances

      public RealMatrix 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.
      Specified by:
      getCovariances in interface LeastSquaresProblem.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]), where a[i] is the optimized value of the i-th parameter, and C is the covariance matrix.
      Specified by:
      getSigma in interface LeastSquaresProblem.Evaluation
      Parameters:
      covarianceSingularityThreshold - Singularity threshold (see computeCovariances).
      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 interface LeastSquaresProblem.Evaluation
      Returns:
      the cost.
    • getJacobian

      public RealMatrix getJacobian()
      Get the weighted Jacobian matrix.
      Specified by:
      getJacobian in interface LeastSquaresProblem.Evaluation
      Returns:
      the weighted Jacobian: W1/2 J.
    • getCost

      public double getCost()
      Get the cost.
      Specified by:
      getCost in interface LeastSquaresProblem.Evaluation
      Returns:
      the cost.
      See Also:
    • getResiduals

      public RealVector 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.
      Specified by:
      getResiduals in interface LeastSquaresProblem.Evaluation
      Returns:
      the weighted residuals: W1/2 K.
    • getPoint

      public RealVector getPoint()
      Get the abscissa (independent variables) of this evaluation.
      Specified by:
      getPoint in interface LeastSquaresProblem.Evaluation
      Returns:
      the point provided to LeastSquaresProblem.evaluate(RealVector).