jAER project on SourceForge

ch.unizh.ini.jaer.projects.hopfield.matrix
Class HopfieldNetwork

java.lang.Object
  extended by ch.unizh.ini.jaer.projects.hopfield.matrix.HopfieldNetwork

public class HopfieldNetwork
extends java.lang.Object

HopfieldNetwork: This class implements a Hopfield neural network. A Hopfield neural network is fully connected and consists of a single layer. Hopfield neural networks are usually used for pattern recognition.

Version:
2.1
Author:
Jeff Heaton

Constructor Summary
HopfieldNetwork(int size)
           
 
Method Summary
 IntMatrix getMatrix()
          Get the weight matrix for this neural network.
 int getSize()
          Get the size of this neural network.
 boolean[] present(boolean[] pattern)
          Present a pattern to the neural network and receive the result.
 void train(boolean[] pattern)
          Train the neural network for the specified pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HopfieldNetwork

public HopfieldNetwork(int size)
Method Detail

getMatrix

public IntMatrix getMatrix()
Get the weight matrix for this neural network.

Returns:
the weight matrix

getSize

public int getSize()
Get the size of this neural network.

Returns:
the size (number of rows)

present

public boolean[] present(boolean[] pattern)
Present a pattern to the neural network and receive the result.

Parameters:
pattern - The pattern to be presented to the neural network.
Returns:
The output from the neural network.
Throws:
HopfieldException - The pattern caused a matrix math error.

train

public void train(boolean[] 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 on.
Throws:
HopfieldException - The pattern size must match the size of this neural network.

jAER project on SourceForge