iCub-main
Standardizer.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_STANDARDIZER__
20 #define LM_STANDARDIZER__
21 
23 
24 namespace iCub {
25 namespace learningmachine {
26 
27 
43 class Standardizer : public IScaler {
44 protected:
48  int noSamples;
49 
53  double mean;
54 
58  double std;
59 
63  double runningMean;
64 
68  double runningStd;
69 
73  double squaredErrors;
74 
75  /*
76  * Inherited from IScaler
77  */
78  virtual void writeBottle(yarp::os::Bottle& bot);
79 
80  /*
81  * Inherited from IScaler
82  */
83  virtual void readBottle(yarp::os::Bottle& bot);
84 
85 public:
92  Standardizer(double m = 0., double s = 1.);
93 
94  /*
95  * Inherited from IScaler
96  */
97  virtual void update(double val);
98 
99  /*
100  * Inherited from IScaler
101  */
102  virtual std::string getInfo();
103 
104  /*
105  * Inherited from IConfig
106  */
107  virtual bool configure(yarp::os::Searchable& config);
108 
109  /*
110  * Inherited from IScaler
111  */
113  return new Standardizer(*this);
114  }
115 
119  virtual double getDesiredMean() { return this->mean; }
120 
126  virtual void setDesiredMean(double m) { this->mean = m; }
127 
131  virtual double getDesiredStd() { return this->std; }
132 
138  virtual void setDesiredStd(double s) { this->std = s; }
139 };
140 
141 
142 } // learningmachine
143 } // iCub
144 
145 #endif
The IScaler is a linear scaler based scaler.
Definition: IScaler.h:41
A class that implements standardization as a preprocessing step.
Definition: Standardizer.h:43
virtual double getDesiredStd()
Accessor for the desired standard deviation.
Definition: Standardizer.h:131
double runningStd
Running standard deviation based on the samples seen so far.
Definition: Standardizer.h:68
Standardizer(double m=0., double s=1.)
Constructor.
double mean
Desired mean for the output distribution.
Definition: Standardizer.h:53
double squaredErrors
Temporary variable that counts the sum of the squared errors.
Definition: Standardizer.h:73
virtual void readBottle(yarp::os::Bottle &bot)
Unserializes a scaler from a bottle.
virtual std::string getInfo()
Asks the learning machine to return a string containing statistics on its operation so far.
virtual void writeBottle(yarp::os::Bottle &bot)
Writes a serialization of the scaler into a bottle.
virtual void setDesiredStd(double s)
Mutator for the desired standard deviation.
Definition: Standardizer.h:138
virtual bool configure(yarp::os::Searchable &config)
double std
Desired standard deviation for the output distribution.
Definition: Standardizer.h:58
int noSamples
The number of samples that have been received so far.
Definition: Standardizer.h:48
virtual void update(double val)
Feeds a single sample into the scaler, so that it can use this sample to update the offset and scale.
Standardizer * clone()
Asks the scaler to return a new object of its type.
Definition: Standardizer.h:112
virtual void setDesiredMean(double m)
Mutator for the desired mean.
Definition: Standardizer.h:126
double runningMean
Running mean based on the samples seen so far.
Definition: Standardizer.h:63
virtual double getDesiredMean()
Accessor for the desired mean.
Definition: Standardizer.h:119
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.