19 #ifndef LM_IMACHINELEARNER__
20 #define LM_IMACHINELEARNER__
25 #include <yarp/sig/Vector.h>
26 #include <yarp/os/Portable.h>
27 #include <yarp/os/Bottle.h>
28 #include <yarp/os/Value.h>
33 namespace learningmachine {
128 virtual bool open(yarp::os::Searchable& config) {
return true;}
138 virtual bool configure(yarp::os::Searchable& config) {
return false;}
146 virtual void feedSample(
const yarp::sig::Vector& input,
const yarp::sig::Vector& output) = 0;
179 bool write(yarp::os::ConnectionWriter& connection)
const {
180 yarp::os::Bottle model;
182 return model.write(connection);
188 bool read(yarp::os::ConnectionReader& connection) {
189 yarp::os::Bottle model;
190 model.read(connection);
202 return std::string(
"Type: ") + this->
getName() + std::string(
"\n");
212 return std::string(
"Machine configuration options for '") +
222 yarp::os::Bottle model;
224 return model.toString().c_str();
233 yarp::os::Bottle model(str.c_str());
A generalized interface for a learning machine for offline and online learning machines (e....
virtual bool fromString(const std::string &str)
Asks the learning machine to initialize from a string serialization.
virtual void readBottle(yarp::os::Bottle &bot)=0
Unserializes a machine from a bottle.
std::string getName() const
Retrieve the name of this machine learning technique.
virtual bool configure(yarp::os::Searchable &config)
Change parameters.
IMachineLearner()
Constructor.
virtual ~IMachineLearner()
Destructor (empty).
std::string name
The name of this type of machine learner.
virtual IMachineLearner * clone()=0
Asks the learning machine to return a clone of its type.
virtual void writeBottle(yarp::os::Bottle &bot) const =0
Writes a serialization of the machine into a bottle.
bool read(yarp::os::ConnectionReader &connection)
virtual void reset()=0
Forget everything and start over.
virtual void train()
Train the learning machine on the examples that have been supplied so far.
virtual Prediction predict(const yarp::sig::Vector &input)=0
Ask the learning machine to predict the output for a given input.
virtual std::string getConfigHelp()
Asks the learning machine to return a string containing the list of configuration options that it sup...
virtual std::string getInfo()
Asks the learning machine to return a string containing information on its operation so far.
virtual bool close()
Shut the object down.
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.
bool write(yarp::os::ConnectionWriter &connection) const
virtual std::string toString()
Asks the learning machine to return a string serialization.
virtual bool open(yarp::os::Searchable &config)
Initialize the object.
void setName(const std::string &name)
Set the name of this machine learning technique.
A class that represents a prediction result.
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.