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

#include <IMachineLearner.h>

+ Inheritance diagram for iCub::learningmachine::IMachineLearner:

Public Member Functions

 IMachineLearner ()
 Constructor. More...
 
virtual ~IMachineLearner ()
 Destructor (empty). More...
 
virtual void feedSample (const yarp::sig::Vector &input, const yarp::sig::Vector &output)=0
 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...
 
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 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 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 void writeBottle (yarp::os::Bottle &bot) const =0
 Writes a serialization of the machine into a bottle. More...
 
virtual void readBottle (yarp::os::Bottle &bot)=0
 Unserializes a machine from a bottle. More...
 

Protected Attributes

std::string name
 The name of this type of machine learner. More...
 

Detailed Description

A generalized interface for a learning machine for offline and online learning machines (e.g. SVM, LSSVM, ANN). This interface extends the Learner interface, which imposes certain limitations. Learning machines that meet this interface can, if desired, be made into two executable modules by iCub::contrib::LearnModule and iCub::contrib::PredictModule.

The learning machine can be used for regression and classification from R^* to R^*.

Be aware that objects of this class type cannot be written directly on a port, although this interface implements Portable. The reason is that this is an abstract base class, which conflicts with the template port readers and writers. See MachinePortable for how to send Learning Machines over ports.

See also
iCub::contrib::Learner
iCub::contrib::IFixedSizeLearner
iCub::contrib::MachinePortable
iCub::contrib::MachineFactory
Author
Arjan Gijsberts

Definition at line 89 of file IMachineLearner.h.

Constructor & Destructor Documentation

◆ IMachineLearner()

iCub::learningmachine::IMachineLearner::IMachineLearner ( )
inline

Constructor.

Definition at line 118 of file IMachineLearner.h.

◆ ~IMachineLearner()

virtual iCub::learningmachine::IMachineLearner::~IMachineLearner ( )
inlinevirtual

Destructor (empty).

Definition at line 123 of file IMachineLearner.h.

Member Function Documentation

◆ clone()

virtual IMachineLearner* iCub::learningmachine::IMachineLearner::clone ( )
pure virtual

Asks the learning machine to return a clone of its type.

Returns
a clone of the current learner

Implemented in iCub::learningmachine::LSSVMLearner, iCub::learningmachine::LinearGPRLearner, iCub::learningmachine::DatasetRecorder, iCub::learningmachine::RLSLearner, and iCub::learningmachine::DummyLearner.

◆ feedSample()

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

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

Parameters
inputa sample input
outputthe corresponding output

Implemented in iCub::learningmachine::LSSVMLearner, iCub::learningmachine::LinearGPRLearner, iCub::learningmachine::IFixedSizeLearner, iCub::learningmachine::RLSLearner, iCub::learningmachine::DatasetRecorder, and iCub::learningmachine::DummyLearner.

◆ fromString()

virtual bool iCub::learningmachine::IMachineLearner::fromString ( const std::string str)
inlinevirtual

Asks the learning machine to initialize from a string serialization.

Returns
true on succes

Definition at line 217 of file IMachineLearner.h.

◆ getConfigHelp()

virtual std::string iCub::learningmachine::IMachineLearner::getConfigHelp ( )
inlinevirtual

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 in iCub::learningmachine::LSSVMLearner, iCub::learningmachine::IFixedSizeLearner, iCub::learningmachine::LinearGPRLearner, iCub::learningmachine::DatasetRecorder, and iCub::learningmachine::RLSLearner.

Definition at line 196 of file IMachineLearner.h.

◆ getInfo()

virtual std::string iCub::learningmachine::IMachineLearner::getInfo ( )
inlinevirtual

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

Returns
the information on the machine

Reimplemented in iCub::learningmachine::LSSVMLearner, iCub::learningmachine::IFixedSizeLearner, iCub::learningmachine::LinearGPRLearner, iCub::learningmachine::DatasetRecorder, iCub::learningmachine::RLSLearner, and iCub::learningmachine::DummyLearner.

Definition at line 186 of file IMachineLearner.h.

◆ getName()

std::string iCub::learningmachine::IMachineLearner::getName ( ) const
inline

Retrieve the name of this machine learning technique.

Returns
the name of this machine learner

Definition at line 228 of file IMachineLearner.h.

◆ predict()

virtual Prediction iCub::learningmachine::IMachineLearner::predict ( const yarp::sig::Vector &  input)
pure virtual

Ask the learning machine to predict the output for a given input.

Parameters
inputthe input
Returns
the expected output

Implemented in iCub::learningmachine::LSSVMLearner, iCub::learningmachine::LinearGPRLearner, iCub::learningmachine::RLSLearner, iCub::learningmachine::DatasetRecorder, and iCub::learningmachine::DummyLearner.

◆ read()

bool iCub::learningmachine::IMachineLearner::read ( yarp::os::ConnectionReader &  connection)
inline

Definition at line 173 of file IMachineLearner.h.

◆ readBottle()

virtual void iCub::learningmachine::IMachineLearner::readBottle ( yarp::os::Bottle &  bot)
protectedpure virtual

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

Implemented in iCub::learningmachine::LSSVMLearner, iCub::learningmachine::LinearGPRLearner, iCub::learningmachine::DatasetRecorder, iCub::learningmachine::RLSLearner, iCub::learningmachine::DummyLearner, and iCub::learningmachine::IFixedSizeLearner.

◆ reset()

virtual void iCub::learningmachine::IMachineLearner::reset ( )
pure virtual

◆ setName()

void iCub::learningmachine::IMachineLearner::setName ( const std::string name)
inline

Set the name of this machine learning technique.

Parameters
namethe new name

Definition at line 237 of file IMachineLearner.h.

◆ toString()

virtual std::string iCub::learningmachine::IMachineLearner::toString ( )
inlinevirtual

Asks the learning machine to return a string serialization.

Returns
a string serialization of the machine

Definition at line 206 of file IMachineLearner.h.

◆ train()

virtual void iCub::learningmachine::IMachineLearner::train ( )
inlinevirtual

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 in iCub::learningmachine::LSSVMLearner, iCub::learningmachine::LinearGPRLearner, iCub::learningmachine::IFixedSizeLearner, iCub::learningmachine::RLSLearner, iCub::learningmachine::DatasetRecorder, and iCub::learningmachine::DummyLearner.

Definition at line 139 of file IMachineLearner.h.

◆ write()

bool iCub::learningmachine::IMachineLearner::write ( yarp::os::ConnectionWriter &  connection) const
inline

Definition at line 164 of file IMachineLearner.h.

◆ writeBottle()

virtual void iCub::learningmachine::IMachineLearner::writeBottle ( yarp::os::Bottle &  bot) const
protectedpure virtual

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

Implemented in iCub::learningmachine::DatasetRecorder, iCub::learningmachine::DummyLearner, and iCub::learningmachine::IFixedSizeLearner.

Member Data Documentation

◆ name

std::string iCub::learningmachine::IMachineLearner::name
protected

The name of this type of machine learner.

Definition at line 94 of file IMachineLearner.h.


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