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

ANNetwork Class Reference

A generic and extensible neural network. More...

#include <annetwork.h>

Inheritance diagram for ANNetwork:

NeuronContainer Learner List of all members.

Public Methods

 ANNetwork (const char *description=NULL)
void makeUnits (const char *topology)
virtual void make (const char *top)
virtual void empty ()
virtual void copy (const ANNetwork &fnet, bool onlyWeights=false)
void connectFfw (const PackTable< int > &conns)
void connectFullFfw (bool shortcuts)
void connectFull ()
void setUnitPrototype (Neuron *t)
virtual void copyFreeNet (const ANNetwork &orig, bool onlyWeights=false)
virtual void init (double r=0.0)
void reset ()
virtual void update ()
virtual Vector testPattern (const PatternSource &set, int pattern) const
const ANNTopologygetTopology () const
void setInitializer (NeuronInitializer *initer)
EqualizergetEqualizer ()
const EqualizergetEqualizer () const
void setEqualizer (Equalizer *eq=NULL)
Connectionconnect (int i, int j)
virtual OStream & operator>> (OStream &out) const
void cleanup (bool removeDisableds=false, bool removePassthroughs=false)
String drawEPS (double xsize=-1, double ysize=-1) const
void drawFeedForward ()
void check () const

Protected Attributes

ANNTopologymTopology
NeuronmUnitTemplate
NeuronInitializermInitializer
EqualizermpEqualizer

Detailed Description

A generic and extensible neural network.

Definition at line 109 of file annetwork.h.


Constructor & Destructor Documentation

ANNetwork const char *    desc = NULL
 

Constructs a neural network with a topology described by the description string.

See ANNetwork::makeUnits() for more information about the format of the description string.

Definition at line 103 of file annetwork.cc.

References makeUnits(), mInitializer, mpEqualizer, mTopology, and mUnitTemplate.


Member Function Documentation

void check  
 

Implementation for Object.

Definition at line 557 of file annetwork.cc.

References Neuron::check(), NeuronContainer::mUnits, and mUnitTemplate.

void cleanup bool    removeDisableds = false,
bool    removePassthroughs = false
 

Removes unnecessary connections and disables lonely units.

Parameters:
removeDisableds  Should disabled units be purged? Default: false (not purged).
removePassthroughs  Remove units that have only one input and one output connection. Default: false (not purged).

Definition at line 365 of file annetwork.cc.

References ANNLayering::getPos(), NeuronContainer::mUnits, ANNLayering::removeLayer(), and NeuronContainer::removeUnit().

Connection * connect int    i,
int    j
 

Creates a connection from neuron i to neuron j.

Definition at line 228 of file annetwork.cc.

References NeuronContainer::mUnits.

Referenced by connectFfw(), connectFull(), and connectFullFfw().

void connectFfw const PackTable< int > &    conns
 

Builds the network from connection matrix, restricting the topology to only feedforward connections.

Definition at line 139 of file annetwork.cc.

References connect(), ANNLayering::getPos(), ANNLayering::layerIndex(), and NeuronContainer::mUnits.

void connectFull  
 

Connects all units to all units, including self.

Definition at line 185 of file annetwork.cc.

References connect(), and NeuronContainer::mUnits.

void connectFullFfw bool    shortcuts
 

Connects all units in subsequent layers to form feedforward topology.

Definition at line 162 of file annetwork.cc.

References connect(), ANNLayering::layerIndex(), ANNLayering::layers(), and mTopology.

Referenced by AbsoluteNeuralPrediction::train().

void copy const ANNetwork &    fnet,
bool    onlyWeights = false
[virtual]
 

Implementation for LearningMapping.

Definition at line 121 of file annetwork.cc.

References Learner::copy(), and copyFreeNet().

void copyFreeNet const ANNetwork &    orig,
bool    onlyWeights = false
[virtual]
 

Implementation for AnyNetwork.

Copies the other FreeNet unto self.

Reimplemented from Learner.

Definition at line 193 of file annetwork.cc.

References Neuron::clone(), mTopology, NeuronContainer::mUnits, and mUnitTemplate.

Referenced by copy().

String drawEPS double    xsize = -1,
double    ysize = -1
const
 

Draws a picture of the network in EPS (Encapsulated PostScript).

If no size is given, the image is drawn using default scaling.

Returns:
Picture as EPS code.

Definition at line 299 of file annetwork.cc.

References BiNode::id(), BiNode::incoming(), BiNode::incomings(), Neuron::isEnabled(), ANNLayering::layers(), NeuronContainer::mUnits, Connection::source(), and Neuron::transferFunc().

void drawFeedForward  
 

Order the coordinates of the Neuron neurons (which do have coordinates) in the network in a pretty way in two-dimensional space.

Definition at line 468 of file annetwork.cc.

References ANNLayering::layerIndex(), ANNLayering::layers(), ANNLayering::make(), and NeuronContainer::mUnits.

void empty   [virtual]
 

Deletes all the neurons in the network.

Definition at line 133 of file annetwork.cc.

References ANNTopology::empty(), and mTopology.

const Equalizer* getEqualizer   const [inline]
 

Returns pointer (or NULL) to the equalization handler for the network.

Const version.

Definition at line 196 of file annetwork.h.

References mpEqualizer.

Equalizer* getEqualizer   [inline]
 

Returns pointer (or NULL) to the equalization handler for the network.

Non-const version.

Definition at line 191 of file annetwork.h.

References mpEqualizer.

Referenced by AbsoluteNeuralPrediction::predict(), and AbsoluteNeuralPrediction::train().

const ANNTopology& getTopology   const [inline]
 

Returns current layering.

Definition at line 180 of file annetwork.h.

References mTopology.

void init double    r = 0.0 [virtual]
 

Implementation for AnyNetwork.

Initializes the weights and biases randomly according to the range, or if an initializer has been given, using that.

Implements Learner.

Definition at line 206 of file annetwork.cc.

References NeuronInitializer::initialize(), mInitializer, and NeuronContainer::mUnits.

Referenced by Trainer::initTrain(), and AbsoluteNeuralPrediction::train().

virtual void make const char *    top [inline, virtual]
 

Implementation for LearningMapping.

See also:
makeUnits

Implements Learner.

Definition at line 129 of file annetwork.h.

References makeUnits().

Referenced by AbsoluteNeuralPrediction::train().

void makeUnits const char *    topology
 

Builds a non-connected network according to the given layer topology (for example: "7-4-2" or "8").

See ANNLayering for some more information about the description strings.

Definition at line 127 of file annetwork.cc.

References ANNTopology::build(), and mTopology.

Referenced by ANNetwork(), and make().

OStream & operator>> OStream &    out const [virtual]
 

Implementation for Object.

Prints out a formatted printout of the network.

Definition at line 270 of file annetwork.cc.

References NeuronContainer::mUnits.

void reset  
 

Resets activations to 0.0.

Definition at line 239 of file annetwork.cc.

References NeuronContainer::mUnits.

void setEqualizer Equalizer   eq = NULL
 

Sets equalization handler for the network.

Gives ownership.

Definition at line 222 of file annetwork.cc.

References mpEqualizer.

Referenced by AbsoluteNeuralPrediction::train().

void setInitializer NeuronInitializer   initer
 

Sets the given initializer.

NOTE: Takes the ownership of the initializer.

Definition at line 216 of file annetwork.cc.

References mInitializer.

void setUnitPrototype Neuron   t [inline]
 

Sets the unit template.

The object t must be an instance of an inheritor of Neuron.

NOTE: The template is destructed along with the ANNetwork, so do not destroy it yourself.

Definition at line 157 of file annetwork.h.

References mUnitTemplate.

Vector testPattern const PatternSource   set,
int    pattern
const [virtual]
 

Implementation for LearningMapping.

Reimplemented from Learner.

Definition at line 250 of file annetwork.cc.

References PatternSource::input(), PatternSource::inputs, and PatternSource::outputs.

Referenced by AbsoluteNeuralPrediction::predict().

void update   [virtual]
 

Transfers signals once for all units.

Definition at line 244 of file annetwork.cc.

References NeuronContainer::mUnits.

Referenced by BackpropTrainer::trainPattern().


Member Data Documentation

NeuronInitializer* mInitializer [protected]
 

Neuron initializer method.

Definition at line 247 of file annetwork.h.

Referenced by ANNetwork(), init(), and setInitializer().

Equalizer* mpEqualizer [protected]
 

Equalization object.

Definition at line 250 of file annetwork.h.

Referenced by ANNetwork(), getEqualizer(), and setEqualizer().

ANNTopology* mTopology [protected]
 

Layering information.

Definition at line 241 of file annetwork.h.

Referenced by ANNetwork(), connectFullFfw(), copyFreeNet(), empty(), getTopology(), and makeUnits().

Neuron* mUnitTemplate [protected]
 

Neuron template.

Definition at line 244 of file annetwork.h.

Referenced by ANNetwork(), check(), copyFreeNet(), and setUnitPrototype().


The documentation for this class was generated from the following files:
Generated on Thu Feb 10 20:06:45 2005 for Inanna by doxygen1.2.18