Class LeastSquaresFactory.LocalLeastSquaresProblem
java.lang.Object
org.apache.commons.math3.optim.AbstractOptimizationProblem<LeastSquaresProblem.Evaluation>
org.apache.commons.math3.fitting.leastsquares.LeastSquaresFactory.LocalLeastSquaresProblem
- All Implemented Interfaces:
LeastSquaresProblem,OptimizationProblem<LeastSquaresProblem.Evaluation>
- Enclosing class:
LeastSquaresFactory
private static class LeastSquaresFactory.LocalLeastSquaresProblem
extends AbstractOptimizationProblem<LeastSquaresProblem.Evaluation>
implements LeastSquaresProblem
A private, "field" immutable (not "real" immutable) implementation of
LeastSquaresProblem.- Since:
- 3.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classContainer with the model lazy evaluation at a particular point.private static classContainer with the model evaluation at a particular point.Nested classes/interfaces inherited from interface org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem
LeastSquaresProblem.Evaluation -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanWhether to use lazy evaluation.private final MultivariateJacobianFunctionModel function.private final ParameterValidatorModel parameters validator.private final RealVectorInitial guess.private final RealVectorTarget values for the model function at optimum. -
Constructor Summary
ConstructorsConstructorDescriptionLocalLeastSquaresProblem(MultivariateJacobianFunction model, RealVector target, RealVector start, ConvergenceChecker<LeastSquaresProblem.Evaluation> checker, int maxEvaluations, int maxIterations, boolean lazyEvaluation, ParameterValidator paramValidator) Create aLeastSquaresProblemfrom the given data. -
Method Summary
Modifier and TypeMethodDescriptionevaluate(RealVector point) Evaluate the model at the specified point.intGet the number of observations (rows in the Jacobian) in this problem.intGet the number of parameters (columns in the Jacobian) in this problem.getStart()Gets the initial guess.Methods inherited from class org.apache.commons.math3.optim.AbstractOptimizationProblem
getConvergenceChecker, getEvaluationCounter, getIterationCounterMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.commons.math3.optim.OptimizationProblem
getConvergenceChecker, getEvaluationCounter, getIterationCounter
-
Field Details
-
target
Target values for the model function at optimum. -
model
Model function. -
start
Initial guess. -
lazyEvaluation
private final boolean lazyEvaluationWhether to use lazy evaluation. -
paramValidator
Model parameters validator.
-
-
Constructor Details
-
LocalLeastSquaresProblem
LocalLeastSquaresProblem(MultivariateJacobianFunction model, RealVector target, RealVector start, ConvergenceChecker<LeastSquaresProblem.Evaluation> checker, int maxEvaluations, int maxIterations, boolean lazyEvaluation, ParameterValidator paramValidator) Create aLeastSquaresProblemfrom the given data.- Parameters:
model- the model functiontarget- the observed datastart- the initial guesschecker- the convergence checkermaxEvaluations- the allowed evaluationsmaxIterations- the allowed iterationslazyEvaluation- Whether the call toLeastSquaresProblem.evaluate(RealVector)will defer the evaluation until access to the value is requested.paramValidator- Model parameters validator.
-
-
Method Details
-
getObservationSize
public int getObservationSize()Get the number of observations (rows in the Jacobian) in this problem.- Specified by:
getObservationSizein interfaceLeastSquaresProblem- Returns:
- the number of scalar observations
-
getParameterSize
public int getParameterSize()Get the number of parameters (columns in the Jacobian) in this problem.- Specified by:
getParameterSizein interfaceLeastSquaresProblem- Returns:
- the number of scalar parameters
-
getStart
Gets the initial guess.- Specified by:
getStartin interfaceLeastSquaresProblem- Returns:
- the initial guess values.
-
evaluate
Evaluate the model at the specified point.- Specified by:
evaluatein interfaceLeastSquaresProblem- Parameters:
point- the parameter values.- Returns:
- the model's value and derivative at the given point.
-