Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members  

Network Class Reference

This class manages the NN as it runs. More...

#include <amygdala/network.h>

Inheritance diagram for Network:

MpNetwork List of all members.

Public Types

typedef hash_map< AmIdInt,
Neuron * >::const_iterator 
const_iterator
typedef hash_map< unsigned
int, Layer * >::iterator 
layer_iterator

Public Methods

 Network ()
virtual ~Network ()
void ScheduleNEvent (NEvent eventType, AmTimeInt eventTime, Neuron *reqNrn)
void ScheduleNEvent (NEvent eventType, AmTimeInt eventTime, AmIdInt reqNrnId)
NeuronAddNeuron (NeuronRole nRole, AmIdInt nId)
NeuronAddNeuron (NeuronRole nRole, Neuron *nrn)
bool ConnectNeurons (AmIdInt preSynapticNeuron, AmIdInt postSynapticNeuron, float weight, AmTimeInt delay=0)
bool ConnectNeurons (Neuron *preSynapticNeuron, Neuron *postSynapticNeuron, float weight, AmTimeInt delay=0)
void Run (AmTimeInt maxRunTime)
int Size ()
int LayerCount ()
const_iterator begin () const
const_iterator end () const
layer_iterator layer_begin ()
layer_iterator layer_end ()
void AddLayer (Layer *newLayer)
AmIdInt MaxNeuronId ()
bool Layered ()
NeuronGetNeuron (AmIdInt nId)
SpikeInputGetSpikeInput ()
void SetSpikeInput (SpikeInput *sIn)
bool StreamingInput ()
void StreamingInput (bool streaming)
void SetTrainingMode (bool tMode)
bool GetTrainingMode () const
LayerGetLayer (AmIdInt layerId)
void EnableSpikeBatching ()

Static Public Methods

void SetTimeStepSize (AmTimeInt stepSize)
AmTimeInt TimeStepSize ()
AmTimeInt SimTime ()
void ResetSimTime ()

Protected Methods

void ScheduleSpikeDelay (vector< Synapse * > &axon)
virtual void IncrementSimTime ()
void IncrementDelayOffset ()

Protected Attributes

int pspLSize
int pspLRes
int netSize
bool streamingInput
AmIdInt nextNeuronId
unsigned int nextLayerId
FunctionLookupfunctionRef
SpikeInputspikeInput
hash_map< AmIdInt, Neuron * > net
hash_map< unsigned int, Layer * > layers
priority_queue< SpikeRequesteventQ
priority_queue< SpikeRequestinputQ
vector< vector< Synapse * > > delayedSpikeQ
AmTimeInt currSpikeDelayOffset
AmTimeInt maxOffset
bool spikeDelaysOn
AmTimeInt maxSpikeDelay
SynapsemaxSpikeDelaySyn
unsigned int spikeBatchCount

Static Protected Attributes

AmTimeInt simStepSize
AmTimeInt simTime
unsigned int runCount

Friends

class Neuron
void MpSpikeInput::ReadInputBuffer ()

Detailed Description

This class manages the NN as it runs.

Network acts as a container for Neurons and Layers and also coordinates spike transmission between neurons. Amygdala supports multi-threading through the use of the MpNetwork class which allows neural nets to be partitioned across multiple Network objects. MpNetwork handles all communication between Networks and Neurons running in separate threads. This model will be extended in the future to allow Amygdala networks to run on clustered computer systems.

If there is a need to run two or more entirely separate neural nets at the same time, it is recommended that they be put into separate processes using fork() (or any other method that is useful). It would be possible to run separate networks by using MpNetwork, but the results may not be what is expected since MpNetwork is designed with the assumption that all MpNetwork objects belong to the same physical neural net.

See also:
MpNetwork
Author:
Matt Grover


Member Typedef Documentation

typedef hash_map<AmIdInt, Neuron*>::const_iterator Network::const_iterator
 

Define an iterator to parse through all Neurons contained in the network.

typedef hash_map<unsigned int, Layer*>::iterator Network::layer_iterator
 

Define an iterator to parse through all Layers contained in the network.


Member Function Documentation

void Network::AddLayer Layer   newLayer
 

Add a layer to the network. The Network assumes ownership over the Layer object and the Neuron objects contained within that Layer.

Parameters:
newLayer  Pointer to the Layer being added.

Neuron* Network::AddNeuron NeuronRole    nRole,
Neuron   nrn
 

Add a Neuron to the network.

Parameters:
nRole  One of INPUTNEURON, HIDDENNEURON, or OUTPUTNEURON.
nrn  Pointer to a Neuron. Network assumes ownership of the pointer once it has been added to the network.
Returns:
A pointer to the neuron is returned on success, a null pointer on failure.

Neuron* Network::AddNeuron NeuronRole    nRole,
AmIdInt    nId
 

Add a neuron to the network with a pre-determined neuron ID.

Parameters:
nRole  One of INPUTNEURON, HIDDENNEURON, or OUTPUTNEURON.
nId  The desired neuron ID.
Returns:
A pointer to the new neuron on success. Null pointer on failure.

const_iterator Network::begin   const [inline]
 

Returns:
The first position of the iterator.

bool Network::ConnectNeurons Neuron   preSynapticNeuron,
Neuron   postSynapticNeuron,
float    weight,
AmTimeInt    delay = 0
 

Connect two neurons together.

Parameters:
preSynapticNeuron  The pre-synaptic (originating) neuron pointer.
postSynapticNeuron  The post-synaptic (receiving) neuron pointer.
weight  A weight value in the range [-1, 1].
delay  The spike transmission delay in microseconds. Delay values will be rounded to the nearest whole multiple of the time step size.
Returns:
True on success.

bool Network::ConnectNeurons AmIdInt    preSynapticNeuron,
AmIdInt    postSynapticNeuron,
float    weight,
AmTimeInt    delay = 0
 

Connect two neurons together.

Parameters:
preSynapticNeuron  The pre-synaptic (originating) neuron ID.
postSynapticNeuron  The post-synaptic (receiving) neuron ID.
weight  A weight value in the range [-1, 1].
delay  The spike transmission delay in microseconds. Delay values will be rounded to the nearest whole multiple of the time step size.
Returns:
True on success.

void Network::EnableSpikeBatching   [inline]
 

Turn on spike batching (send all spikes to a neuron in a group, rather than one at a time). This is turned on automatically if spike delays are used and cannot be turned off again once this function has been called.

const_iterator Network::end   const [inline]
 

Returns:
The final position of the iterator.

Layer* Network::GetLayer AmIdInt    layerId
 

Returns:
a pointer to the Layer with layerID

Neuron* Network::GetNeuron AmIdInt    nId [inline]
 

Get a reference to a specific Neuron.

Parameters:
nId  The neuron ID of the Neuron.
Returns:
Pointer to the neuron with ID nId.

SpikeInput* Network::GetSpikeInput   [inline]
 

Returns:
Pointer to the SpikeInput object that is being used.

bool Network::GetTrainingMode   const [inline]
 

Returns:
True if training is enabled.

virtual void Network::IncrementSimTime   [protected, virtual]
 

Increment the simTime variable to the next time step. In multithreaded mode, simTime is not incremented until all Nodes have called IncrementSimTime().

Reimplemented in MpNetwork.

layer_iterator Network::layer_begin   [inline]
 

Returns:
The first position of the layer iterator.

layer_iterator Network::layer_end   [inline]
 

Returns:
The final position of the layer iterator.

int Network::LayerCount   [inline]
 

Returns:
The number of layers in the network.

bool Network::Layered   [inline]
 

Returns:
True if the Network contains Layers.

AmIdInt Network::MaxNeuronId   [inline]
 

Returns:
The largest neuron ID currently in the network.

void Network::ResetSimTime   [static]
 

Reset the simulation time to 0.

void Network::Run AmTimeInt    maxRunTime
 

Run the simulation. The simulation will continue until either the event queues are completely empty or the network has run for maximum alloted time. If streaming input or MP mode is in use, the simulation will continue until maxRunTime has been reached even if the event queues are empty.

Parameters:
maxRunTime  Maximum time to run before returning in microseconds.

void Network::ScheduleNEvent NEvent    eventType,
AmTimeInt    eventTime,
AmIdInt    reqNrnId
 

Schedule an event using the Neuron's ID instead of a pointer to the Neuron.

Parameters:
eventType  The action that the neuron should carry out.
eventTime  Time that the event should be triggered.
reqNrnId  ID of neuron that will execute the event.

void Network::ScheduleNEvent NEvent    eventType,
AmTimeInt    eventTime,
Neuron   reqNrn
 

Schedule an event. Only SPIKE, and INPUTSPIKE are currently used for the eventType.

Parameters:
eventType  The action that the neuron should carry out.
eventTime  Time that the event should be triggered.
reqNrn  Pointer to the neuron that will execute the event.

void Network::ScheduleSpikeDelay vector< Synapse * > &    axon [protected]
 

Schedule the transmission of a spike down an axon. This may be done in order to implement spike batching or to model transmission delays. This is normally called from Neuron.

Parameters:
axon  The axon vector from a Neuron. A spike will be scheduled to cross each Synapse after the delay time has passed. Delay times are stored in Synapse and set when Neurons are connected together.
See also:
Neuron::SendSpike(), Network::ConnectNeurons().

void Network::SetSpikeInput SpikeInput   sIn
 

Specify a SpikeInput object for the Network to use. Network creates a SimpleSpikeInput object in the constructor, so there is no need to call this function unless a different SpikeInput class is needed. Network assumes ownership of the pointers and the existing SpikeInput object is destroyed when a new one is passed in.

Parameters:
sIn  Pointer to the SpikeInput object.

void Network::SetTimeStepSize AmTimeInt    stepSize [static]
 

Set the size of the simulation time steps. This must be set before Neurons are added.

Parameters:
stepSize  Time step size in microseconds. The defaults to 100 us.

void Network::SetTrainingMode bool    tMode
 

Toggle the training mode.

Parameters:
tMode  True if training should be enabled.

AmTimeInt Network::SimTime   [inline, static]
 

Returns:
The current simulation time in microseconds.

int Network::Size   [inline]
 

Returns:
Number of neurons in the network.

void Network::StreamingInput bool    streaming [inline]
 

Toggle the streaming input state.

Parameters:
streaming  A value of true turns on streaming input. Streaming input should be used if the input spike queue cannot be filled before calling Network::Run().

bool Network::StreamingInput   [inline]
 

Returns:
True if streaming input is in use.

AmTimeInt Network::TimeStepSize   [inline, static]
 

Returns:
The size of the time step in microseconds.


The documentation for this class was generated from the following file:
Generated on Wed Sep 4 02:30:36 2002 for Amygdala by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002