|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.spaceroots.mantissa.fitting.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.spaceroots.mantissa.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 List |
measurements
Measurements vector |
| Constructor Summary | |
protected |
AbstractCurveFitter(EstimatedParameter[] coefficients,
Estimator estimator)
Simple constructor. |
protected |
AbstractCurveFitter(int n,
Estimator estimator)
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 List measurements
| Constructor Detail |
protected AbstractCurveFitter(int n,
Estimator estimator)
n - number of coefficients in the underlying functionestimator - estimator to use for the fitting
protected AbstractCurveFitter(EstimatedParameter[] coefficients,
Estimator estimator)
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| 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 | |||||||||