org.encog.engine.network.activation
Class ActivationGaussian

java.lang.Object
  extended by org.encog.engine.network.activation.ActivationGaussian
All Implemented Interfaces:
Serializable, Cloneable, ActivationFunction

public class ActivationGaussian
extends Object
implements ActivationFunction

An activation function based on the gaussian function.

Author:
jheaton
See Also:
Serialized Form

Field Summary
static int PARAM_GAUSSIAN_CENTER
          The offset to the parameter that holds the width.
static int PARAM_GAUSSIAN_PEAK
          The offset to the parameter that holds the peak.
static int PARAM_GAUSSIAN_WIDTH
          The offset to the parameter that holds the width.
 
Constructor Summary
ActivationGaussian()
           
ActivationGaussian(double center, double peak, double width)
          Create a gaussian activation function.
 
Method Summary
 void activationFunction(double[] x, int start, int size)
          Implements the activation function.
 ActivationFunction clone()
           
 double derivativeFunction(double b, double a)
          Calculate the derivative.
 double getCenter()
           
 String[] getParamNames()
          
 double[] getParams()
          
 double getWidth()
           
 boolean hasDerivative()
           
 void setParam(int index, double value)
          Set one of the params for this activation function.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAM_GAUSSIAN_CENTER

public static final int PARAM_GAUSSIAN_CENTER
The offset to the parameter that holds the width.

See Also:
Constant Field Values

PARAM_GAUSSIAN_PEAK

public static final int PARAM_GAUSSIAN_PEAK
The offset to the parameter that holds the peak.

See Also:
Constant Field Values

PARAM_GAUSSIAN_WIDTH

public static final int PARAM_GAUSSIAN_WIDTH
The offset to the parameter that holds the width.

See Also:
Constant Field Values
Constructor Detail

ActivationGaussian

public ActivationGaussian(double center,
                          double peak,
                          double width)
Create a gaussian activation function.

Parameters:
center - The center of the curve.
peak - The peak of the curve.
width - The width of the curve.

ActivationGaussian

public ActivationGaussian()
Method Detail

clone

public final ActivationFunction clone()
Specified by:
clone in interface ActivationFunction
Overrides:
clone in class Object
Returns:
The object cloned.

getWidth

public final double getWidth()
Returns:
The width of the function.

getCenter

public final double getCenter()
Returns:
The center of the function.

hasDerivative

public final boolean hasDerivative()
Specified by:
hasDerivative in interface ActivationFunction
Returns:
Return true, gaussian has a derivative.

activationFunction

public final void activationFunction(double[] x,
                                     int start,
                                     int size)
Implements the activation function. The array is modified according to the activation function being used. See the class description for more specific information on this type of activation function.

Specified by:
activationFunction in interface ActivationFunction
Parameters:
x - The input array to the activation function.
start - The starting index.
size - The number of values to calculate.

derivativeFunction

public final double derivativeFunction(double b,
                                       double a)
Calculate the derivative. For performance reasons two numbers are provided. First, the value "b" is simply the number that we would like to calculate the derivative of. Second, the value "a", which is the value returned by the activation function, when presented with "b". We use two values because some of the most common activation functions make use of the result of the activation function. It is bad for performance to calculate this value twice. Yet, not all derivatives are calculated this way. By providing both the value before the activation function is applied ("b"), and after the activation function is applied("a"), the class can be constructed to use whichever value will be the most efficient.

Specified by:
derivativeFunction in interface ActivationFunction
Parameters:
b - The number to calculate the derivative of, the number "before" the activation function was applied.
a - The number "after" an activation function has been applied.
Returns:
The derivative.

getParamNames

public final String[] getParamNames()

Specified by:
getParamNames in interface ActivationFunction
Returns:
The names of the parameters.

getParams

public final double[] getParams()

Specified by:
getParams in interface ActivationFunction
Returns:
The params for this activation function.

setParam

public final void setParam(int index,
                           double value)
Set one of the params for this activation function.

Specified by:
setParam in interface ActivationFunction
Parameters:
index - The index of the param to set.
value - The value to set.


Copyright © 2011. All Rights Reserved.