Class LeastSquaresBuilder
- java.lang.Object
-
- org.apache.commons.math3.fitting.leastsquares.LeastSquaresBuilder
-
public class LeastSquaresBuilder extends java.lang.Object
A mutable builder forLeastSquaresProblem
s.- Since:
- 3.3
- See Also:
LeastSquaresFactory
-
-
Field Summary
Fields Modifier and Type Field Description private ConvergenceChecker<LeastSquaresProblem.Evaluation>
checker
convergence checkerprivate boolean
lazyEvaluation
Lazy evaluation.private int
maxEvaluations
max evaluationsprivate int
maxIterations
max iterationsprivate MultivariateJacobianFunction
model
model functionprivate ParameterValidator
paramValidator
Validator.private RealVector
start
initial guessprivate RealVector
target
observed valuesprivate RealMatrix
weight
weight matrix
-
Constructor Summary
Constructors Constructor Description LeastSquaresBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LeastSquaresProblem
build()
Construct aLeastSquaresProblem
from the data in this builder.LeastSquaresBuilder
checker(ConvergenceChecker<LeastSquaresProblem.Evaluation> newChecker)
Configure the convergence checker.LeastSquaresBuilder
checkerPair(ConvergenceChecker<PointVectorValuePair> newChecker)
Configure the convergence checker.LeastSquaresBuilder
lazyEvaluation(boolean newValue)
Configure whether evaluation will be lazy or not.LeastSquaresBuilder
maxEvaluations(int newMaxEvaluations)
Configure the max evaluations.LeastSquaresBuilder
maxIterations(int newMaxIterations)
Configure the max iterations.LeastSquaresBuilder
model(MultivariateVectorFunction value, MultivariateMatrixFunction jacobian)
Configure the model function.LeastSquaresBuilder
model(MultivariateJacobianFunction newModel)
Configure the model function.LeastSquaresBuilder
parameterValidator(ParameterValidator newValidator)
Configure the validator of the model parameters.LeastSquaresBuilder
start(double[] newStart)
Configure the initial guess.LeastSquaresBuilder
start(RealVector newStart)
Configure the initial guess.LeastSquaresBuilder
target(double[] newTarget)
Configure the observed data.LeastSquaresBuilder
target(RealVector newTarget)
Configure the observed data.LeastSquaresBuilder
weight(RealMatrix newWeight)
Configure the weight matrix.
-
-
-
Field Detail
-
maxEvaluations
private int maxEvaluations
max evaluations
-
maxIterations
private int maxIterations
max iterations
-
checker
private ConvergenceChecker<LeastSquaresProblem.Evaluation> checker
convergence checker
-
model
private MultivariateJacobianFunction model
model function
-
target
private RealVector target
observed values
-
start
private RealVector start
initial guess
-
weight
private RealMatrix weight
weight matrix
-
lazyEvaluation
private boolean lazyEvaluation
Lazy evaluation.- Since:
- 3.4
-
paramValidator
private ParameterValidator paramValidator
Validator.- Since:
- 3.4
-
-
Method Detail
-
build
public LeastSquaresProblem build()
Construct aLeastSquaresProblem
from the data in this builder.- Returns:
- a new
LeastSquaresProblem
.
-
maxEvaluations
public LeastSquaresBuilder maxEvaluations(int newMaxEvaluations)
Configure the max evaluations.- Parameters:
newMaxEvaluations
- the maximum number of evaluations permitted.- Returns:
- this
-
maxIterations
public LeastSquaresBuilder maxIterations(int newMaxIterations)
Configure the max iterations.- Parameters:
newMaxIterations
- the maximum number of iterations permitted.- Returns:
- this
-
checker
public LeastSquaresBuilder checker(ConvergenceChecker<LeastSquaresProblem.Evaluation> newChecker)
Configure the convergence checker.- Parameters:
newChecker
- the convergence checker.- Returns:
- this
-
checkerPair
public LeastSquaresBuilder checkerPair(ConvergenceChecker<PointVectorValuePair> newChecker)
Configure the convergence checker. This function is an overloaded version ofchecker(ConvergenceChecker)
.- Parameters:
newChecker
- the convergence checker.- Returns:
- this
-
model
public LeastSquaresBuilder model(MultivariateVectorFunction value, MultivariateMatrixFunction jacobian)
Configure the model function.- Parameters:
value
- the model function valuejacobian
- the Jacobian ofvalue
- Returns:
- this
-
model
public LeastSquaresBuilder model(MultivariateJacobianFunction newModel)
Configure the model function.- Parameters:
newModel
- the model function value and Jacobian- Returns:
- this
-
target
public LeastSquaresBuilder target(RealVector newTarget)
Configure the observed data.- Parameters:
newTarget
- the observed data.- Returns:
- this
-
target
public LeastSquaresBuilder target(double[] newTarget)
Configure the observed data.- Parameters:
newTarget
- the observed data.- Returns:
- this
-
start
public LeastSquaresBuilder start(RealVector newStart)
Configure the initial guess.- Parameters:
newStart
- the initial guess.- Returns:
- this
-
start
public LeastSquaresBuilder start(double[] newStart)
Configure the initial guess.- Parameters:
newStart
- the initial guess.- Returns:
- this
-
weight
public LeastSquaresBuilder weight(RealMatrix newWeight)
Configure the weight matrix.- Parameters:
newWeight
- the weight matrix- Returns:
- this
-
lazyEvaluation
public LeastSquaresBuilder lazyEvaluation(boolean newValue)
Configure whether evaluation will be lazy or not.- Parameters:
newValue
- Whether to perform lazy evaluation.- Returns:
- this object.
- Since:
- 3.4
-
parameterValidator
public LeastSquaresBuilder parameterValidator(ParameterValidator newValidator)
Configure the validator of the model parameters.- Parameters:
newValidator
- Parameter validator.- Returns:
- this object.
- Since:
- 3.4
-
-