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 classLeastSquaresFactory.LocalLeastSquaresProblem.LazyUnweightedEvaluationContainer with the model lazy evaluation at a particular point.private static classLeastSquaresFactory.LocalLeastSquaresProblem.UnweightedEvaluationContainer 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 booleanlazyEvaluationWhether to use lazy evaluation.private MultivariateJacobianFunctionmodelModel function.private ParameterValidatorparamValidatorModel parameters validator.private RealVectorstartInitial guess.private RealVectortargetTarget 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 aLeastSquaresProblemfrom the given data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LeastSquaresProblem.Evaluationevaluate(RealVector point)Evaluate the model at the specified point.intgetObservationSize()Get the number of observations (rows in the Jacobian) in this problem.intgetParameterSize()Get the number of parameters (columns in the Jacobian) in this problem.RealVectorgetStart()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 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 Detail
-
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
public RealVector getStart()
Gets the initial guess.- Specified by:
getStartin interfaceLeastSquaresProblem- Returns:
- the initial guess values.
-
evaluate
public LeastSquaresProblem.Evaluation evaluate(RealVector point)
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.
-
-