iCub-main
Loading...
Searching...
No Matches
RLSLearner.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2007-2011 RobotCub Consortium, European Commission FP6 Project IST-004370
3 * author: Arjan Gijsberts
4 * email: arjan.gijsberts@iit.it
5 * website: www.robotcub.org
6 * Permission is granted to copy, distribute, and/or modify this program
7 * under the terms of the GNU General Public License, version 2 or any
8 * later version published by the Free Software Foundation.
9 *
10 * A copy of the license can be found at
11 * http://www.robotcub.org/icub/license/gpl.txt
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16 * Public License for more details
17 */
18
19#ifndef LM_RLSLEARNER__
20#define LM_RLSLEARNER__
21
22#include <yarp/sig/Matrix.h>
23
25
26
27namespace iCub {
28namespace learningmachine {
29
30
47private:
51 yarp::sig::Matrix R;
52
56 yarp::sig::Matrix B;
57
61 yarp::sig::Matrix W;
62
66 int sampleCount;
67
71 double lambda;
72
73public:
81 RLSLearner(unsigned int dom = 1, unsigned int cod = 1, double lambda = 1.0);
82
86 RLSLearner(const RLSLearner& other);
87
91 virtual ~RLSLearner();
92
96 RLSLearner& operator=(const RLSLearner& other);
97
98 /*
99 * Inherited from IMachineLearner.
100 */
101 virtual void feedSample(const yarp::sig::Vector& input, const yarp::sig::Vector& output);
102
103 /*
104 * Inherited from IMachineLearner.
105 */
106 virtual void train();
107
108 /*
109 * Inherited from IMachineLearner.
110 */
111 virtual Prediction predict(const yarp::sig::Vector& input);
112
113 /*
114 * Inherited from IMachineLearner.
115 */
116 void reset();
117
118 /*
119 * Inherited from IMachineLearner.
120 */
122 return new RLSLearner(*this);
123 }
124
125 /*
126 * Inherited from IMachineLearner.
127 */
128 virtual std::string getInfo();
129
130 /*
131 * Inherited from IMachineLearner.
132 */
133 virtual std::string getConfigHelp();
134
135 /*
136 * Inherited from IMachineLearner.
137 */
138 virtual void writeBottle(yarp::os::Bottle& bot);
139
140 /*
141 * Inherited from IMachineLearner.
142 */
143 virtual void readBottle(yarp::os::Bottle& bot);
144
145 /*
146 * Inherited from IFixedSizeLearner.
147 */
148 void setDomainSize(unsigned int size);
149
150 /*
151 * Inherited from IFixedSizeLearner.
152 */
153 void setCoDomainSize(unsigned int size);
154
161 void setLambda(double l);
162
168 double getLambda();
169
170 /*
171 * Inherited from IMachineLearner.
172 */
173 virtual bool configure(yarp::os::Searchable& config);
174};
175
176} // learningmachine
177} // iCub
178#endif
An generalized interface for a learning machine with a fixed domain and codomain size.
A class that represents a prediction result.
Definition Prediction.h:44
Recursive Regularized Least Squares (a.k.a.
Definition RLSLearner.h:46
void setCoDomainSize(unsigned int size)
Mutator for the codomain size.
void reset()
Forget everything and start over.
RLSLearner * clone()
Asks the learning machine to return a clone of its type.
Definition RLSLearner.h:121
virtual std::string getInfo()
Asks the learning machine to return a string containing information on its operation so far.
virtual void readBottle(yarp::os::Bottle &bot)
Unserializes a machine from a bottle.
virtual Prediction predict(const yarp::sig::Vector &input)
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...
void setDomainSize(unsigned int size)
Mutator for the domain size.
virtual void writeBottle(yarp::os::Bottle &bot)
virtual void train()
Train the learning machine on the examples that have been supplied so far.
virtual ~RLSLearner()
Destructor.
void setLambda(double l)
Sets the regularization parameter \lambda to a specified value.
RLSLearner & operator=(const RLSLearner &other)
Assignment operator.
double getLambda()
Accessor for the regularization parameter \lambda.
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 bool configure(yarp::os::Searchable &config)
Change parameters.
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.