KiTrack  1.7.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
KiTrack::HopfieldNeuralNet Class Reference

Represents a Hopfield Neural Network. More...

#include <HopfieldNeuralNet.h>

Public Member Functions

 HopfieldNeuralNet (std::vector< std::vector< bool > > G, std::vector< double > QI, std::vector< double > states, double omega) throw ( InvalidParameter )
 
bool doIteration ()
 Does one iteration of the neuronal network. More...
 
void setT (double T)
 Sets the temperature of the Neural Network (The HNN is cooled down in every iteration)
 
void setTInf (double TInf)
 Sets the temperature at infinity. More...
 
void setLimitForStable (double limit)
 Set the threshhold value below which the HNN is seen as "stable". More...
 
std::vector< double > getStates ()
 

Protected Member Functions

double activationFunction (double state, double T)
 Calculates the activation function. More...
 

Protected Attributes

std::vector< std::vector
< double > > 
_W
 the matrix of the weights
 
std::vector< double > _States
 states describing how active a neuron is
 
std::vector< double > _w0
 
double _T
 temperature
 
double _TInf
 temperature after infinite iterations
 
bool _isStable
 indicates if the neuronal network is stable. More...
 
double _limitForStable
 The upper limit for change of a neuron, if it should be considered stabel. More...
 
double _omega
 Omega controls the influence of the quality indicator on the activation of the neuron.
 
std::vector< unsigned > _order
 the order of the neurons to be updated. More...
 

Detailed Description

Represents a Hopfield Neural Network.

See this for detailed info.

Author: Robin Glattauer, HEPHY

Constructor & Destructor Documentation

HopfieldNeuralNet::HopfieldNeuralNet ( std::vector< std::vector< bool > >  G,
std::vector< double >  QI,
std::vector< double >  states,
double  omega 
)
throw (InvalidParameter
)
Parameters
GA matrix of the correlations between the neurons. True means two neurons are incompatible. False means, they are compatible. (the diagonal elements are 0 by definition and any entry there will be ignored and set to 0)
QIA vector containing the qualtity indicators of the neurons (i.e. their power to amplify or weaken other neurons). Quality should be indicated by a value between 0 and 1. 1 being the highest quality.
statesThe states of the neurons. Should be between 0 and 1.
omegaControls the influence of the quality indicator on the activation of the neuron. Needs to be between 0 and 1. 0 means, no influence from the quality of the neurons -> system tends to biggest compatible set. 1 means highest influence from the quality of the neurons -> the highest quality neurons tend to win.

Member Function Documentation

double HopfieldNeuralNet::activationFunction ( double  state,
double  T 
)
protected

Calculates the activation function.

Parameters
statethe state
Tthe temperature
Returns
the activation function corresponding to the input values: g(x) = 1/2* (1 + tanh( x/T ))

Referenced by doIteration().

bool HopfieldNeuralNet::doIteration ( )

Does one iteration of the neuronal network.

$ \vec{y} = W \times \vec{state} + \vec{w_0} $

$ \vec{state}_{new} = activationFunction(\vec{y}) $

Returns
Whether the Neural Network is considered as stable

References _isStable, _limitForStable, _order, _States, _T, _TInf, _W, and activationFunction().

Referenced by KiTrack::SubsetHopfieldNN< T >::calculateBestSet().

std::vector<double> KiTrack::HopfieldNeuralNet::getStates ( )
inline
Returns
the vector of the states

References _States.

Referenced by KiTrack::SubsetHopfieldNN< T >::calculateBestSet().

void KiTrack::HopfieldNeuralNet::setLimitForStable ( double  limit)
inline

Set the threshhold value below which the HNN is seen as "stable".

As long as any Neuron changes its state by a value bigger than this, the HNN is not considered stable. When all Neurons change their states so little, that none of the changes exceeds this threshold, then the HNN is stable.

References _limitForStable.

Referenced by KiTrack::SubsetHopfieldNN< T >::calculateBestSet().

void KiTrack::HopfieldNeuralNet::setTInf ( double  TInf)
inline

Sets the temperature at infinity.

The temperature will converge to this value after infinite iterations.

References _TInf.

Referenced by KiTrack::SubsetHopfieldNN< T >::calculateBestSet().

Member Data Documentation

bool KiTrack::HopfieldNeuralNet::_isStable
protected

indicates if the neuronal network is stable.

this is true when the change after one iteration of any neuron is not bigger than the value _limitForStable.

Referenced by doIteration().

double KiTrack::HopfieldNeuralNet::_limitForStable
protected

The upper limit for change of a neuron, if it should be considered stabel.

Referenced by doIteration(), and setLimitForStable().

std::vector<unsigned> KiTrack::HopfieldNeuralNet::_order
protected

the order of the neurons to be updated.

So it should of course reach from 0 to the number of neurons -1. (4 , 2, 0 1, 3) will for example mean: update first the neuron 4, then the neuron 2, then 0 and so on

Referenced by doIteration().


The documentation for this class was generated from the following files: