iCub-main
|
Feed-Forward 2 layers Neural Network. More...
#include <neuralNetworks.h>
Classes | |
struct | minmax |
Public Member Functions | |
ff2LayNN () | |
Create an empty network. More... | |
ff2LayNN (const yarp::os::Property &options) | |
Create and configure the network. More... | |
virtual bool | configure (const yarp::os::Property &options) |
Configure/reconfigure the network. More... | |
virtual bool | isValid () const |
Return the internal status after a configuration. More... | |
virtual yarp::sig::Vector | predict (const yarp::sig::Vector &x) const |
Predict the output given a certain input to the network. More... | |
virtual bool | getStructure (yarp::os::Property &options) const |
Retrieve the network structure as a Property object. More... | |
virtual bool | printStructure (std::ostream &stream=std::cout) const |
Dump tadily the network structure on the stream. More... | |
std::deque< yarp::sig::Vector > & | get_IW () |
Retrieve first layer weights. More... | |
std::deque< yarp::sig::Vector > & | get_LW () |
Retrieve second layer weights. More... | |
yarp::sig::Vector & | get_b1 () |
Retrieve first layer bias. More... | |
yarp::sig::Vector & | get_b2 () |
Retrieve second layer bias. More... | |
virtual yarp::sig::Vector | scaleInputToNetFormat (const yarp::sig::Vector &x) const |
Scale input to be used with the network. More... | |
virtual yarp::sig::Vector | scaleInputFromNetFormat (const yarp::sig::Vector &x) const |
Scale back input from the network's format. More... | |
virtual yarp::sig::Vector | scaleOutputToNetFormat (const yarp::sig::Vector &x) const |
Scale output to be used with the network. More... | |
virtual yarp::sig::Vector | scaleOutputFromNetFormat (const yarp::sig::Vector &x) const |
Scale back output from the network's format. More... | |
virtual yarp::sig::Vector | hiddenLayerFcn (const yarp::sig::Vector &x) const =0 |
Hidden Layer Function. More... | |
virtual yarp::sig::Vector | outputLayerFcn (const yarp::sig::Vector &x) const =0 |
Output Layer Function. More... | |
virtual yarp::sig::Vector | hiddenLayerGrad (const yarp::sig::Vector &x) const =0 |
Gradient of the Hidden Layer Function. More... | |
virtual yarp::sig::Vector | outputLayerGrad (const yarp::sig::Vector &x) const =0 |
Gradient of the Output Layer Function. More... | |
Protected Member Functions | |
void | prepare () |
void | setItem (yarp::os::Property &options, const std::string &tag, const yarp::sig::Vector &item) const |
bool | getItem (const yarp::os::Property &options, const std::string &tag, yarp::sig::Vector &item) const |
Protected Attributes | |
std::deque< yarp::sig::Vector > | IW |
yarp::sig::Vector | b1 |
std::deque< yarp::sig::Vector > | LW |
yarp::sig::Vector | b2 |
std::deque< minmax > | inMinMaxX |
std::deque< minmax > | inMinMaxY |
std::deque< minmax > | outMinMaxX |
std::deque< minmax > | outMinMaxY |
yarp::sig::Vector | inMinX |
yarp::sig::Vector | inMinY |
yarp::sig::Vector | inRatio |
yarp::sig::Vector | outMinX |
yarp::sig::Vector | outMinY |
yarp::sig::Vector | outRatio |
bool | configured |
Feed-Forward 2 layers Neural Network.
Useful to implement the networks trained via MATLAB (e.g. through nftool).
Definition at line 47 of file neuralNetworks.h.
ff2LayNN::ff2LayNN | ( | ) |
Create an empty network.
Definition at line 26 of file neuralNetworks.cpp.
iCub::ctrl::ff2LayNN::ff2LayNN | ( | const yarp::os::Property & | options | ) |
Create and configure the network.
options | contains the parameters to configure the network. |
|
virtual |
Configure/reconfigure the network.
options | contains the parameters to configure the network according to the convention derived from MATLAB. |
numInputNodes <int> : input dimension.
numHiddenNodes <int> : number of nodes of the first layer (hidden).
numOutputNodes <int> : number of nodes of the second layer (output).
IW_<j> (<double> <double> ...) : jth weights vector of the hidden layer.
LW_<j> (<double> <double> ...) : jth weights vector of the output layer.
b1 (<double> <double> ...) : bias vector of the hidden layer.
b2 (<double> <double> ...) : bias vector of the output layer.
inMinMaxX_<j> (<min> <max>) : range of the jth input element.
inMinMaxY_<j> (<min> <max>) : range where to map the jth input element.
outMinMaxY_<j> (<min> <max>) : range of the jth output element.
outMinMaxX_<j> (<min> <max>) : range where to remap back the jth output element.
Definition at line 101 of file neuralNetworks.cpp.
|
inline |
Retrieve first layer bias.
Definition at line 189 of file neuralNetworks.h.
|
inline |
Retrieve second layer bias.
Definition at line 195 of file neuralNetworks.h.
|
inline |
Retrieve first layer weights.
Definition at line 177 of file neuralNetworks.h.
|
inline |
Retrieve second layer weights.
Definition at line 183 of file neuralNetworks.h.
|
protected |
Definition at line 58 of file neuralNetworks.cpp.
|
virtual |
Retrieve the network structure as a Property object.
options | is the output stream. |
Definition at line 260 of file neuralNetworks.cpp.
|
pure virtual |
Hidden Layer Function.
x | is the input vector. |
Implemented in iCub::ctrl::ff2LayNN_tansig_purelin.
|
pure virtual |
Gradient of the Hidden Layer Function.
x | is the input vector. |
Implemented in iCub::ctrl::ff2LayNN_tansig_purelin.
|
virtual |
Return the internal status after a configuration.
Definition at line 40 of file neuralNetworks.cpp.
|
pure virtual |
Output Layer Function.
x | is the input vector. |
Implemented in iCub::ctrl::ff2LayNN_tansig_purelin.
|
pure virtual |
Gradient of the Output Layer Function.
x | is the input vector. |
Implemented in iCub::ctrl::ff2LayNN_tansig_purelin.
|
virtual |
Predict the output given a certain input to the network.
x | is the actual input to the network. |
Definition at line 232 of file neuralNetworks.cpp.
|
protected |
Definition at line 74 of file neuralNetworks.cpp.
|
virtual |
Dump tadily the network structure on the stream.
stream | is the output stream. |
Definition at line 329 of file neuralNetworks.cpp.
|
virtual |
Scale back input from the network's format.
x | is the input vector. |
Definition at line 211 of file neuralNetworks.cpp.
|
virtual |
Scale input to be used with the network.
x | is the input vector. |
Definition at line 204 of file neuralNetworks.cpp.
|
virtual |
Scale back output from the network's format.
x | is the input vector. |
Definition at line 225 of file neuralNetworks.cpp.
|
virtual |
Scale output to be used with the network.
x | is the input vector. |
Definition at line 218 of file neuralNetworks.cpp.
|
protected |
Definition at line 47 of file neuralNetworks.cpp.
|
protected |
Definition at line 58 of file neuralNetworks.h.
|
protected |
Definition at line 62 of file neuralNetworks.h.
|
protected |
Definition at line 80 of file neuralNetworks.h.
|
protected |
Definition at line 65 of file neuralNetworks.h.
|
protected |
Definition at line 66 of file neuralNetworks.h.
|
protected |
Definition at line 72 of file neuralNetworks.h.
|
protected |
Definition at line 73 of file neuralNetworks.h.
|
protected |
Definition at line 74 of file neuralNetworks.h.
|
protected |
Definition at line 57 of file neuralNetworks.h.
|
protected |
Definition at line 61 of file neuralNetworks.h.
|
protected |
Definition at line 69 of file neuralNetworks.h.
|
protected |
Definition at line 70 of file neuralNetworks.h.
|
protected |
Definition at line 76 of file neuralNetworks.h.
|
protected |
Definition at line 77 of file neuralNetworks.h.
|
protected |
Definition at line 78 of file neuralNetworks.h.