org.apache.commons.math.optimization.fitting
public class GaussianParametersGuesser extends java.lang.Object
a
, b
, c
, and d
)
of a ParametricGaussianFunction
based on the specified observed
points.Modifier and Type | Field and Description |
---|---|
private WeightedObservedPoint[] |
observations
Observed points.
|
private double[] |
parameters
Resulting guessed parameters.
|
Constructor and Description |
---|
GaussianParametersGuesser(WeightedObservedPoint[] observations)
Constructs instance with the specified observed points.
|
Modifier and Type | Method and Description |
---|---|
private double[] |
basicGuess(WeightedObservedPoint[] points)
Guesses the parameters based on the specified observed points.
|
private java.util.Comparator<WeightedObservedPoint> |
createWeightedObservedPointComparator()
Factory method creating
Comparator for comparing
WeightedObservedPoint instances. |
private int |
findMaxY(WeightedObservedPoint[] points)
Finds index of point in specified points with the largest Y.
|
private int |
findMinY(WeightedObservedPoint[] points)
Finds index of point in specified points with the smallest Y.
|
private WeightedObservedPoint[] |
getInterpolationPointsForY(WeightedObservedPoint[] points,
int startIdx,
int idxStep,
double y)
Gets the two bounding interpolation points from the specified points
suitable for determining X at the specified Y.
|
double[] |
guess()
Guesses the parameters based on the observed points.
|
private double |
interpolateXAtY(WeightedObservedPoint[] points,
int startIdx,
int idxStep,
double y)
Interpolates using the specified points to determine X at the specified
Y.
|
private boolean |
isBetween(double value,
double boundary1,
double boundary2)
Determines whether a value is between two other values.
|
private final WeightedObservedPoint[] observations
private double[] parameters
public GaussianParametersGuesser(WeightedObservedPoint[] observations)
observations
- observed points upon which should base guesspublic double[] guess()
{a, b, c, d}
private double[] basicGuess(WeightedObservedPoint[] points)
points
- observed points upon which should base guess{a, b, c, d}
private int findMinY(WeightedObservedPoint[] points)
points
- points to searchprivate int findMaxY(WeightedObservedPoint[] points)
points
- points to searchprivate double interpolateXAtY(WeightedObservedPoint[] points, int startIdx, int idxStep, double y) throws OutOfRangeException
points
- points to use for interpolationstartIdx
- index within points from which to start search for
interpolation bounds pointsidxStep
- index step for search for interpolation bounds pointsy
- Y value for which X should be determinedjava.lang.IllegalArgumentException
- if idxStep is 0OutOfRangeException
- if specified y
is not within the
range of the specified points
private WeightedObservedPoint[] getInterpolationPointsForY(WeightedObservedPoint[] points, int startIdx, int idxStep, double y) throws OutOfRangeException
points
- points to use for interpolationstartIdx
- index within points from which to start search for
interpolation bounds pointsidxStep
- index step for search for interpolation bounds pointsy
- Y value for which X should be determinedjava.lang.IllegalArgumentException
- if idxStep is 0OutOfRangeException
- if specified y
is not within the
range of the specified points
private boolean isBetween(double value, double boundary1, double boundary2)
value
- value to determine whether is between boundary1
and boundary2
boundary1
- one end of the rangeboundary2
- other end of the rangevalue
is between boundary1
and
boundary2
(inclusive); false otherwiseprivate java.util.Comparator<WeightedObservedPoint> createWeightedObservedPointComparator()
Comparator
for comparing
WeightedObservedPoint
instances.Comparator
instanceCopyright (c) 2003-2013 Apache Software Foundation