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

public Class SimpleCurveFitter

extends AbstractCurveFitter
Class Inheritance
Imports
java.util.Collection, org.apache.commons.math3.analysis.ParametricUnivariateFunction, org.apache.commons.math3.fitting.leastsquares.LeastSquaresBuilder, .LeastSquaresProblem, org.apache.commons.math3.linear.DiagonalMatrix

Fits points to a user-defined function.
Since
3.4

Field Summary

Modifier and TypeField and Description
private final ParametricUnivariateFunction
function

Function to fit.

private final double[]
initialGuess

Initial guess for the parameters.

private final int
maxIter

Maximum number of iterations of the optimization algorithm.

Constructor Summary

AccessConstructor and Description
private
SimpleCurveFitter(ParametricUnivariateFunction
Function to fit.
function
,
double[]
Initial guess. Cannot be null. Its length must be consistent with the number of parameters of the function to fit.
initialGuess
,
int
Maximum number of iterations of the optimization algorithm.
maxIter
)

Contructor used by the factory methods.

Method Summary

Modifier and TypeMethod and Description
public static SimpleCurveFitter

Returns:

a curve fitter.
create
(ParametricUnivariateFunction
Function to fit.
f
,
double[]
Initial guess for the parameters. Cannot be null. Its length must be consistent with the number of parameters of the function to fit.
start
)

Creates a curve fitter.

protected LeastSquaresProblem
getProblem(Collection<WeightedObservedPoint>
Sample points.
observations
)

Implements abstract org.apache.commons.math3.fitting.AbstractCurveFitter.getProblem.

Creates a least squares problem corresponding to the appropriate curve.

public SimpleCurveFitter

Returns:

a new instance.
withMaxIterations
(int
maximum number of iterations
newMaxIter
)

Configure the maximum number of iterations.

public SimpleCurveFitter

Returns:

a new instance.
withStartPoint
(double[]
new start point (initial guess)
newStart
)

Configure the start point (initial guess).

Inherited from org.apache.commons.math3.fitting.AbstractCurveFitter:
fitgetOptimizer

Field Detail

functionback to summary
private final ParametricUnivariateFunction function

Function to fit.

initialGuessback to summary
private final double[] initialGuess

Initial guess for the parameters.

maxIterback to summary
private final int maxIter

Maximum number of iterations of the optimization algorithm.

Constructor Detail

SimpleCurveFitterback to summary
private SimpleCurveFitter(ParametricUnivariateFunction function, double[] initialGuess, int maxIter)

Contructor used by the factory methods.

Parameters
function:ParametricUnivariateFunction

Function to fit.

initialGuess:double[]

Initial guess. Cannot be null. Its length must be consistent with the number of parameters of the function to fit.

maxIter:int

Maximum number of iterations of the optimization algorithm.

Method Detail

createback to summary
public static SimpleCurveFitter create(ParametricUnivariateFunction f, double[] start)

Creates a curve fitter. The maximum number of iterations of the optimization algorithm is set to Integer#MAX_VALUE.

Parameters
f:ParametricUnivariateFunction

Function to fit.

start:double[]

Initial guess for the parameters. Cannot be null. Its length must be consistent with the number of parameters of the function to fit.

Returns:SimpleCurveFitter

a curve fitter.

See Also
withStartPoint(double[]), withMaxIterations(int)
getProblemback to summary
protected LeastSquaresProblem getProblem(Collection<WeightedObservedPoint> observations)

Implements abstract org.apache.commons.math3.fitting.AbstractCurveFitter.getProblem.

Doc from org.apache.commons.math3.fitting.AbstractCurveFitter.getProblem.

Creates a least squares problem corresponding to the appropriate curve.

Parameters
observations:Collection<WeightedObservedPoint>

Sample points.

Returns:LeastSquaresProblem

the least squares problem to use for fitting the curve to the given points.

Annotations
@Override
withMaxIterationsback to summary
public SimpleCurveFitter withMaxIterations(int newMaxIter)

Configure the maximum number of iterations.

Parameters
newMaxIter:int

maximum number of iterations

Returns:SimpleCurveFitter

a new instance.

withStartPointback to summary
public SimpleCurveFitter withStartPoint(double[] newStart)

Configure the start point (initial guess).

Parameters
newStart:double[]

new start point (initial guess)

Returns:SimpleCurveFitter

a new instance.