iCub-main
|
An generalized interface for a learning machine with a fixed domain and codomain size. More...
#include <IFixedSizeLearner.h>
Public Member Functions | |
IFixedSizeLearner (unsigned int dom=1, unsigned int cod=1) | |
Constructor. More... | |
virtual void | feedSample (const yarp::sig::Vector &input, const yarp::sig::Vector &output) |
Provide the learning machine with an example of the desired mapping. More... | |
virtual void | train () |
Train the learning machine on the examples that have been supplied so far. More... | |
unsigned int | getDomainSize () const |
Returns the size (dimensionality) of the input domain. More... | |
unsigned int | getCoDomainSize () const |
Returns the size (dimensionality) of the output domain (codomain). More... | |
virtual void | setDomainSize (unsigned int size) |
Mutator for the domain size. More... | |
virtual void | setCoDomainSize (unsigned int size) |
Mutator for the codomain size. More... | |
virtual std::string | getInfo () |
Asks the learning machine to return a string containing information on its operation so far. More... | |
virtual std::string | getConfigHelp () |
Asks the learning machine to return a string containing the list of configuration options that it supports. More... | |
virtual bool | configure (yarp::os::Searchable &config) |
Change parameters. More... | |
![]() | |
IMachineLearner () | |
Constructor. More... | |
virtual | ~IMachineLearner () |
Destructor (empty). More... | |
virtual bool | open (yarp::os::Searchable &config) |
Initialize the object. More... | |
virtual bool | close () |
Shut the object down. More... | |
virtual Prediction | predict (const yarp::sig::Vector &input)=0 |
Ask the learning machine to predict the output for a given input. More... | |
virtual IMachineLearner * | clone ()=0 |
Asks the learning machine to return a clone of its type. More... | |
virtual void | reset ()=0 |
Forget everything and start over. More... | |
bool | write (yarp::os::ConnectionWriter &connection) const |
bool | read (yarp::os::ConnectionReader &connection) |
virtual std::string | toString () |
Asks the learning machine to return a string serialization. More... | |
virtual bool | fromString (const std::string &str) |
Asks the learning machine to initialize from a string serialization. More... | |
std::string | getName () const |
Retrieve the name of this machine learning technique. More... | |
void | setName (const std::string &name) |
Set the name of this machine learning technique. More... | |
Protected Member Functions | |
virtual bool | checkDomainSize (const yarp::sig::Vector &input) |
Checks whether the input is of the desired dimensionality. More... | |
virtual bool | checkCoDomainSize (const yarp::sig::Vector &output) |
Checks whether the output is of the desired dimensionality. More... | |
void | validateDomainSizes (const yarp::sig::Vector &input, const yarp::sig::Vector &output) |
Validates whether the input and output are of the desired dimensionality. More... | |
virtual void | writeBottle (yarp::os::Bottle &bot) const |
Writes a serialization of the machine into a bottle. More... | |
virtual void | readBottle (yarp::os::Bottle &bot) |
Unserializes a machine from a bottle. More... | |
Protected Attributes | |
unsigned int | domainSize |
The dimensionality of the input domain. More... | |
unsigned int | coDomainSize |
The dimensionality of the output domain (codomain). More... | |
![]() | |
std::string | name |
The name of this type of machine learner. More... | |
An generalized interface for a learning machine with a fixed domain and codomain size.
Many machine learning techniques will fall in this category.
The learning machine can be used for regression and classification from R^M to R^N. M and N are here fixed sizes which should be respected by the samples that are fed into the system.
Definition at line 44 of file IFixedSizeLearner.h.
|
inline |
Constructor.
dom | the initial domain size |
cod | the initial codomain size |
Definition at line 98 of file IFixedSizeLearner.h.
|
protectedvirtual |
Checks whether the output is of the desired dimensionality.
output | a sample output |
Definition at line 55 of file IFixedSizeLearner.cpp.
|
protectedvirtual |
Checks whether the input is of the desired dimensionality.
input | a sample input |
Definition at line 51 of file IFixedSizeLearner.cpp.
|
virtual |
Change parameters.
Reimplemented from iCub::learningmachine::IMachineLearner.
Reimplemented in iCub::learningmachine::RLSLearner, iCub::learningmachine::LSSVMLearner, and iCub::learningmachine::LinearGPRLearner.
Definition at line 35 of file IFixedSizeLearner.cpp.
|
virtual |
Provide the learning machine with an example of the desired mapping.
input | a sample input |
output | the corresponding output |
Implements iCub::learningmachine::IMachineLearner.
Reimplemented in iCub::learningmachine::RLSLearner, iCub::learningmachine::LSSVMLearner, iCub::learningmachine::LinearGPRLearner, and iCub::learningmachine::DummyLearner.
Definition at line 28 of file IFixedSizeLearner.cpp.
|
inline |
Returns the size (dimensionality) of the output domain (codomain).
Definition at line 122 of file IFixedSizeLearner.h.
|
virtual |
Asks the learning machine to return a string containing the list of configuration options that it supports.
Reimplemented from iCub::learningmachine::IMachineLearner.
Reimplemented in iCub::learningmachine::RLSLearner, iCub::learningmachine::LSSVMLearner, and iCub::learningmachine::LinearGPRLearner.
Definition at line 86 of file IFixedSizeLearner.cpp.
|
inline |
Returns the size (dimensionality) of the input domain.
Definition at line 115 of file IFixedSizeLearner.h.
|
virtual |
Asks the learning machine to return a string containing information on its operation so far.
Reimplemented from iCub::learningmachine::IMachineLearner.
Reimplemented in iCub::learningmachine::RLSLearner, iCub::learningmachine::LSSVMLearner, iCub::learningmachine::LinearGPRLearner, and iCub::learningmachine::DummyLearner.
Definition at line 78 of file IFixedSizeLearner.cpp.
|
protectedvirtual |
Unserializes a machine from a bottle.
This method is internally referenced by the read method. Typically, subclasses should override this method instead of overriding the read method directly.
bot | the bottle |
Implements iCub::learningmachine::IMachineLearner.
Reimplemented in iCub::learningmachine::RLSLearner, iCub::learningmachine::LSSVMLearner, iCub::learningmachine::LinearGPRLearner, and iCub::learningmachine::DummyLearner.
Definition at line 73 of file IFixedSizeLearner.cpp.
|
inlinevirtual |
Mutator for the codomain size.
size | the desired codomain size |
Reimplemented in iCub::learningmachine::RLSLearner, iCub::learningmachine::LSSVMLearner, and iCub::learningmachine::LinearGPRLearner.
Definition at line 136 of file IFixedSizeLearner.h.
|
inlinevirtual |
Mutator for the domain size.
size | the desired domain size |
Reimplemented in iCub::learningmachine::RLSLearner, iCub::learningmachine::LSSVMLearner, and iCub::learningmachine::LinearGPRLearner.
Definition at line 129 of file IFixedSizeLearner.h.
|
virtual |
Train the learning machine on the examples that have been supplied so far.
This method is primarily intended to be used for offline/batch learning machines. It explicitly initiates the training routine on those machines for the samples that have been collected so far.
Reimplemented from iCub::learningmachine::IMachineLearner.
Reimplemented in iCub::learningmachine::RLSLearner, iCub::learningmachine::LSSVMLearner, iCub::learningmachine::LinearGPRLearner, and iCub::learningmachine::DummyLearner.
Definition at line 32 of file IFixedSizeLearner.cpp.
|
protected |
Validates whether the input and output are of the desired dimensionality.
An exception will be thrown if this is not the case.
input | a sample input |
output | the corresponding output |
Definition at line 59 of file IFixedSizeLearner.cpp.
|
protectedvirtual |
Writes a serialization of the machine into a bottle.
This method is internally referenced by the write method. Typically, subclasses should override this method instead of overriding the write method directly.
bot | the bottle containing the machine serialization |
Implements iCub::learningmachine::IMachineLearner.
Reimplemented in iCub::learningmachine::DummyLearner.
Definition at line 68 of file IFixedSizeLearner.cpp.
|
protected |
The dimensionality of the output domain (codomain).
Definition at line 54 of file IFixedSizeLearner.h.
|
protected |
The dimensionality of the input domain.
Definition at line 49 of file IFixedSizeLearner.h.