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 ofLeastSquaresProblem
.- Since:
- 3.3
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
LeastSquaresFactory.LocalLeastSquaresProblem.LazyUnweightedEvaluation
Container with the model lazy evaluation at a particular point.private static class
LeastSquaresFactory.LocalLeastSquaresProblem.UnweightedEvaluation
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
Fields Modifier and Type Field Description private boolean
lazyEvaluation
Whether to use lazy evaluation.private MultivariateJacobianFunction
model
Model function.private ParameterValidator
paramValidator
Model parameters validator.private RealVector
start
Initial guess.private RealVector
target
Target values for the model function at optimum.
-
Constructor Summary
Constructors Constructor Description 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LeastSquaresProblem.Evaluation
evaluate(RealVector point)
Evaluate the model at the specified point.int
getObservationSize()
Get the number of observations (rows in the Jacobian) in this problem.int
getParameterSize()
Get the number of parameters (columns in the Jacobian) in this problem.RealVector
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 Detail
-
target
private final RealVector target
Target values for the model function at optimum.
-
model
private final MultivariateJacobianFunction model
Model function.
-
start
private final RealVector start
Initial guess.
-
lazyEvaluation
private final boolean lazyEvaluation
Whether to use lazy evaluation.
-
paramValidator
private final ParameterValidator paramValidator
Model parameters validator.
-
-
Constructor Detail
-
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 Detail
-
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
public RealVector getStart()
Gets the initial guess.- Specified by:
getStart
in interfaceLeastSquaresProblem
- Returns:
- the initial guess values.
-
evaluate
public LeastSquaresProblem.Evaluation evaluate(RealVector point)
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.
-
-