19 #ifndef LM_LSSVMLEARNER__
20 #define LM_LSSVMLEARNER__
25 #include <yarp/sig/Matrix.h>
31 namespace learningmachine {
39 virtual double evaluate(
const yarp::sig::Vector& v1,
const yarp::sig::Vector& v2) = 0;
42 return std::string(
"Kernel configuration options for '") +
68 virtual double evaluate(
const yarp::sig::Vector& v1,
const yarp::sig::Vector& v2);
81 virtual bool configure(yarp::os::Searchable& config) {
84 if(config.find(
"gamma").isFloat64() || config.find(
"gamma").isInt32()) {
85 this->
setGamma(config.find(
"gamma").asFloat64());
92 std::ostringstream buffer;
94 buffer <<
" gamma val RBF parameter gamma" << std::endl;
99 std::ostringstream buffer;
101 buffer <<
" gamma: " << this->
getGamma();
125 std::vector<yarp::sig::Vector> inputs;
130 std::vector<yarp::sig::Vector> outputs;
135 yarp::sig::Matrix alphas;
140 yarp::sig::Vector bias;
145 yarp::sig::Vector LOO;
166 LSSVMLearner(
unsigned int dom = 1,
unsigned int cod = 1,
double c = 1.0);
186 virtual void feedSample(
const yarp::sig::Vector& input,
const yarp::sig::Vector& output);
191 virtual void train();
226 virtual void readBottle(yarp::os::Bottle& bot);
241 virtual bool configure(yarp::os::Searchable& config);
An generalized interface for a learning machine with a fixed domain and codomain size.
virtual std::string getInfo()
virtual std::string getConfigHelp()
virtual double evaluate(const yarp::sig::Vector &v1, const yarp::sig::Vector &v2)=0
virtual void setName(std::string n)
virtual std::string getName()
This is basic implementation of the LSSVM algorithms.
virtual void feedSample(const yarp::sig::Vector &input, const yarp::sig::Vector &output)
Provide the learning machine with an example of the desired mapping.
virtual void writeBottle(yarp::os::Bottle &bot)
virtual double getC()
Accessor for the regularization parameter C.
void setCoDomainSize(unsigned int size)
Mutator for the codomain size.
void reset()
Forget everything and start over.
virtual ~LSSVMLearner()
Destructor.
void setDomainSize(unsigned int size)
Mutator for the domain size.
virtual void setC(double C)
Mutator for the regularization parameter C.
LSSVMLearner * clone()
Asks the learning machine to return a clone of its type.
Prediction predict(const yarp::sig::Vector &input)
Ask the learning machine to predict the output for a given input.
virtual void train()
Train the learning machine on the examples that have been supplied so far.
virtual void readBottle(yarp::os::Bottle &bot)
Unserializes a machine from a bottle.
LSSVMLearner(unsigned int dom=1, unsigned int cod=1, double c=1.0)
Constructor.
virtual std::string getInfo()
Asks the learning machine to return a string containing information on its operation so far.
virtual RBFKernel * getKernel()
Accessor for the kernel.
virtual LSSVMLearner & operator=(const LSSVMLearner &other)
Assignment operator.
virtual std::string getConfigHelp()
Asks the learning machine to return a string containing the list of configuration options that it sup...
virtual bool configure(yarp::os::Searchable &config)
Change parameters.
A class that represents a prediction result.
virtual std::string getConfigHelp()
virtual std::string getInfo()
virtual void setGamma(double g)
virtual double evaluate(const yarp::sig::Vector &v1, const yarp::sig::Vector &v2)
virtual bool configure(yarp::os::Searchable &config)
virtual double getGamma()
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.