describes structure of a 3 layer back prop neural net More...
#include <BPnnet/BPnnet.H>
Public Member Functions | |
BPnnet (const int numInput, const int numHidden, const KnowledgeBase *kb) | |
Constructor. | |
~BPnnet () | |
Destructor. | |
void | randomizeWeights () |
Initialize all weights to (small) random values. | |
void | normalizeWeights () |
Normalize weights. | |
double | train (const Image< float > &in, const SimpleVisualObject &target, const double learnRate) |
Do one training iteration. | |
bool | recognize (const Image< float > &in, SimpleVisualObject &vo) |
Attempt to recognize given jet as a certain visual object. | |
bool | save (const char *filename) const |
Store 2 matrices of weights to the file "filename". | |
bool | load (const char *filename) |
Assign all weights based on data stored in the file "filename". |
describes structure of a 3 layer back prop neural net
Definition at line 48 of file BPnnet.H.
BPnnet::BPnnet | ( | const int | numInput, | |
const int | numHidden, | |||
const KnowledgeBase * | kb | |||
) |
Constructor.
Definition at line 50 of file BPnnet.C.
References KnowledgeBase::getSize(), and Image< T >::resize().
BPnnet::~BPnnet | ( | ) |
bool BPnnet::load | ( | const char * | filename | ) |
Assign all weights based on data stored in the file "filename".
returns false if the # of units in each layer do not match the matrix sizes in the file
Definition at line 252 of file BPnnet.C.
References Image< T >::getArrayPtr(), and Image< T >::getSize().
void BPnnet::normalizeWeights | ( | void | ) |
Normalize weights.
Definition at line 98 of file BPnnet.C.
References getMinMax(), and inplaceClamp().
Referenced by randomizeWeights().
void BPnnet::randomizeWeights | ( | void | ) |
Initialize all weights to (small) random values.
Definition at line 84 of file BPnnet.C.
References normalizeWeights(), randomDouble(), and Image< T >::setVal().
bool BPnnet::recognize | ( | const Image< float > & | in, | |
SimpleVisualObject & | vo | |||
) |
Attempt to recognize given jet as a certain visual object.
Definition at line 196 of file BPnnet.C.
References SimpleVisualObject::getName(), KnowledgeBase::getSimpleVisualObject(), and max().
bool BPnnet::save | ( | const char * | filename | ) | const |
Store 2 matrices of weights to the file "filename".
use this after training a net
Definition at line 232 of file BPnnet.C.
References Image< T >::getArrayPtr(), and Image< T >::getSize().
double BPnnet::train | ( | const Image< float > & | in, | |
const SimpleVisualObject & | target, | |||
const double | learnRate | |||
) |
Do one training iteration.
returns rms1 = sum of (target output - actual output)^2/n_outputs for all output layer neurons
Definition at line 111 of file BPnnet.C.
References KnowledgeBase::findSimpleVisualObjectIndex(), SimpleVisualObject::getName(), Image< T >::getVal(), and Image< T >::setVal().