Package org.hipparchus.fitting
Class AbstractCurveFitter
java.lang.Object
org.hipparchus.fitting.AbstractCurveFitter
- Direct Known Subclasses:
GaussianCurveFitter,HarmonicCurveFitter,PolynomialCurveFitter,SimpleCurveFitter
Base class that contains common code for fitting parametric univariate
real functions
A fitter will find the optimal values of the parameters by fitting the curve so it remains very close to a set of
An algorithm usually performs the fit by finding the parameter values that minimizes the objective function
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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classVector function for computing function theoretical values. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble[]fit(Collection<WeightedObservedPoint> points) Fits a curve.protected LeastSquaresOptimizerCreates an optimizer set up to fit the appropriate curve.protected abstract LeastSquaresProblemgetProblem(Collection<WeightedObservedPoint> points) Creates a least squares problem corresponding to the appropriate curve.
-
Constructor Details
-
AbstractCurveFitter
protected AbstractCurveFitter()Empty constructor.This constructor is not strictly necessary, but it prevents spurious javadoc warnings with JDK 18 and later.
- Since:
- 3.0
-
-
Method Details
-
fit
Fits a curve. This method computes the coefficients of the curve that best fit the sample of observed points.- Parameters:
points- Observations.- Returns:
- the fitted parameters.
-
getOptimizer
Creates an optimizer set up to fit the appropriate curve.The default implementation uses a
Levenberg-Marquardtoptimizer.- Returns:
- the optimizer to use for fitting the curve to the
given
points.
-
getProblem
Creates a least squares problem corresponding to the appropriate curve.- Parameters:
points- Sample points.- Returns:
- the least squares problem to use for fitting the curve to the
given
points.
-