org.apache.commons.math.optimization.fitting
public class GaussianFitter extends Object
GaussianFunction
).
Usage example:
GaussianFitter fitter = new GaussianFitter( new LevenbergMarquardtOptimizer()); fitter.addObservedPoint(4.0254623, 531026.0); fitter.addObservedPoint(4.03128248, 984167.0); fitter.addObservedPoint(4.03839603, 1887233.0); fitter.addObservedPoint(4.04421621, 2687152.0); fitter.addObservedPoint(4.05132976, 3461228.0); fitter.addObservedPoint(4.05326982, 3580526.0); fitter.addObservedPoint(4.05779662, 3439750.0); fitter.addObservedPoint(4.0636168, 2877648.0); fitter.addObservedPoint(4.06943698, 2175960.0); fitter.addObservedPoint(4.07525716, 1447024.0); fitter.addObservedPoint(4.08237071, 717104.0); fitter.addObservedPoint(4.08366408, 620014.0); GaussianFunction fitFunction = fitter.fit();
ParametricGaussianFunction
Modifier and Type | Field and Description |
---|---|
private CurveFitter |
fitter
Fitter used for fitting.
|
Constructor and Description |
---|
GaussianFitter(DifferentiableMultivariateVectorialOptimizer optimizer)
Constructs an instance using the specified optimizer.
|
Modifier and Type | Method and Description |
---|---|
void |
addObservedPoint(double x,
double y)
Adds point (
x , y ) to list of observed points
with a weight of 1.0. |
void |
addObservedPoint(double weight,
double x,
double y)
Adds point (
x , y ) to list of observed points
with a weight of weight . |
protected GaussianParametersGuesser |
createParametersGuesser(WeightedObservedPoint[] observations)
Factory method to create a
GaussianParametersGuesser
instance initialized with the specified observations. |
GaussianFunction |
fit()
Fits Gaussian function to the observed points.
|
private final CurveFitter fitter
public GaussianFitter(DifferentiableMultivariateVectorialOptimizer optimizer)
optimizer
- optimizer to use for the fittingpublic void addObservedPoint(double x, double y)
x
, y
) to list of observed points
with a weight of 1.0.x
- x point valuey
- y point valuepublic void addObservedPoint(double weight, double x, double y)
x
, y
) to list of observed points
with a weight of weight
.weight
- weight assigned to pointx
- x point valuey
- y point valuepublic GaussianFunction fit() throws FunctionEvaluationException, OptimizationException
FunctionEvaluationException
- if CurveFitter.fit
throws itOptimizationException
- if CurveFitter.fit
throws itIllegalArgumentException
- if CurveFitter.fit
throws itCurveFitter
protected GaussianParametersGuesser createParametersGuesser(WeightedObservedPoint[] observations)
GaussianParametersGuesser
instance initialized with the specified observations.observations
- points used to initialize the created
GaussianParametersGuesser
instanceGaussianParametersGuesser
instanceCopyright (c) 2003-2013 Apache Software Foundation