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 class
Container with the model lazy evaluation at a particular point.private static class
Container 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 boolean
Whether to use lazy evaluation.private final MultivariateJacobianFunction
Model function.private final ParameterValidator
Model parameters validator.private final RealVector
Initial guess.private final RealVector
Target 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 aLeastSquaresProblem
from the given data. -
Method Summary
Modifier and TypeMethodDescriptionevaluate
(RealVector point) Evaluate the model at the specified point.int
Get the number of observations (rows in the Jacobian) in this problem.int
Get 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, getIterationCounter
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.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 aLeastSquaresProblem
from 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:
getObservationSize
in 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:
getParameterSize
in interfaceLeastSquaresProblem
- Returns:
- the number of scalar parameters
-
getStart
Gets the initial guess.- Specified by:
getStart
in interfaceLeastSquaresProblem
- Returns:
- the initial guess values.
-
evaluate
Evaluate the model at the specified point.- Specified by:
evaluate
in interfaceLeastSquaresProblem
- Parameters:
point
- the parameter values.- Returns:
- the model's value and derivative at the given point.
-