latest version v1.9 - last update 10 Apr 2010 |
This abstract class implements a standard neural network layer. More...
#include <ltiStdLayer.h>
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 () |
stdLayer & | copy (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 ivector & | getOutID () 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 dmatrix & | getWeights () |
void | setLearnRate (const double &theLR) |
void | setWeights (const dmatrix &weights) |
void | setIDs (const ivector &ids) |
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 |
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.
lti::stdLayer::stdLayer | ( | const std::string & | theName | ) |
default constructor
lti::stdLayer::stdLayer | ( | const stdLayer & | other | ) |
copy constructor
virtual lti::stdLayer::~stdLayer | ( | ) | [virtual] |
destructor
const ivector & lti::stdLayer::getOutID | ( | ) | const [inline] |
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)
virtual bool lti::stdLayer::loadBinary | ( | std::istream & | in | ) | [virtual] |
read the standard layer from the given stream (binary)
virtual bool lti::stdLayer::propagate | ( | const dvector & | input, | |
propagationFunctor & | prop, | |||
dvector & | output | |||
) | const [virtual] |
propagate the vector through the network
virtual bool lti::stdLayer::read | ( | ioHandler & | handler, | |
const bool | complete = true | |||
) | [virtual] |
virtual bool lti::stdLayer::save | ( | std::ostream & | out | ) | const [virtual] |
write the standard layer in the given stream (ascii)
virtual bool lti::stdLayer::saveBinary | ( | std::ostream & | out | ) | const [virtual] |
write the standard layer in the given stream (binary)
void lti::stdLayer::setLearnRate | ( | const double & | theLR | ) | [inline] |
set the learn rate
References learnRate.
void lti::stdLayer::setSize | ( | const int & | in, | |
const int & | out | |||
) |
virtual void lti::stdLayer::setStatusString | ( | const char * | msg | ) | const [virtual] |
set a status string.
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
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
Reimplemented in lti::rbf::layer1, and lti::rbf::layer2.
virtual bool lti::stdLayer::write | ( | ioHandler & | handler, | |
const bool | complete = true | |||
) | const [virtual] |
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().
ivector lti::stdLayer::outID [protected] |
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
dmatrix lti::stdLayer::weights [protected] |
weights matrix
Referenced by getWeights().