Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.math.optimization.fitting
Class GaussianParametersGuesser

    java.lang.Object
      org.apache.commons.math.optimization.fitting.GaussianParametersGuesser

    public class GaussianParametersGuesser

extends Object

Guesses the parameters (`a`, `b`, `c`, and `d`) of a `ParametricGaussianFunction` based on the specified observed points.

Since:
  2.2
Version:
  $Revision: 983921 $ $Date: 2010-08-10 12:46:06 +0200 (mar. 10 août 2010) $

Field Summary
`private WeightedObservedPoint[]` | `observations` Observed points.
`private double[]` | `parameters` Resulting guessed parameters.

Constructor Summary
`GaussianParametersGuesser(WeightedObservedPoint[] observations)` Constructs instance with the specified observed points.

Method Summary
`private double[]` | `basicGuess(WeightedObservedPoint[] points)` Guesses the parameters based on the specified observed points.
`private 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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### observations

    private final WeightedObservedPoint[] observations

  Observed points.

### parameters

    private double[] parameters

  Resulting guessed parameters.

Constructor Detail

### GaussianParametersGuesser

    public GaussianParametersGuesser(WeightedObservedPoint[] observations)

  Constructs instance with the specified observed points.

  Parameters:
    `observations` - observed points upon which should base guess

Method Detail

### guess

    public double[] guess()

  Guesses the parameters based on the observed points.

  Returns:
    guessed parameters array `{a, b, c, d}`

### basicGuess

    private double[] basicGuess(WeightedObservedPoint[] points)

  Guesses the parameters based on the specified observed points.

  Parameters:
    `points` - observed points upon which should base guess
  Returns:
    guessed parameters array `{a, b, c, d}`

### findMinY

    private int findMinY(WeightedObservedPoint[] points)

  Finds index of point in specified points with the smallest Y.

  Parameters:
    `points` - points to search
  Returns:
    index in specified points array

### findMaxY

    private int findMaxY(WeightedObservedPoint[] points)

  Finds index of point in specified points with the largest Y.

  Parameters:
    `points` - points to search
  Returns:
    index in specified points array

### interpolateXAtY

    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.

  Parameters:
    `points` - points to use for interpolation
    `startIdx` - index within points from which to start search for interpolation bounds points
    `idxStep` - index step for search for interpolation bounds points
    `y` - Y value for which X should be determined
  Returns:
    value of X at the specified Y
  Throws:
    `IllegalArgumentException` - if idxStep is 0
    `OutOfRangeException` - if specified `y` is not within the range of the specified `points`

### getInterpolationPointsForY

    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.

  Parameters:
    `points` - points to use for interpolation
    `startIdx` - index within points from which to start search for interpolation bounds points
    `idxStep` - index step for search for interpolation bounds points
    `y` - Y value for which X should be determined
  Returns:
    array containing two points suitable for determining X at the specified Y
  Throws:
    `IllegalArgumentException` - if idxStep is 0
    `OutOfRangeException` - if specified `y` is not within the range of the specified `points`

### isBetween

    private boolean isBetween(double value,
                              double boundary1,
                              double boundary2)

  Determines whether a value is between two other values.

  Parameters:
    `value` - value to determine whether is between `boundary1` and `boundary2`
    `boundary1` - one end of the range
    `boundary2` - other end of the range
  Returns:
    true if `value` is between `boundary1` and `boundary2` (inclusive); false otherwise

### createWeightedObservedPointComparator

    private Comparator<WeightedObservedPoint> createWeightedObservedPointComparator()

  Factory method creating `Comparator` for comparing `WeightedObservedPoint` instances.

  Returns:
    new `Comparator` instance

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2003-2013 Apache Software Foundation