org.encog.engine.network.activation

## Class ActivationStep

- java.lang.Object
- - org.encog.engine.network.activation.ActivationStep

- All Implemented Interfaces:
    Serializable, Cloneable, ActivationFunction

      public class ActivationStep
      extends Object
      implements ActivationFunction

  The step activation function is a very simple activation function. It is the activation function that was used by the original perceptron. Using the default parameters it will return 1 if the input is 0 or greater. Otherwise it will return 0. The center, low and high properties allow you to define how this activation function works. If the input is equal to center or higher the high property value will be returned, otherwise the low property will be returned. This activation function does not have a derivative, and can not be used with propagation training, or any other training that requires a derivative.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `PARAM_STEP_CENTER` The step center parameter.
    `static int` | `PARAM_STEP_HIGH` The step high parameter.
    `static int` | `PARAM_STEP_LOW` The step low parameter.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ActivationStep()` Create a basic step activation with low=0, center=0, high=1.
    `ActivationStep(double low, double center, double high)` Construct a step activation function.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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` | `getFactoryCode()`
    `double` | `getHigh()`
    `double` | `getLow()`
    `String[]` | `getParamNames()`
    `double[]` | `getParams()`
    `boolean` | `hasDerivative()`
    `void` | `setCenter(double d)` Set the center of this function.
    `void` | `setHigh(double d)` Set the high of this function.
    `void` | `setLow(double d)` Set the low of this function.
    `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_STEP_CENTER

          public static final int PARAM_STEP_CENTER

      The step center parameter.
      See Also:
        Constant Field Values

    - #### PARAM_STEP_LOW

          public static final int PARAM_STEP_LOW

      The step low parameter.
      See Also:
        Constant Field Values

    - #### PARAM_STEP_HIGH

          public static final int PARAM_STEP_HIGH

      The step high parameter.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ActivationStep

          public ActivationStep()

      Create a basic step activation with low=0, center=0, high=1.

    - #### ActivationStep

          public ActivationStep(double low,
                        double center,
                        double high)

      Construct a step activation function.
      Parameters:
        `low` - The low of the function.
        `center` - The center of the function.
        `high` - The high of the function.

  - ### Method Detail

    - #### 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.

    - #### clone

          public final ActivationFunction clone()

      Specified by:
        `clone` in interface `ActivationFunction`
      Overrides:
        `clone` in class `Object`
      Returns:
        A clone of this object.

    - #### 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.

    - #### getCenter

          public final double getCenter()

      Returns:
        The center.

    - #### getHigh

          public final double getHigh()

      Returns:
        The high value.

    - #### getLow

          public final double getLow()

      Returns:
        The low value.

    - #### 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.

    - #### hasDerivative

          public final boolean hasDerivative()

      Specified by:
        `hasDerivative` in interface `ActivationFunction`
      Returns:
        Returns true, this activation function has a derivative.

    - #### setCenter

          public final void setCenter(double d)

      Set the center of this function.
      Parameters:
        `d` - The center of this function.

    - #### setHigh

          public final void setHigh(double d)

      Set the high of this function.
      Parameters:
        `d` - The high of this function.

    - #### setLow

          public final void setLow(double d)

      Set the low of this function.
      Parameters:
        `d` - The low of this 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.

    - #### getFactoryCode

          public String getFactoryCode()

      Specified by:
        `getFactoryCode` in interface `ActivationFunction`
      Returns:
        The string for the Encog factory code. Return null if you do not care to be support for creating of your activation through factory.

Copyright © 2014. All Rights Reserved.