iCub-main
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
iCub::optimization::ff2LayNNTrain Class Reference

Class to deal with training of Feed-Forward 2 layers Neural Network using IpOpt. More...

#include <neuralNetworks.h>

+ Inheritance diagram for iCub::optimization::ff2LayNNTrain:

Public Member Functions

 ff2LayNNTrain ()
 Default constructor.
 
void setBounds (const yarp::os::Property &bounds)
 Allow specifying the bounds for training network's parameters.
 
virtual bool train (const unsigned int numHiddenNodes, const std::deque< yarp::sig::Vector > &in, const std::deque< yarp::sig::Vector > &out, std::deque< yarp::sig::Vector > &pred, double &error)
 Train the network through optimization.
 
virtual bool retrain (const std::deque< yarp::sig::Vector > &in, const std::deque< yarp::sig::Vector > &out, std::deque< yarp::sig::Vector > &pred, double &error)
 Retrain the network through optimization.
 
virtual ~ff2LayNNTrain ()
 Default destructor.
 
- Public Member Functions inherited from iCub::ctrl::ff2LayNN
 ff2LayNN ()
 Create an empty network.
 
 ff2LayNN (const yarp::os::Property &options)
 Create and configure the network.
 
virtual bool configure (const yarp::os::Property &options)
 Configure/reconfigure the network.
 
virtual bool isValid () const
 Return the internal status after a configuration.
 
virtual yarp::sig::Vector predict (const yarp::sig::Vector &x) const
 Predict the output given a certain input to the network.
 
virtual bool getStructure (yarp::os::Property &options) const
 Retrieve the network structure as a Property object.
 
virtual bool printStructure (std::ostream &stream=std::cout) const
 Dump tadily the network structure on the stream.
 
std::deque< yarp::sig::Vector > & get_IW ()
 Retrieve first layer weights.
 
std::deque< yarp::sig::Vector > & get_LW ()
 Retrieve second layer weights.
 
yarp::sig::Vector & get_b1 ()
 Retrieve first layer bias.
 
yarp::sig::Vector & get_b2 ()
 Retrieve second layer bias.
 
virtual yarp::sig::Vector scaleInputToNetFormat (const yarp::sig::Vector &x) const
 Scale input to be used with the network.
 
virtual yarp::sig::Vector scaleInputFromNetFormat (const yarp::sig::Vector &x) const
 Scale back input from the network's format.
 
virtual yarp::sig::Vector scaleOutputToNetFormat (const yarp::sig::Vector &x) const
 Scale output to be used with the network.
 
virtual yarp::sig::Vector scaleOutputFromNetFormat (const yarp::sig::Vector &x) const
 Scale back output from the network's format.
 
virtual yarp::sig::Vector hiddenLayerFcn (const yarp::sig::Vector &x) const =0
 Hidden Layer Function.
 
virtual yarp::sig::Vector outputLayerFcn (const yarp::sig::Vector &x) const =0
 Output Layer Function.
 
virtual yarp::sig::Vector hiddenLayerGrad (const yarp::sig::Vector &x) const =0
 Gradient of the Hidden Layer Function.
 
virtual yarp::sig::Vector outputLayerGrad (const yarp::sig::Vector &x) const =0
 Gradient of the Output Layer Function.
 

Protected Attributes

yarp::os::Property bounds
 
void * App
 
- Protected Attributes inherited from iCub::ctrl::ff2LayNN
std::deque< yarp::sig::Vector > IW
 
yarp::sig::Vector b1
 
std::deque< yarp::sig::Vector > LW
 
yarp::sig::Vector b2
 
std::deque< minmaxinMinMaxX
 
std::deque< minmaxinMinMaxY
 
std::deque< minmaxoutMinMaxX
 
std::deque< minmaxoutMinMaxY
 
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
 

Additional Inherited Members

- Protected Member Functions inherited from iCub::ctrl::ff2LayNN
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
 

Detailed Description

Class to deal with training of Feed-Forward 2 layers Neural Network using IpOpt.

Definition at line 53 of file neuralNetworks.h.

Constructor & Destructor Documentation

◆ ff2LayNNTrain()

ff2LayNNTrain::ff2LayNNTrain ( )

Default constructor.

Definition at line 294 of file neuralNetworks.cpp.

◆ ~ff2LayNNTrain()

ff2LayNNTrain::~ff2LayNNTrain ( )
virtual

Default destructor.

Definition at line 418 of file neuralNetworks.cpp.

Member Function Documentation

◆ retrain()

bool ff2LayNNTrain::retrain ( const std::deque< yarp::sig::Vector > &  in,
const std::deque< yarp::sig::Vector > &  out,
std::deque< yarp::sig::Vector > &  pred,
double &  error 
)
virtual

Retrain the network through optimization.

Parameters
numHiddenNodesis the number of hidden nodes.
inthe list of input vector.
outthe list of output vector.
predthe returned list of predicted output.
errorreturns the prediction error.
Returns
true/false on success/fail.

Definition at line 403 of file neuralNetworks.cpp.

◆ setBounds()

void ff2LayNNTrain::setBounds ( const yarp::os::Property &  bounds)

Allow specifying the bounds for training network's parameters.

Parameters
boundsa property-like object containing bounds in the form: ("tag" (<min> <max>)), where tag is a string referring to network parameters: e.g. IW, LW, b1, b2 ...

Definition at line 311 of file neuralNetworks.cpp.

◆ train()

bool ff2LayNNTrain::train ( const unsigned int  numHiddenNodes,
const std::deque< yarp::sig::Vector > &  in,
const std::deque< yarp::sig::Vector > &  out,
std::deque< yarp::sig::Vector > &  pred,
double &  error 
)
virtual

Train the network through optimization.

Parameters
numHiddenNodesis the number of hidden nodes.
inthe list of input vector.
outthe list of output vector.
predthe returned list of predicted output.
errorreturns the prediction error.
Returns
true/false on success/fail.

Definition at line 318 of file neuralNetworks.cpp.

Member Data Documentation

◆ App

void* iCub::optimization::ff2LayNNTrain::App
protected

Definition at line 57 of file neuralNetworks.h.

◆ bounds

yarp::os::Property iCub::optimization::ff2LayNNTrain::bounds
protected

Definition at line 56 of file neuralNetworks.h.


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