iCub-main
SparseSpectrumFeature.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_SPARSESPECTRUMFEATURE__
20 #define LM_SPARSESPECTRUMFEATURE__
21 
22 #include <yarp/sig/Matrix.h>
23 
25 
26 namespace iCub {
27 namespace learningmachine {
28 
29 
48 protected:
52  double sigma;
53 
58  yarp::sig::Vector ell;
59 
63  yarp::sig::Matrix W;
64 
65  /*
66  * Inherited from ITransformer.
67  */
68  virtual void writeBottle(yarp::os::Bottle& bot);
69 
70  /*
71  * Inherited from ITransformer.
72  */
73  virtual void readBottle(yarp::os::Bottle& bot);
74 
75 public:
84  SparseSpectrumFeature(unsigned int dom = 1, unsigned int cod = 2, double sigma = 1.,
85  yarp::sig::Vector ell = yarp::sig::Vector(0));
86 
90  virtual ~SparseSpectrumFeature() { }
91 
92  /*
93  * Inherited from ITransformer.
94  */
96  return new SparseSpectrumFeature(*this);
97  }
98 
99  /*
100  * Inherited from ITransformer.
101  */
102  virtual yarp::sig::Vector transform(const yarp::sig::Vector& input);
103 
104  /*
105  * Inherited from ITransformer.
106  */
107  virtual std::string getInfo();
108 
109  /*
110  * Inherited from ITransformer.
111  */
112  virtual std::string getConfigHelp();
113 
114  /*
115  * Inherited from ITransformer.
116  */
117  virtual void setDomainSize(unsigned int size);
118 
119  /*
120  * Inherited from IFixedSizeTransformer.
121  */
122  virtual void setCoDomainSize(unsigned int size);
123 
124  /*
125  * Inherited from ITransformer.
126  */
127  virtual void reset();
128 
129  /*
130  * Inherited from ITransformer.
131  */
132  virtual bool configure(yarp::os::Searchable &config);
133 
139  virtual double getSigma() {
140  return this->sigma;
141  }
142 
148  virtual void setSigma(double s) {
149  this->sigma = s;
150  }
151 
157  virtual yarp::sig::Vector& getEll() {
158  return this->ell;
159  }
160 
166  virtual void setEll(yarp::sig::Vector& ell);
167 
168 };
169 
170 
171 } // learningmachine
172 } // iCub
173 
174 #endif
An generalized interface for an ITransformer with a fixed domain and codomain size.
Implementation of Sparse Spectrum preprocessing.
virtual SparseSpectrumFeature * clone()
Asks the transformer to return a new object of its type.
yarp::sig::Vector ell
Characteristic length-scales ell, analoguous to same parameter in asymmetric RBF kernel.
virtual std::string getConfigHelp()
Asks the transformer to return a string containing the list of configuration options that it supports...
virtual yarp::sig::Vector & getEll()
Accessor for the characteristic length-scales parameter ell.
virtual ~SparseSpectrumFeature()
Destructor (empty).
virtual void reset()
Forget everything and start over.
virtual double getSigma()
Accessor for the sigma parameter.
virtual void readBottle(yarp::os::Bottle &bot)
Unserializes a transformer from a bottle.
virtual void setSigma(double s)
Mutator for the sigma parameter.
virtual void setDomainSize(unsigned int size)
Mutator for the domain size.
virtual bool configure(yarp::os::Searchable &config)
virtual yarp::sig::Vector transform(const yarp::sig::Vector &input)
Transforms an input vector.
virtual std::string getInfo()
Asks the transformer to return a string containing statistics on its operation so far.
virtual void setEll(yarp::sig::Vector &ell)
Mutator for the characteristic length-scales parameter ell.
virtual void setCoDomainSize(unsigned int size)
Mutator for the codomain size.
SparseSpectrumFeature(unsigned int dom=1, unsigned int cod=2, double sigma=1., yarp::sig::Vector ell=yarp::sig::Vector(0))
Constructor.
yarp::sig::Matrix W
Projection matrix W.
virtual void writeBottle(yarp::os::Bottle &bot)
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.