Deprecated
As of 3.3. Please use GaussianCurveFitter and
WeightedObservedPoints instead.
Gaussian function.
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);
double[] parameters = fitter.fit();
| Modifier and Type | Class and Description |
|---|---|
| public static class | GaussianFitter.
Guesses the parameters |
| Access | Constructor and Description |
|---|---|
| public | GaussianFitter(MultivariateVectorOptimizer
Optimizer to use for the fitting. optimizer)
Deprecated
as a consequence of
MultivariateVectorOptimizer being deprecated.
Constructs an instance using the specified optimizer. |
| Modifier and Type | Method and Description |
|---|---|
| public double[] | Returns: the parameters of the Gaussian function that best fits the observed points (in the same order as above).First guess values in the following order:
initialGuess)
Fits a Gaussian function to the observed points. |
| public double[] | Returns: the parameters of the Gaussian function that best fits the observed points (in the same order as above).Fits a Gaussian function to the observed points. |
| GaussianFitter | back to summary |
|---|---|
| public GaussianFitter(MultivariateVectorOptimizer optimizer)
Deprecated as a consequence of Constructs an instance using the specified optimizer.
| |
| fit | back to summary |
|---|---|
| public double[] fit(double[] initialGuess) Fits a Gaussian function to the observed points.
| |
| fit | back to summary |
|---|---|
| public double[] fit() Fits a Gaussian function to the observed points.
| |
norm, mean, and sigma
of a org.apache.commons.math3.analysis.function.Gaussian.Parametric
based on the specified observed points.
| Modifier and Type | Field and Description |
|---|---|
| private final double | mean
Mean. |
| private final double | norm
Normalization factor. |
| private final double | sigma
Standard deviation. |
| Access | Constructor and Description |
|---|---|
| public | ParameterGuesser(WeightedObservedPoint[]
Observed points from which to guess the
parameters of the Gaussian. observations)Constructs instance with the specified observed points. |
| Modifier and Type | Method and Description |
|---|---|
| private double[] | Returns: the guessed parameters (normalization factor, mean and sigma).Observed points, sorted. points)Guesses the parameters based on the specified observed points. |
| private int | Returns: the index in specified points array.Points to search. points)Finds index of point in specified points with the largest Y. |
| private WeightedObservedPoint[] | Returns: the array containing two points suitable for determining X at the specified Y.Points to use for interpolation. points, int Index within points from which to start search for
interpolation bounds points. startIdx, int Index step for search for interpolation bounds points. idxStep, double Y value for which X should be determined. y)Gets the two bounding interpolation points from the specified points suitable for determining X at the specified Y. |
| public double[] | Returns: the guessed parameters, in the following order:
Gets an estimation of the parameters. |
| private double | Returns: the value of X for the specified Y.Points to use for interpolation. points, int Index within points from which to start the search for
interpolation bounds points. startIdx, int Index step for searching interpolation bounds points. idxStep, double Y value for which X should be determined. y)Interpolates using the specified points to determine X at the specified Y. |
| private boolean | Returns: true if value is between boundary1 and
boundary2 (inclusive), false otherwise.Value to test whether it is between value, double boundary1
and boundary2.One end of the range. boundary1, double Other end of the range. boundary2)Determines whether a value is between two other values. |
| private WeightedObservedPoint[] | Returns: the input observations, sorted.Input observations. unsorted)Sort the observations. |
| mean | back to summary |
|---|---|
| private final double mean Mean. | |
| norm | back to summary |
|---|---|
| private final double norm Normalization factor. | |
| sigma | back to summary |
|---|---|
| private final double sigma Standard deviation. | |
| ParameterGuesser | back to summary |
|---|---|
| public ParameterGuesser(WeightedObservedPoint[] observations) Constructs instance with the specified observed points.
| |
| basicGuess | back to summary |
|---|---|
| private double[] basicGuess(WeightedObservedPoint[] points) Guesses the parameters based on the specified observed points.
| |
| findMaxY | back to summary |
|---|---|
| private int findMaxY(WeightedObservedPoint[] points) Finds index of point in specified points with the largest Y.
| |
| getInterpolationPointsForY | back to summary |
|---|---|
| private WeightedObservedPoint[] getInterpolationPointsForY(WeightedObservedPoint[] points, int startIdx, int idxStep, double y) throws OutOfRangeException Gets the two bounding interpolation points from the specified points suitable for determining X at the specified Y.
| |
| guess | back to summary |
|---|---|
| public double[] guess() Gets an estimation of the parameters.
| |
| interpolateXAtY | back to summary |
|---|---|
| private double interpolateXAtY(WeightedObservedPoint[] points, int startIdx, int idxStep, double y) throws OutOfRangeException Interpolates using the specified points to determine X at the specified Y.
| |
| isBetween | back to summary |
|---|---|
| private boolean isBetween(double value, double boundary1, double boundary2) Determines whether a value is between two other values.
| |
| sortObservations | back to summary |
|---|---|
| private WeightedObservedPoint[] sortObservations(WeightedObservedPoint[] unsorted) Sort the observations.
| |