iCub-main
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
iCub::learningmachine::IFixedSizeLearner Class Reference

An generalized interface for a learning machine with a fixed domain and codomain size. More...

#include <IFixedSizeLearner.h>

+ Inheritance diagram for iCub::learningmachine::IFixedSizeLearner:

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...
 
- Public Member Functions inherited from iCub::learningmachine::IMachineLearner
 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 IMachineLearnerclone ()=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...
 
- Protected Attributes inherited from iCub::learningmachine::IMachineLearner
std::string name
 The name of this type of machine learner. More...
 

Detailed Description

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.

See also
iCub::contrib::IMachineLearner
Author
Arjan Gijsberts

Definition at line 44 of file IFixedSizeLearner.h.

Constructor & Destructor Documentation

◆ IFixedSizeLearner()

iCub::learningmachine::IFixedSizeLearner::IFixedSizeLearner ( unsigned int  dom = 1,
unsigned int  cod = 1 
)
inline

Constructor.

Parameters
domthe initial domain size
codthe initial codomain size

Definition at line 98 of file IFixedSizeLearner.h.

Member Function Documentation

◆ checkCoDomainSize()

bool iCub::learningmachine::IFixedSizeLearner::checkCoDomainSize ( const yarp::sig::Vector &  output)
protectedvirtual

Checks whether the output is of the desired dimensionality.

Parameters
outputa sample output
Returns
true if the dimensionality is correct

Definition at line 55 of file IFixedSizeLearner.cpp.

◆ checkDomainSize()

bool iCub::learningmachine::IFixedSizeLearner::checkDomainSize ( const yarp::sig::Vector &  input)
protectedvirtual

Checks whether the input is of the desired dimensionality.

Parameters
inputa sample input
Returns
true if the dimensionality is correct

Definition at line 51 of file IFixedSizeLearner.cpp.

◆ configure()

bool iCub::learningmachine::IFixedSizeLearner::configure ( yarp::os::Searchable &  config)
virtual

◆ feedSample()

void iCub::learningmachine::IFixedSizeLearner::feedSample ( const yarp::sig::Vector &  input,
const yarp::sig::Vector &  output 
)
virtual

Provide the learning machine with an example of the desired mapping.

Parameters
inputa sample input
outputthe 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.

◆ getCoDomainSize()

unsigned int iCub::learningmachine::IFixedSizeLearner::getCoDomainSize ( ) const
inline

Returns the size (dimensionality) of the output domain (codomain).

Returns
the size of the codomain

Definition at line 122 of file IFixedSizeLearner.h.

◆ getConfigHelp()

std::string iCub::learningmachine::IFixedSizeLearner::getConfigHelp ( )
virtual

Asks the learning machine to return a string containing the list of configuration options that it supports.

Returns
an informative description of the configuration options

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.

◆ getDomainSize()

unsigned int iCub::learningmachine::IFixedSizeLearner::getDomainSize ( ) const
inline

Returns the size (dimensionality) of the input domain.

Returns
the size of the input domain

Definition at line 115 of file IFixedSizeLearner.h.

◆ getInfo()

std::string iCub::learningmachine::IFixedSizeLearner::getInfo ( )
virtual

Asks the learning machine to return a string containing information on its operation so far.

Returns
the information on the machine

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.

◆ readBottle()

void iCub::learningmachine::IFixedSizeLearner::readBottle ( yarp::os::Bottle &  bot)
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.

Parameters
botthe 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.

◆ setCoDomainSize()

virtual void iCub::learningmachine::IFixedSizeLearner::setCoDomainSize ( unsigned int  size)
inlinevirtual

Mutator for the codomain size.

Parameters
sizethe desired codomain size

Reimplemented in iCub::learningmachine::RLSLearner, iCub::learningmachine::LSSVMLearner, and iCub::learningmachine::LinearGPRLearner.

Definition at line 136 of file IFixedSizeLearner.h.

◆ setDomainSize()

virtual void iCub::learningmachine::IFixedSizeLearner::setDomainSize ( unsigned int  size)
inlinevirtual

Mutator for the domain size.

Parameters
sizethe desired domain size

Reimplemented in iCub::learningmachine::RLSLearner, iCub::learningmachine::LSSVMLearner, and iCub::learningmachine::LinearGPRLearner.

Definition at line 129 of file IFixedSizeLearner.h.

◆ train()

void iCub::learningmachine::IFixedSizeLearner::train ( )
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.

◆ validateDomainSizes()

void iCub::learningmachine::IFixedSizeLearner::validateDomainSizes ( const yarp::sig::Vector &  input,
const yarp::sig::Vector &  output 
)
protected

Validates whether the input and output are of the desired dimensionality.

An exception will be thrown if this is not the case.

Parameters
inputa sample input
outputthe corresponding output

Definition at line 59 of file IFixedSizeLearner.cpp.

◆ writeBottle()

void iCub::learningmachine::IFixedSizeLearner::writeBottle ( yarp::os::Bottle &  bot) const
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.

Parameters
botthe bottle containing the machine serialization

Implements iCub::learningmachine::IMachineLearner.

Reimplemented in iCub::learningmachine::DummyLearner.

Definition at line 68 of file IFixedSizeLearner.cpp.

Member Data Documentation

◆ coDomainSize

unsigned int iCub::learningmachine::IFixedSizeLearner::coDomainSize
protected

The dimensionality of the output domain (codomain).

Definition at line 54 of file IFixedSizeLearner.h.

◆ domainSize

unsigned int iCub::learningmachine::IFixedSizeLearner::domainSize
protected

The dimensionality of the input domain.

Definition at line 49 of file IFixedSizeLearner.h.


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