org.encog.neural.networks.training.pnn
Class GlobalMinimumSearch

java.lang.Object
  extended by org.encog.neural.networks.training.pnn.GlobalMinimumSearch

public class GlobalMinimumSearch
extends Object

Search sigma's for a global minimum. First do a rough search, and then use the "Brent Method" to refine the search for an optimal sigma. This class uses the same sigma for each kernel. Multiple sigmas will be introduced in a later step. Some of the algorithms in this class are based on C++ code from: Advanced Algorithms for Neural Networks: A C++ Sourcebook by Timothy Masters John Wiley & Sons Inc (Computers); April 3, 1995 ISBN: 0471105880


Field Summary
static double CGOLD
          The golden section.
 
Constructor Summary
GlobalMinimumSearch()
           
 
Method Summary
 double brentmin(int maxIterations, double maxError, double eps, double tol, CalculationCriteria network, double y)
          Use the "Brent Method" to find a better minimum.
 void findBestRange(double low, double high, int numberOfPoints, boolean useLog, double minError, CalculationCriteria network)
          Find the best common gamma.
 double getX1()
           
 double getX2()
           
 double getX3()
           
 double getY1()
           
 double getY2()
           
 double getY3()
           
 void setX1(double x1)
           
 void setX2(double x2)
           
 void setX3(double x3)
           
 void setY1(double y1)
           
 void setY2(double y2)
           
 void setY3(double y3)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CGOLD

public static final double CGOLD
The golden section.

See Also:
Constant Field Values
Constructor Detail

GlobalMinimumSearch

public GlobalMinimumSearch()
Method Detail

brentmin

public double brentmin(int maxIterations,
                       double maxError,
                       double eps,
                       double tol,
                       CalculationCriteria network,
                       double y)
Use the "Brent Method" to find a better minimum.

Parameters:
maxIterations - THe maximum number of iterations.
maxError - We can stop if we reach this error.
eps - The approximate machine precision.
tol - Brent's tolerance, must be >= sqrt( eps )
network - The network to obtain the error from.
y - The error at x2.
Returns:
The best error.

findBestRange

public void findBestRange(double low,
                          double high,
                          int numberOfPoints,
                          boolean useLog,
                          double minError,
                          CalculationCriteria network)
Find the best common gamma. Use the same gamma for all kernels. This is a crude brute-force search. The range found should be refined using the "Brent Method", also provided in this class.

Parameters:
low - The low gamma to begin the search with.
high - The high gamma to end the search with.
numberOfPoints - The number of points between the low and high. Set this value to negative to prevent the first point from being calculated. If you do set this to negative, set x2 and y2 to the correct values.
useLog - Should we progress "logarithmically" from low to high.
minError - We are done if the error is below this.
network - The network to evaluate.

getX1

public double getX1()
Returns:
X1, which is a gamma to the left(lower) of the best(middle) gamma.

getX2

public double getX2()
Returns:
X2, which is the middle(best) gamma.

getX3

public double getX3()
Returns:
X3, which is a gamma to the right(higher) of the middle(best) gamma.

getY1

public double getY1()
Returns:
Y1, which is the value y1 is the error for x1.

getY2

public double getY2()
Returns:
Y2, which is the value y2 is the error for x2. This is the best(middle) error.

getY3

public double getY3()
Returns:
Y3, which is the value y1 is the error for x1.

setX1

public void setX1(double x1)
Parameters:
x1 - Set X1, which is a gamma to the left(lower) of the best(middle) gamma.

setX2

public void setX2(double x2)
Parameters:
x2 - Set X2, which is the middle(best) gamma.

setX3

public void setX3(double x3)
Parameters:
x3 - Set X3, which is a gamma to the right(higher) of the middle(best) gamma.

setY1

public void setY1(double y1)
Parameters:
y1 - Set Y1, which is the value y1 is the error for x1.

setY2

public void setY2(double y2)
Parameters:
y2 - Set Y2, which is the value y2 is the error for x2. This is the best(middle) error.

setY3

public void setY3(double y3)
Parameters:
y3 - Set Y3, which is the value y3 is the error for x3.


Copyright © 2014. All Rights Reserved.