org.encog.neural.pattern

## Class HopfieldPattern

- java.lang.Object
- - org.encog.neural.pattern.HopfieldPattern

- All Implemented Interfaces:
    NeuralNetworkPattern

      public class HopfieldPattern
      extends Object
      implements NeuralNetworkPattern

  Create a Hopfield pattern. A Hopfield neural network has a single layer that functions both as the input and output layers. There are no hidden layers. Hopfield networks are used for basic pattern recognition. When a Hopfield network recognizes a pattern, it "echos" that pattern on the output.
  Author:
    jheaton

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HopfieldPattern()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addHiddenLayer(int count)` Add a hidden layer.
    `void` | `clear()` Nothing to clear.
    `MLMethod` | `generate()` Generate the Hopfield neural network.
    `void` | `setActivationFunction(ActivationFunction activation)` Set the activation function to use.
    `void` | `setInputNeurons(int count)` Set the number of input neurons, this must match the output neurons.
    `void` | `setOutputNeurons(int count)` Set the number of output neurons, should not be used with a hopfield neural network, because the number of input neurons defines the number of output neurons.

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

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

- - ### Constructor Detail

    - #### HopfieldPattern

          public HopfieldPattern()

  - ### Method Detail

    - #### addHiddenLayer

          public void addHiddenLayer(int count)

      Add a hidden layer. This will throw an error, because the Hopfield neural network has no hidden layers.
      Specified by:
        `addHiddenLayer` in interface `NeuralNetworkPattern`
      Parameters:
        `count` - The number of neurons.

    - #### clear

          public void clear()

      Nothing to clear.
      Specified by:
        `clear` in interface `NeuralNetworkPattern`

    - #### generate

          public MLMethod generate()

      Generate the Hopfield neural network.
      Specified by:
        `generate` in interface `NeuralNetworkPattern`
      Returns:
        The generated network.

    - #### setActivationFunction

          public void setActivationFunction(ActivationFunction activation)

      Set the activation function to use. This function will throw an error, because the Hopfield network must use the BiPolar activation function.
      Specified by:
        `setActivationFunction` in interface `NeuralNetworkPattern`
      Parameters:
        `activation` - The activation function to use.

    - #### setInputNeurons

          public void setInputNeurons(int count)

      Set the number of input neurons, this must match the output neurons.
      Specified by:
        `setInputNeurons` in interface `NeuralNetworkPattern`
      Parameters:
        `count` - The number of neurons.

    - #### setOutputNeurons

          public void setOutputNeurons(int count)

      Set the number of output neurons, should not be used with a hopfield neural network, because the number of input neurons defines the number of output neurons.
      Specified by:
        `setOutputNeurons` in interface `NeuralNetworkPattern`
      Parameters:
        `count` - The number of neurons.

Copyright © 2014. All Rights Reserved.