Top Description Fields Constructors Methods
org.apache.commons.math3.fitting.leastsquares

public Class LeastSquaresBuilder

extends Object
Class Inheritance
Imports
org.apache.commons.math3.analysis.MultivariateMatrixFunction, .MultivariateVectorFunction, org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation, org.apache.commons.math3.linear.ArrayRealVector, .RealMatrix, .RealVector, org.apache.commons.math3.optim.ConvergenceChecker, .PointVectorValuePair

A mutable builder for LeastSquaresProblems.
Since
3.3
See Also
LeastSquaresFactory

Field Summary

Modifier and TypeField and Description
private ConvergenceChecker<LeastSquaresProblem.Evaluation>
checker

convergence checker

private boolean
lazyEvaluation

Lazy evaluation.

private int
maxEvaluations

max evaluations

private int
maxIterations

max iterations

private MultivariateJacobianFunction
model

model function

private ParameterValidator
paramValidator

Validator.

private RealVector
start

initial guess

private RealVector
target

observed values

private RealMatrix
weight

weight matrix

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public LeastSquaresProblem

Returns:

a new LeastSquaresProblem.
build
()

Construct a LeastSquaresProblem from the data in this builder.

public LeastSquaresBuilder

Returns:

this
checker
(final ConvergenceChecker<LeastSquaresProblem.Evaluation>
the convergence checker.
newChecker
)

Configure the convergence checker.

public LeastSquaresBuilder

Returns:

this
checkerPair
(final ConvergenceChecker<PointVectorValuePair>
the convergence checker.
newChecker
)

Configure the convergence checker.

public LeastSquaresBuilder

Returns:

this object.
lazyEvaluation
(final boolean
Whether to perform lazy evaluation.
newValue
)

Configure whether evaluation will be lazy or not.

public LeastSquaresBuilder

Returns:

this
maxEvaluations
(final int
the maximum number of evaluations permitted.
newMaxEvaluations
)

Configure the max evaluations.

public LeastSquaresBuilder

Returns:

this
maxIterations
(final int
the maximum number of iterations permitted.
newMaxIterations
)

Configure the max iterations.

public LeastSquaresBuilder

Returns:

this
model
(final MultivariateVectorFunction
the model function value
value
,
final MultivariateMatrixFunction
the Jacobian of value
jacobian
)

Configure the model function.

public LeastSquaresBuilder

Returns:

this
model
(final MultivariateJacobianFunction
the model function value and Jacobian
newModel
)

Configure the model function.

public LeastSquaresBuilder

Returns:

this object.
parameterValidator
(final ParameterValidator
Parameter validator.
newValidator
)

Configure the validator of the model parameters.

public LeastSquaresBuilder

Returns:

this
start
(final RealVector
the initial guess.
newStart
)

Configure the initial guess.

public LeastSquaresBuilder

Returns:

this
start
(final double[]
the initial guess.
newStart
)

Configure the initial guess.

public LeastSquaresBuilder

Returns:

this
target
(final RealVector
the observed data.
newTarget
)

Configure the observed data.

public LeastSquaresBuilder

Returns:

this
target
(final double[]
the observed data.
newTarget
)

Configure the observed data.

public LeastSquaresBuilder

Returns:

this
weight
(final RealMatrix
the weight matrix
newWeight
)

Configure the weight matrix.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

checkerback to summary
private ConvergenceChecker<LeastSquaresProblem.Evaluation> checker

convergence checker

lazyEvaluationback to summary
private boolean lazyEvaluation

Lazy evaluation.

Since
3.4
maxEvaluationsback to summary
private int maxEvaluations

max evaluations

maxIterationsback to summary
private int maxIterations

max iterations

modelback to summary
private MultivariateJacobianFunction model

model function

paramValidatorback to summary
private ParameterValidator paramValidator

Validator.

Since
3.4
startback to summary
private RealVector start

initial guess

targetback to summary
private RealVector target

observed values

weightback to summary
private RealMatrix weight

weight matrix

Constructor Detail

LeastSquaresBuilderback to summary
public LeastSquaresBuilder()

Method Detail

buildback to summary
public LeastSquaresProblem build()

Construct a LeastSquaresProblem from the data in this builder.

Returns:LeastSquaresProblem

a new LeastSquaresProblem.

checkerback to summary
public LeastSquaresBuilder checker(final ConvergenceChecker<LeastSquaresProblem.Evaluation> newChecker)

Configure the convergence checker.

Parameters
newChecker:ConvergenceChecker<LeastSquaresProblem.Evaluation>

the convergence checker.

Returns:LeastSquaresBuilder

this

checkerPairback to summary
public LeastSquaresBuilder checkerPair(final ConvergenceChecker<PointVectorValuePair> newChecker)

Configure the convergence checker.

This function is an overloaded version of checker(ConvergenceChecker).

Parameters
newChecker:ConvergenceChecker<PointVectorValuePair>

the convergence checker.

Returns:LeastSquaresBuilder

this

lazyEvaluationback to summary
public LeastSquaresBuilder lazyEvaluation(final boolean newValue)

Configure whether evaluation will be lazy or not.

Parameters
newValue:boolean

Whether to perform lazy evaluation.

Returns:LeastSquaresBuilder

this object.

Since
3.4
maxEvaluationsback to summary
public LeastSquaresBuilder maxEvaluations(final int newMaxEvaluations)

Configure the max evaluations.

Parameters
newMaxEvaluations:int

the maximum number of evaluations permitted.

Returns:LeastSquaresBuilder

this

maxIterationsback to summary
public LeastSquaresBuilder maxIterations(final int newMaxIterations)

Configure the max iterations.

Parameters
newMaxIterations:int

the maximum number of iterations permitted.

Returns:LeastSquaresBuilder

this

modelback to summary
public LeastSquaresBuilder model(final MultivariateVectorFunction value, final MultivariateMatrixFunction jacobian)

Configure the model function.

Parameters
value:MultivariateVectorFunction

the model function value

jacobian:MultivariateMatrixFunction

the Jacobian of value

Returns:LeastSquaresBuilder

this

modelback to summary
public LeastSquaresBuilder model(final MultivariateJacobianFunction newModel)

Configure the model function.

Parameters
newModel:MultivariateJacobianFunction

the model function value and Jacobian

Returns:LeastSquaresBuilder

this

parameterValidatorback to summary
public LeastSquaresBuilder parameterValidator(final ParameterValidator newValidator)

Configure the validator of the model parameters.

Parameters
newValidator:ParameterValidator

Parameter validator.

Returns:LeastSquaresBuilder

this object.

Since
3.4
startback to summary
public LeastSquaresBuilder start(final RealVector newStart)

Configure the initial guess.

Parameters
newStart:RealVector

the initial guess.

Returns:LeastSquaresBuilder

this

startback to summary
public LeastSquaresBuilder start(final double[] newStart)

Configure the initial guess.

Parameters
newStart:double[]

the initial guess.

Returns:LeastSquaresBuilder

this

targetback to summary
public LeastSquaresBuilder target(final RealVector newTarget)

Configure the observed data.

Parameters
newTarget:RealVector

the observed data.

Returns:LeastSquaresBuilder

this

targetback to summary
public LeastSquaresBuilder target(final double[] newTarget)

Configure the observed data.

Parameters
newTarget:double[]

the observed data.

Returns:LeastSquaresBuilder

this

weightback to summary
public LeastSquaresBuilder weight(final RealMatrix newWeight)

Configure the weight matrix.

Parameters
newWeight:RealMatrix

the weight matrix

Returns:LeastSquaresBuilder

this