org.encog.neural.thermal
Class HopfieldNetwork

java.lang.Object
  extended by org.encog.ml.BasicML
      extended by org.encog.neural.thermal.ThermalNetwork
          extended by org.encog.neural.thermal.HopfieldNetwork
All Implemented Interfaces:
Serializable, MLAutoAssocation, MLInput, MLInputOutput, MLMethod, MLOutput, MLProperties, MLRegression, MLResettable

public class HopfieldNetwork
extends ThermalNetwork

Implements a Hopfield network.

See Also:
Serialized Form

Constructor Summary
HopfieldNetwork()
          Default constructor.
HopfieldNetwork(int neuronCount)
          Construct a Hopfield with the specified neuron count.
 
Method Summary
 void addPattern(MLData pattern)
          Train the neural network for the specified pattern.
 MLData compute(MLData input)
          Note: for Hopfield networks, you will usually want to call the "run" method to compute the output.
 int getInputCount()
          
 int getOutputCount()
          
 void run()
          Perform one Hopfield iteration.
 int runUntilStable(int max)
          Run the network until it becomes stable and does not change from more runs.
 void updateProperties()
          Update any objeccts when a property changes.
 
Methods inherited from class org.encog.neural.thermal.ThermalNetwork
addWeight, calculateEnergy, clear, getCurrentState, getNeuronCount, getWeight, getWeights, init, reset, reset, setCurrentState, setCurrentState, setNeuronCount, setWeight, setWeights
 
Methods inherited from class org.encog.ml.BasicML
getProperties, getPropertyDouble, getPropertyLong, getPropertyString, setProperty, setProperty, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HopfieldNetwork

public HopfieldNetwork()
Default constructor.


HopfieldNetwork

public HopfieldNetwork(int neuronCount)
Construct a Hopfield with the specified neuron count.

Parameters:
neuronCount - The neuron count.
Method Detail

addPattern

public void addPattern(MLData pattern)
Train the neural network for the specified pattern. The neural network can be trained for more than one pattern. To do this simply call the train method more than once.

Parameters:
pattern - The pattern to train for.

compute

public MLData compute(MLData input)
Note: for Hopfield networks, you will usually want to call the "run" method to compute the output. This method can be used to copy the input data to the current state. A single iteration is then run, and the new current state is returned.

Parameters:
input - The input pattern.
Returns:
The new current state.

getInputCount

public int getInputCount()

Returns:
The input.

getOutputCount

public int getOutputCount()

Returns:
The output count.

run

public void run()
Perform one Hopfield iteration.


runUntilStable

public int runUntilStable(int max)
Run the network until it becomes stable and does not change from more runs.

Parameters:
max - The maximum number of cycles to run before giving up.
Returns:
The number of cycles that were run.

updateProperties

public void updateProperties()
Update any objeccts when a property changes.

Specified by:
updateProperties in interface MLProperties
Specified by:
updateProperties in class BasicML


Copyright © 2014. All Rights Reserved.