org.encog.engine.network.activation

## Class ActivationRamp

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

- All Implemented Interfaces:
    Serializable, Cloneable, ActivationFunction

      public class ActivationRamp
      extends Object
      implements ActivationFunction

  A ramp activation function. This function has a high and low threshold. If the high threshold is exceeded a fixed value is returned. Likewise, if the low value is exceeded another fixed value is returned.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `PARAM_RAMP_HIGH` The ramp high parameter.
    `static int` | `PARAM_RAMP_HIGH_THRESHOLD` The ramp high threshold parameter.
    `static int` | `PARAM_RAMP_LOW` The ramp low parameter.
    `static int` | `PARAM_RAMP_LOW_THRESHOLD` The ramp low threshold parameter.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ActivationRamp()` Default constructor.
    `ActivationRamp(double thresholdHigh, double thresholdLow, double high, double low)` Construct a ramp 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()` Clone the object.
    `double` | `derivativeFunction(double b, double a)` Calculate the derivative.
    `String` | `getFactoryCode()`
    `double` | `getHigh()`
    `double` | `getLow()`
    `String[]` | `getParamNames()`
    `double[]` | `getParams()`
    `double` | `getThresholdHigh()`
    `double` | `getThresholdLow()`
    `boolean` | `hasDerivative()`
    `void` | `setHigh(double d)` Set the high value.
    `void` | `setLow(double d)` Set the low value.
    `void` | `setParam(int index, double value)` Set one of the params for this activation function.
    `void` | `setThresholdHigh(double d)` Set the threshold high.
    `void` | `setThresholdLow(double d)` Set the threshold low.

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### PARAM_RAMP_HIGH_THRESHOLD

          public static final int PARAM_RAMP_HIGH_THRESHOLD

      The ramp high threshold parameter.
      See Also:
        Constant Field Values

    - #### PARAM_RAMP_LOW_THRESHOLD

          public static final int PARAM_RAMP_LOW_THRESHOLD

      The ramp low threshold parameter.
      See Also:
        Constant Field Values

    - #### PARAM_RAMP_HIGH

          public static final int PARAM_RAMP_HIGH

      The ramp high parameter.
      See Also:
        Constant Field Values

    - #### PARAM_RAMP_LOW

          public static final int PARAM_RAMP_LOW

      The ramp low parameter.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ActivationRamp

          public ActivationRamp()

      Default constructor.

    - #### ActivationRamp

          public ActivationRamp(double thresholdHigh,
                        double thresholdLow,
                        double high,
                        double low)

      Construct a ramp activation function.
      Parameters:
        `thresholdHigh` - The high threshold value.
        `thresholdLow` - The low threshold value.
        `high` - The high value, replaced if the high threshold is exceeded.
        `low` - The low value, replaced if the low threshold is exceeded.

  - ### 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()

      Clone the object.
      Specified by:
        `clone` in interface `ActivationFunction`
      Overrides:
        `clone` in class `Object`
      Returns:
        The cloned 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.

    - #### getHigh

          public final double getHigh()

      Returns:
        the high

    - #### getLow

          public final double getLow()

      Returns:
        the low

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

    - #### getThresholdHigh

          public final double getThresholdHigh()

      Returns:
        the thresholdHigh

    - #### getThresholdLow

          public final double getThresholdLow()

      Returns:
        the thresholdLow

    - #### hasDerivative

          public final boolean hasDerivative()

      Specified by:
        `hasDerivative` in interface `ActivationFunction`
      Returns:
        True, as this function does have a derivative.

    - #### setHigh

          public final void setHigh(double d)

      Set the high value.
      Parameters:
        `d` - The high value.

    - #### setLow

          public final void setLow(double d)

      Set the low value.
      Parameters:
        `d` - The low value.

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

    - #### setThresholdHigh

          public final void setThresholdHigh(double d)

      Set the threshold high.
      Parameters:
        `d` - The threshold high.

    - #### setThresholdLow

          public final void setThresholdLow(double d)

      Set the threshold low.
      Parameters:
        `d` - The threshold low.

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