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

public abstract Class AbstractCurveFitter

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.commons.math3.fitting.GaussianCurveFitter, org.apache.commons.math3.fitting.HarmonicCurveFitter, org.apache.commons.math3.fitting.PolynomialCurveFitter, org.apache.commons.math3.fitting.SimpleCurveFitter
Imports
java.util.Collection, org.apache.commons.math3.analysis.MultivariateVectorFunction, .MultivariateMatrixFunction, .ParametricUnivariateFunction, org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer, .LeastSquaresProblem, .LevenbergMarquardtOptimizer

Base class that contains common code for fitting parametric univariate real functions y = f(pi;x), where x is the independent variable and the pi are the parameters.
A fitter will find the optimal values of the parameters by fitting the curve so it remains very close to a set of N observed points (xk, yk), 0 <= k < N.
An algorithm usually performs the fit by finding the parameter values that minimizes the objective function

 ∑yk - f(xk)2,
which is actually a least-squares problem. This class contains boilerplate code for calling the fit(Collection) method for obtaining the parameters. The problem setup, such as the choice of optimization algorithm for fitting a specific function is delegated to subclasses.
Since
3.3

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
AbstractCurveFitter.TheoreticalValuesFunction

Vector function for computing function theoretical values.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public double[]

Returns:

the fitted parameters.
fit
(Collection<WeightedObservedPoint>
Observations.
points
)

Fits a curve.

protected LeastSquaresOptimizer

Returns:

the optimizer to use for fitting the curve to the given points.
getOptimizer
()

Creates an optimizer set up to fit the appropriate curve.

protected abstract LeastSquaresProblem

Returns:

the least squares problem to use for fitting the curve to the given points.
getProblem
(Collection<WeightedObservedPoint>
Sample points.
points
)

Creates a least squares problem corresponding to the appropriate curve.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

AbstractCurveFitterback to summary
public AbstractCurveFitter()

Method Detail

fitback to summary
public double[] fit(Collection<WeightedObservedPoint> points)

Fits a curve. This method computes the coefficients of the curve that best fit the sample of observed points.

Parameters
points:Collection<WeightedObservedPoint>

Observations.

Returns:double[]

the fitted parameters.

getOptimizerback to summary
protected LeastSquaresOptimizer getOptimizer()

Creates an optimizer set up to fit the appropriate curve.

The default implementation uses a Levenberg-Marquardt optimizer.

Returns:LeastSquaresOptimizer

the optimizer to use for fitting the curve to the given points.

getProblemback to summary
protected abstract LeastSquaresProblem getProblem(Collection<WeightedObservedPoint> points)

Creates a least squares problem corresponding to the appropriate curve.

Parameters
points:Collection<WeightedObservedPoint>

Sample points.

Returns:LeastSquaresProblem

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

org.apache.commons.math3.fitting back to summary

protected Class AbstractCurveFitter.TheoreticalValuesFunction

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.commons.math3.fitting.AbstractCurveFitter.TheoreticalValuesFunction

Vector function for computing function theoretical values.

Field Summary

Modifier and TypeField and Description
private final ParametricUnivariateFunction
f

Function to fit.

private final double[]
points

Observations.

Constructor Summary

AccessConstructor and Description
public
TheoreticalValuesFunction(final ParametricUnivariateFunction
function to fit.
f
,
final Collection<WeightedObservedPoint>
Observations.
observations
)

Method Summary

Modifier and TypeMethod and Description
public MultivariateVectorFunction

Returns:

the model function values.
getModelFunction
()

public MultivariateMatrixFunction

Returns:

the model function Jacobian.
getModelFunctionJacobian
()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fback to summary
private final ParametricUnivariateFunction f

Function to fit.

pointsback to summary
private final double[] points

Observations.

Constructor Detail

TheoreticalValuesFunctionback to summary
public TheoreticalValuesFunction(final ParametricUnivariateFunction f, final Collection<WeightedObservedPoint> observations)
Parameters
f:ParametricUnivariateFunction

function to fit.

observations:Collection<WeightedObservedPoint>

Observations.

Method Detail

getModelFunctionback to summary
public MultivariateVectorFunction getModelFunction()
Returns:MultivariateVectorFunction

the model function values.

getModelFunctionJacobianback to summary
public MultivariateMatrixFunction getModelFunctionJacobian()
Returns:MultivariateMatrixFunction

the model function Jacobian.