|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.mathematics.analysis.fitting.AbstractCurveFitter
public abstract class AbstractCurveFitter
This class is the base class for all curve fitting classes in the package.
This class handles all common features of curve fitting like the
sample points handling. It declares two methods (valueAt(double) and partial(double, org.jscience.mathematics.analysis.estimation.EstimatedParameter)) which should be implemented by
sub-classes to define the precise shape of the curve they
represent.
| Nested Class Summary | |
|---|---|
class |
AbstractCurveFitter.FitMeasurement
This class represents the fit measurements. |
| Field Summary | |
|---|---|
protected EstimatedParameter[] |
coefficients
Coefficients of the function |
protected java.util.List |
measurements
Measurements vector |
| Constructor Summary | |
|---|---|
protected |
AbstractCurveFitter(EstimatedParameter[] coefficients,
int maxIterations,
double convergence,
double steadyStateThreshold,
double epsilon)
Simple constructor. |
protected |
AbstractCurveFitter(int n,
int maxIterations,
double convergence,
double steadyStateThreshold,
double epsilon)
Simple constructor. |
| Method Summary | |
|---|---|
void |
addWeightedPair(double weight,
double x,
double y)
Add a weighted (x,y) pair to the sample. |
double[] |
fit()
Perform the fitting. |
EstimatedParameter[] |
getAllParameters()
Get all the parameters of the problem. |
WeightedMeasurement[] |
getMeasurements()
Get the measurements of an estimation problem. |
EstimatedParameter[] |
getUnboundParameters()
Get the unbound parameters of the problem. |
abstract double |
partial(double x,
EstimatedParameter p)
Get the derivative of the function at x with respect to parameter p. |
protected void |
sortMeasurements()
Utility method to sort the measurements with respect to the abscissa. |
abstract double |
valueAt(double x)
Get the value of the function at x according to the current parameters value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected EstimatedParameter[] coefficients
protected java.util.List measurements
| Constructor Detail |
|---|
protected AbstractCurveFitter(int n,
int maxIterations,
double convergence,
double steadyStateThreshold,
double epsilon)
n - number of coefficients in the underlying functionmaxIterations - 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) if
Math.abs (Jn - Jn-1) < Jn * convergence, where
Jn and Jn-1 are 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 (see SquareMatrix.solve).
protected AbstractCurveFitter(EstimatedParameter[] coefficients,
int maxIterations,
double convergence,
double steadyStateThreshold,
double epsilon)
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) if
Math.abs (Jn - Jn-1) < Jn * convergence, where
Jn and Jn-1 are 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 (see SquareMatrix.solve).| Method Detail |
|---|
public void addWeightedPair(double weight,
double x,
double y)
weight - weight of this pair in the fitx - abscissay - ordinate, we have y = f (x)
public double[] fit()
throws EstimationException
This method compute the coefficients of the curve that best
fit the sample of weighted pairs previously given through calls
to the addWeightedPair method.
EstimationException - if the fitting is not possible
(for example if the sample has to few independant points)public WeightedMeasurement[] getMeasurements()
EstimationProblem
getMeasurements in interface EstimationProblempublic EstimatedParameter[] getUnboundParameters()
getUnboundParameters in interface EstimationProblempublic EstimatedParameter[] getAllParameters()
getAllParameters in interface EstimationProblemprotected void sortMeasurements()
This method is provided as a utility for derived classes. As
an example, the HarmonicFitter class needs it in order to
compute a first guess of the coefficients to initialize the
estimation algorithm.
public abstract double valueAt(double x)
x - abscissa at which the theoretical value is requested
public abstract double partial(double x,
EstimatedParameter p)
x - abscissa at which the partial derivative is requestedp - parameter with respect to which the derivative is requested
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||