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

TwoLayerNetwork Class Reference

Two layered networks are very commonly used. More...

#include <TwoLayerNetwork.h>

Inheritance diagram for TwoLayerNetwork:

Inheritance graph
[legend]
Collaboration diagram for TwoLayerNetwork:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TwoLayerNetwork (uint inputs, uint hidden, uint outputs)
 Creates a two layer network.

 TwoLayerNetwork (const char *filename)
 Loads a two-layer network from a file.

virtual void connect2in (int input, int hidden)
 Connects an input and a hidden neuron with a random weight.

virtual void connect2in (int input, int hidden, real weight)
 Connects an input and a hidden neuron with the given weight.

virtual void connect2out (int hidden, int output)
 Connects a hidden and an output neuron with a random weight.

virtual void connect2out (int hidden, int output, real weight)
 Connects a hidden and an output neuron with the given weight.

virtual void connectAll ()
 Completely connects the network.

virtual void addLayer (int size)
 Overrides MultiLayerNetwork::addLayer() so that it cannot be done.

virtual const char * getClassName ()
 Returns "TwoLayerNetwork".


Detailed Description

Two layered networks are very commonly used.

This is basically a multi-layer perceptron network with only two layers - one hidden and one output (the input is not counted as a layer). This class basically derives from a MultiLayerNetwork and adds functionality that make it easier to use if the network you're dealing with has only 2 layers. There is nothing you can do with this class that you can't do with MultiLayerNetwork, just that this may be easier to use.


Constructor & Destructor Documentation

TwoLayerNetwork uint  inputs,
uint  hidden,
uint  outputs
 

Creates a two layer network.

Parameters:
inputs The number of inputs taken in by the network
hidden The number of hidden neurons in the network
outputs The size of the output vector (number of outputs given by the network)

TwoLayerNetwork const char *  filename  ) 
 

Loads a two-layer network from a file.

The file is exactly the same as a MultiLayerNetwork file, and can be loaded there as well.

Exceptions:
Exception if the file read does not correspond to a two layer network


Member Function Documentation

virtual void addLayer int  size  )  [virtual]
 

Overrides MultiLayerNetwork::addLayer() so that it cannot be done.

Exceptions:
Exception Because the number of layers of this class is fixed, so you shouldn't be allowed to add a layer

Reimplemented from MultiLayerNetwork.

virtual void connect2in int  input,
int  hidden,
real  weight
[virtual]
 

Connects an input and a hidden neuron with the given weight.

Parameters:
input The index of the input neuron
hidden The index of the hidden neuron in the hidden layer
weight The weight of the connection

virtual void connect2in int  input,
int  hidden
[virtual]
 

Connects an input and a hidden neuron with a random weight.

Parameters:
input The index of the input neuron
hidden The index of the hidden neuron in the hidden layer

virtual void connect2out int  hidden,
int  output,
real  weight
[virtual]
 

Connects a hidden and an output neuron with the given weight.

Parameters:
hidden The index of the hidden neuron in the hidden layer
output The index of the output neuron in the output layer
weight The weight of the connection

virtual void connect2out int  hidden,
int  output
[virtual]
 

Connects a hidden and an output neuron with a random weight.

Parameters:
hidden The index of the hidden neuron in the hidden layer
output The index of the output neuron in the output layer

virtual void connectAll  )  [virtual]
 

Completely connects the network.

All inputs are connected to all hidden neurons and all hidden neurons to all output neurons

virtual const char* getClassName  )  [virtual]
 

Returns "TwoLayerNetwork".


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