LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::stdLayer Class Reference

This abstract class implements a standard neural network layer. More...

#include <ltiStdLayer.h>

Inheritance diagram for lti::stdLayer:
Inheritance graph
[legend]
Collaboration diagram for lti::stdLayer:
Collaboration graph
[legend]

List of all members.

Classes

class  activationFunctor
 Parent class for all activation function functors. More...
class  distancePropFunctor
 Distance propagation functor. More...
class  dotPropFunctor
 Dot-Product propagation functor. More...
class  gaussActFunctor
 a gaussian activation function More...
class  initFunctor
 This class and all it's derived classes should initialize the network layer. More...
class  linearActFunctor
 a linear activation function More...
class  propagationFunctor
 Parent class for all propagation functors All propagation functors use a given activation function to calculate the output layer vector using a given input vector and a given weights matrix. More...
class  sigmoidActFunctor
 a sigmoid activation function More...
class  trainFunctor
 training functor More...

Public Member Functions

 stdLayer (const std::string &theName)
 stdLayer (const stdLayer &other)
virtual ~stdLayer ()
stdLayercopy (const stdLayer &other)
virtual void initWeights (initFunctor &initFunc)
virtual bool train (const dvector &input, const int &trainID, trainFunctor &trainFunc)
virtual bool train (const dvector &input, trainFunctor &trainFunc)
virtual bool propagate (const dvector &input, propagationFunctor &prop, dvector &output) const
const ivectorgetOutID () const
void setSize (const int &in, const int &out)
virtual bool write (ioHandler &handler, const bool complete=true) const
virtual bool read (ioHandler &handler, const bool complete=true)
virtual const char * getStatusString () const
virtual void setStatusString (const char *msg) const
const dmatrixgetWeights ()
void setLearnRate (const double &theLR)



void setWeights (const dmatrix &weights)
void setIDs (const ivector &ids)
deprecated methods

Deprecated methods



virtual bool save (std::ostream &out) const
virtual bool load (std::istream &in)
virtual bool saveBinary (std::ostream &out) const
virtual bool loadBinary (std::istream &in)

Protected Attributes

dmatrix weights
ivector outID
int sizeIn
int sizeOut
std::string layerName
double learnRate
char * statusString

Static Protected Attributes

static const char *const emptyString

Detailed Description

This abstract class implements a standard neural network layer.

This class contains the weights matrix, the vector with the output values, the class id for each output element, the dimensionality of the input vector and output layer (which must be consistent with the dimensions of the weights matrix and the output vector), the name of the layer (an ASCII string) and a learn rate value.

The enclosed classes are supponsed to modify this values. There are some initialization, activation, propagation and training functors.


Constructor & Destructor Documentation

lti::stdLayer::stdLayer ( const std::string &  theName  ) 

default constructor

lti::stdLayer::stdLayer ( const stdLayer other  ) 

copy constructor

virtual lti::stdLayer::~stdLayer (  )  [virtual]

destructor


Member Function Documentation

stdLayer& lti::stdLayer::copy ( const stdLayer other  ) 

copy member

const ivector & lti::stdLayer::getOutID (  )  const [inline]

get the output vector

get the class IDs for output vector elements

References outID.

virtual const char* lti::stdLayer::getStatusString (  )  const [virtual]

return the last message set with setStatusString().

This will never return 0. If no status-string has been set yet an empty string (pointer to a string with only the char(0)) will be returned.

const dmatrix & lti::stdLayer::getWeights (  )  [inline]

get the weights of the layer

References weights.

virtual void lti::stdLayer::initWeights ( initFunctor initFunc  )  [virtual]

initialize the weights

virtual bool lti::stdLayer::load ( std::istream &  in  )  [virtual]

read the standard layer from the given stream (ascii)

Deprecated:
Use read() instead
virtual bool lti::stdLayer::loadBinary ( std::istream &  in  )  [virtual]

read the standard layer from the given stream (binary)

Deprecated:
Use read() instead
virtual bool lti::stdLayer::propagate ( const dvector input,
propagationFunctor prop,
dvector output 
) const [virtual]

propagate the vector through the network

Returns:
false if an error occurred, otherwise true
virtual bool lti::stdLayer::read ( ioHandler handler,
const bool  complete = true 
) [virtual]

read the standard layer from the given ioHandler

Parameters:
handler the ioHandler to be used
complete if true (the default) the enclosing begin/end will be also written, otherwise only the data block will be written.
Returns:
true if write was successful
virtual bool lti::stdLayer::save ( std::ostream &  out  )  const [virtual]

write the standard layer in the given stream (ascii)

Deprecated:
Use write() instead
virtual bool lti::stdLayer::saveBinary ( std::ostream &  out  )  const [virtual]

write the standard layer in the given stream (binary)

Deprecated:
Use write() instead
void lti::stdLayer::setIDs ( const ivector ids  ) 

Set the IDs of the layer to the given vector.

void lti::stdLayer::setLearnRate ( const double &  theLR  )  [inline]

set the learn rate

References learnRate.

void lti::stdLayer::setSize ( const int &  in,
const int &  out 
)

set the size of the input and output vectors

Parameters:
in size of the input vector
out size of the output vector
virtual void lti::stdLayer::setStatusString ( const char *  msg  )  const [virtual]

set a status string.

Parameters:
msg the const string to be reported next time by getStatusString(). The given string will be copied This message will be usually set within the apply methods to indicate an error cause.

Note that the change of the status string is not considered as a change in the functor status.

void lti::stdLayer::setWeights ( const dmatrix weights  ) 

These methods should only be used by the Axiom Java interface.

Set the weights of the layer to the given matrix

virtual bool lti::stdLayer::train ( const dvector input,
trainFunctor trainFunc 
) [virtual]

train the network layer (unsupervised) with the given input vector

Returns:
false if an error occurred, otherwise true
virtual bool lti::stdLayer::train ( const dvector input,
const int &  trainID,
trainFunctor trainFunc 
) [virtual]

train the network layer (supervised) with the given input vector

Does one step of training, i.e. one feature vector 'input' of class 'trainID' is learned by the layer as specified in the trainFunctor

Returns:
false if an error occurred, otherwise true

Reimplemented in lti::rbf::layer1, and lti::rbf::layer2.

virtual bool lti::stdLayer::write ( ioHandler handler,
const bool  complete = true 
) const [virtual]

write the standard layer in the given ioHandler

Parameters:
handler the ioHandler to be used
complete if true (the default) the enclosing begin/end will be also written, otherwise only the data block will be written.
Returns:
true if write was successful

Member Data Documentation

const char* const lti::stdLayer::emptyString [static, protected]

the empty string returned if the statusString is empty

std::string lti::stdLayer::layerName [protected]

name of a layer

double lti::stdLayer::learnRate [protected]

learn rate

Referenced by setLearnRate().

output layer

Class ID of output node

Referenced by getOutID().

int lti::stdLayer::sizeIn [protected]

dimensionality of the input vector

int lti::stdLayer::sizeOut [protected]

dimensionality of the output vector

char* lti::stdLayer::statusString [mutable, protected]

the status string written with setStatusString

weights matrix

Referenced by getWeights().


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

Generated on Sat Apr 10 15:26:59 2010 for LTI-Lib by Doxygen 1.6.1