Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

HopfieldNetwork Class Reference

A "standard" incarnation of the Hopfield network usable form most purposes. More...

#include <HopfieldNetwork.h>

Inheritance diagram for HopfieldNetwork:

Inheritance graph
[legend]
Collaboration diagram for HopfieldNetwork:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 HopfieldNetwork (uint size, bool bias=false, bool bipolar=true)
 HopfieldNetwork (const char *filename)
 Loads a Hopfield network from a file.

 ~HopfieldNetwork ()
 Cleans up memory by getting rid of the weight matrix.

virtual void save (const std::string &filename)
 Saves the network to a file.

virtual void setWeight (uint i, uint j, real weight)
 Sets the weight between the ith and jth neuron.

virtual Matrix getWeightMatrix ()
 Returns a copy of the weight matrix that is used by this network.

virtual void addPattern (int pattern[])
 Adds a pattern to the network by making suitable adjustments to the weight matrix.

virtual uint getPatternCount ()
 The number of patterns that the network has been instructed to store This will be the same as the number of calls to addPattern.


Protected Member Functions

virtual real getWeight (uint from, uint to) const

Protected Attributes

Matrix_weightMatrix
 The weight matrix of the network.


Detailed Description

A "standard" incarnation of the Hopfield network usable form most purposes.

It will have problems with large number of neurons (because the weights for 'em need ^2 memory)


Constructor & Destructor Documentation

HopfieldNetwork uint  size,
bool  bias = false,
bool  bipolar = true
 

HopfieldNetwork const char *  filename  ) 
 

Loads a Hopfield network from a file.

See also:
save
Parameters:
filename The name of the filename to load the network from
Exceptions:
Exception on any error

~HopfieldNetwork  ) 
 

Cleans up memory by getting rid of the weight matrix.


Member Function Documentation

virtual void addPattern int  pattern[]  )  [virtual]
 

Adds a pattern to the network by making suitable adjustments to the weight matrix.

Parameters:
pattern The bipolar pattern (of getSize() length) to be stored
Exceptions:
Exception If the given pattern is not bipolar (i.e., consisting of only -1s and 1s) and the network is designed for bipolar patters or if the pattern does not consist of 0s and 1s

virtual uint getPatternCount  )  [virtual]
 

The number of patterns that the network has been instructed to store This will be the same as the number of calls to addPattern.

See also:
addPattern

virtual real getWeight uint  from,
uint  to
const [protected, virtual]
 

Implements HopfieldBase.

virtual Matrix getWeightMatrix  )  [virtual]
 

Returns a copy of the weight matrix that is used by this network.

virtual void save const std::string &  filename  )  [virtual]
 

Saves the network to a file.

Todo:
Implement this!
Parameters:
filename The name of the file to store the network into so that it can be loaded from there later

Reimplemented from HopfieldBase.

virtual void setWeight uint  i,
uint  j,
real  weight
[virtual]
 

Sets the weight between the ith and jth neuron.

Since the weights are symmetruc, the weight between neuron i and neuron j will be the same as the weight between neuron j and neuron i, which will be the same as the weight supplied.

Parameters:
i The ith neuron
j The jth neuron
weight The weight of the link (i,j) and (j,i)

Implements HopfieldBase.


Member Data Documentation

Matrix* _weightMatrix [protected]
 

The weight matrix of the network.


The documentation for this class was generated from the following file:
Generated on Fri Jun 18 13:18:59 2004 for Annie by doxygen 1.3.5