Class PolynomialFitter
- java.lang.Object
-
- org.spaceroots.mantissa.fitting.AbstractCurveFitter
-
- org.spaceroots.mantissa.fitting.PolynomialFitter
-
- All Implemented Interfaces:
- java.io.Serializable, EstimationProblem
public class PolynomialFitter extends AbstractCurveFitter
This class implements a curve fitting specialized for polynomials.Polynomial fitting is a very simple case of curve fitting. The estimated coefficients are the polynom coefficients. They are searched by a least square estimator.
This class
is by no means optimized , neither in space nor in time performance.- See Also:
PolynomialCoefficient, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.spaceroots.mantissa.fitting.AbstractCurveFitter
AbstractCurveFitter.FitMeasurement
-
-
Constructor Summary
Constructors Constructor and Description PolynomialFitter(int degree, Estimator estimator)Simple constructor.PolynomialFitter(int degree, int maxIterations, double convergence, double steadyStateThreshold, double epsilon)Deprecated.replaced byPolynomialFitter(int,Estimator)as of version 7.0PolynomialFitter(PolynomialCoefficient[] coefficients, Estimator estimator)Simple constructor.PolynomialFitter(PolynomialCoefficient[] coefficients, int maxIterations, double convergence, double steadyStateThreshold, double epsilon)Deprecated.replaced byPolynomialFitter(PolynomialCoefficient[], Estimator)as of version 7.0
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublepartial(double x, EstimatedParameter p)Get the derivative of the function at x with respect to parameter p.doublevalueAt(double x)Get the value of the function at x according to the current parameters value.-
Methods inherited from class org.spaceroots.mantissa.fitting.AbstractCurveFitter
addWeightedPair, fit, getAllParameters, getMeasurements, getUnboundParameters
-
-
-
-
Constructor Detail
-
PolynomialFitter
public PolynomialFitter(int degree, Estimator estimator)Simple constructor.The polynomial fitter built this way are complete polynoms, ie. a n-degree polynom has n+1 coefficients. In order to build fitter for sparse polynoms (for example
a x^20 - b x^30, on should first build the coefficients array and provide it toPolynomialFitter(PolynomialCoefficient[], int, double, double, double).- Parameters:
degree- maximal degree of the polynomestimator- estimator to use for the fitting
-
PolynomialFitter
public PolynomialFitter(PolynomialCoefficient[] coefficients, Estimator estimator)
Simple constructor.This constructor can be used either when a first estimate of the coefficients is already known (which is of little interest because the fit cost is the same whether a first guess is known or not) or when one needs to handle sparse polynoms like
a x^20 - b x^30.- Parameters:
coefficients- first estimate of the coefficients. A reference to this array is hold by the newly created object. Its elements will be adjusted during the fitting process and they will be set to the adjusted coefficients at the end.estimator- estimator to use for the fitting
-
PolynomialFitter
public PolynomialFitter(int degree, int maxIterations, double convergence, double steadyStateThreshold, double epsilon)Deprecated. replaced byPolynomialFitter(int,Estimator)as of version 7.0Simple constructor.The polynomial fitter built this way are complete polynoms, ie. a n-degree polynom has n+1 coefficients. In order to build fitter for sparse polynoms (for example
a x^20 - b x^30, on should first build the coefficients array and provide it toPolynomialFitter(PolynomialCoefficient[], int, double, double, double).- Parameters:
degree- maximal degree of the polynommaxIterations- maximum number of iterations allowedconvergence- criterion threshold below which we do not need to improve the criterion anymoresteadyStateThreshold- steady state detection threshold, the problem has reached a steady state (read converged) ifMath.abs (Jn - Jn-1) < Jn * convergence, whereJnandJn-1are the current and preceding criterion value (square sum of the weighted residuals of considered measurements).epsilon- threshold under which the matrix of the linearized problem is considered singular (seeSquareMatrix.solve).
-
PolynomialFitter
public PolynomialFitter(PolynomialCoefficient[] coefficients, int maxIterations, double convergence, double steadyStateThreshold, double epsilon)
Deprecated. replaced byPolynomialFitter(PolynomialCoefficient[], Estimator)as of version 7.0Simple constructor.This constructor can be used either when a first estimate of the coefficients is already known (which is of little interest because the fit cost is the same whether a first guess is known or not) or when one needs to handle sparse polynoms like
a x^20 - b x^30.- Parameters:
coefficients- first estimate of the coefficients. A reference to this array is hold by the newly created object. Its elements will be adjusted during the fitting process and they will be set to the adjusted coefficients at the end.maxIterations- maximum number of iterations allowedconvergence- criterion threshold below which we do not need to improve the criterion anymoresteadyStateThreshold- steady state detection threshold, the problem has reached a steady state (read converged) ifMath.abs (Jn - Jn-1) < Jn * convergence, whereJnandJn-1are the current and preceding criterion value (square sum of the weighted residuals of considered measurements).epsilon- threshold under which the matrix of the linearized problem is considered singular (seeSquareMatrix.solve).
-
-
Method Detail
-
valueAt
public double valueAt(double x)
Get the value of the function at x according to the current parameters value.- Specified by:
valueAtin classAbstractCurveFitter- Parameters:
x- abscissa at which the theoretical value is requested- Returns:
- theoretical value at x
-
partial
public double partial(double x, EstimatedParameter p)Get the derivative of the function at x with respect to parameter p.- Specified by:
partialin classAbstractCurveFitter- Parameters:
x- abscissa at which the partial derivative is requestedp- parameter with respect to which the derivative is requested- Returns:
- partial derivative
-
-
DataMelt 3.0 © DataMelt by jWork.ORG