A Feed Forward Network. More...
#include <Gist/FFN.H>
Constructors, assignment, and Destructors | |
| |
FeedForwardNetwork () | |
Constructor. | |
~FeedForwardNetwork () | |
Destructor. | |
void | init (std::string wh_file, std::string wo_file, int inunits, int hidunits, int outunits, double lrate, double mrate) |
void | init (int inunits, int hidunits, int outunits, double lrate, double mrate) |
void | init (Image< double > wh, Image< double > wo, double lrate, double mrate) |
Initialize a two-weight-layer network with Image<double> weights. | |
void | init3L (std::string wh1_file, std::string wh2_file, std::string wo_file, int inunits, int hid1units, int hid2units, int outunits, double lrate, double mrate) |
void | init3L (int inunits, int hid1units, int hid2units, int outunits, double lrate, double mrate) |
void | init3L (Image< double > wh, Image< double > wh2, Image< double > wo, double lrate, double mrate) |
Initialize a three-weight-layer network with Image<double> weights. | |
Image< double > | run (Image< double > input) |
Run a two-weight-layer network with passed in input. | |
Image< double > | run3L (Image< double > input) |
Run a three-weight-layer network with passed in input. | |
void | backprop (Image< double > target) |
void | backprop3L (Image< double > target) |
void | write (std::string wh_file, std::string wo_file) |
Write the two-weight-layer network weights to a specified file. | |
void | write3L (std::string wh1_file, std::string wh2_file, std::string wo_file) |
Write the three-weight-layer network weights to a specified file. | |
void | setLearningRate (double newLR) |
Set Learning rate - for simulated annealing. | |
Image< double > | getOutput () |
get the most recent output |
A Feed Forward Network.
Definition at line 54 of file FFN.H.
FeedForwardNetwork::FeedForwardNetwork | ( | ) |
Constructor.
This implements a simple feedforward network with backpropagation. Supports 2 or 3-weight-layer networks through separate function calls NOTE: please allow the class to create the initial weight files (use the init function that does not ask for weight files). Also user should add an extra input for bias (set it to 1.0)
void FeedForwardNetwork::backprop | ( | Image< double > | target | ) |
backpropagate the error in the two-weight-layer network with passed in target output (note: call run first)
Definition at line 468 of file FFN.C.
References Image< T >::getDims(), Image< T >::getSize(), matrixMult(), transpose(), and ZEROS.
void FeedForwardNetwork::backprop3L | ( | Image< double > | target | ) |
backpropagate the error in the three-weight-layer network with passed in target output (note: call run3L first)
Definition at line 498 of file FFN.C.
References Image< T >::getDims(), Image< T >::getSize(), matrixMult(), transpose(), and ZEROS.
Image< double > FeedForwardNetwork::getOutput | ( | ) | [inline] |
void FeedForwardNetwork::init | ( | Image< double > | wh, | |
Image< double > | wo, | |||
double | lrate, | |||
double | mrate | |||
) |
Initialize a two-weight-layer network with Image<double> weights.
Definition at line 178 of file FFN.C.
References ASSERT, Image< T >::getHeight(), Image< T >::getWidth(), Image< T >::resize(), and Image< T >::setVal().
void FeedForwardNetwork::init | ( | int | inunits, | |
int | hidunits, | |||
int | outunits, | |||
double | lrate, | |||
double | mrate | |||
) |
void FeedForwardNetwork::init | ( | std::string | wh_file, | |
std::string | wo_file, | |||
int | inunits, | |||
int | hidunits, | |||
int | outunits, | |||
double | lrate, | |||
double | mrate | |||
) |
Initialize a two-weight-layer network with saved weights momentum is unimplemented
Definition at line 90 of file FFN.C.
References Image< T >::beginw(), NO_INIT, Image< T >::resize(), Image< T >::setVal(), and transpose().
void FeedForwardNetwork::init3L | ( | Image< double > | wh, | |
Image< double > | wh2, | |||
Image< double > | wo, | |||
double | lrate, | |||
double | mrate | |||
) |
Initialize a three-weight-layer network with Image<double> weights.
Definition at line 354 of file FFN.C.
References ASSERT, Image< T >::getHeight(), and Image< T >::getWidth().
void FeedForwardNetwork::init3L | ( | int | inunits, | |
int | hid1units, | |||
int | hid2units, | |||
int | outunits, | |||
double | lrate, | |||
double | mrate | |||
) |
void FeedForwardNetwork::init3L | ( | std::string | wh1_file, | |
std::string | wh2_file, | |||
std::string | wo_file, | |||
int | inunits, | |||
int | hid1units, | |||
int | hid2units, | |||
int | outunits, | |||
double | lrate, | |||
double | mrate | |||
) |
Initialize a three-weight-layer network with saved weights momentum is unimplemented
Definition at line 241 of file FFN.C.
References Image< T >::beginw(), NO_INIT, and transpose().
Run a two-weight-layer network with passed in input.
Definition at line 411 of file FFN.C.
References Image< T >::beginw(), Image< T >::endw(), and matrixMult().
Run a three-weight-layer network with passed in input.
Definition at line 436 of file FFN.C.
References Image< T >::beginw(), Image< T >::endw(), and matrixMult().
void FeedForwardNetwork::setLearningRate | ( | double | newLR | ) |
void FeedForwardNetwork::write | ( | std::string | wh_file, | |
std::string | wo_file | |||
) |
Write the two-weight-layer network weights to a specified file.
Definition at line 543 of file FFN.C.
References Image< T >::beginw(), Image< T >::endw(), and transpose().
void FeedForwardNetwork::write3L | ( | std::string | wh1_file, | |
std::string | wh2_file, | |||
std::string | wo_file | |||
) |
Write the three-weight-layer network weights to a specified file.
Definition at line 572 of file FFN.C.
References Image< T >::beginw(), Image< T >::endw(), and transpose().