iCub-main
Normalizer.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_NORMALIZER__
20 #define LM_NORMALIZER__
21 
23 
24 namespace iCub {
25 namespace learningmachine {
26 
40 class Normalizer : public IScaler {
41 protected:
45  double lowest;
46 
50  double highest;
51 
55  double lowerBound;
56 
60  double upperBound;
61 
62  /*
63  * Inherited from IScaler
64  */
65  virtual void writeBottle(yarp::os::Bottle& bot);
66 
67  /*
68  * Inherited from IScaler
69  */
70  virtual void readBottle(yarp::os::Bottle& bot);
71 
72 public:
79  Normalizer(double l = -1, double u = 1);
80 
81  /*
82  * Inherited from IScaler.
83  */
84  virtual void update(double val);
85 
86  /*
87  * Inherited from IScaler
88  */
89  virtual std::string getInfo();
90 
91  /*
92  * Inherited from IScaler.
93  */
94  virtual bool configure(yarp::os::Searchable& config);
95 
96  /*
97  * Inherited from IScaler.
98  */
100  return new Normalizer(*this);
101  }
102 
106  virtual double getLowerBound() { return this->lowerBound; }
107 
113  virtual void setLowerBound(double l) { this->lowerBound = l; }
114 
118  virtual double getUpperBound() { return this->upperBound; }
119 
125  virtual void setUpperBound(double u) { this->upperBound = u; }
126 
127 };
128 
129 } // learningmachine
130 } // iCub
131 
132 #endif
The IScaler is a linear scaler based scaler.
Definition: IScaler.h:41
A class that implements normalization as a preprocessing step.
Definition: Normalizer.h:40
double highest
The actual highest value found in the sample values.
Definition: Normalizer.h:50
Normalizer(double l=-1, double u=1)
Constructor.
Definition: Normalizer.cpp:32
virtual double getUpperBound()
Accessor for the desired upper bound.
Definition: Normalizer.h:118
double lowest
The actual lowest value found in the sample values.
Definition: Normalizer.h:45
double lowerBound
The desired lower bound for the normalization range.
Definition: Normalizer.h:55
Normalizer * clone()
Asks the scaler to return a new object of its type.
Definition: Normalizer.h:99
virtual void setLowerBound(double l)
Mutator for the desired lower bound.
Definition: Normalizer.h:113
virtual void setUpperBound(double u)
Mutator for the desired upper bound.
Definition: Normalizer.h:125
double upperBound
The desired upper bound for the normalization range.
Definition: Normalizer.h:60
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.
Definition: Normalizer.cpp:37
virtual std::string getInfo()
Asks the learning machine to return a string containing statistics on its operation so far.
Definition: Normalizer.cpp:53
virtual double getLowerBound()
Accessor for the desired lower bound.
Definition: Normalizer.h:106
virtual void readBottle(yarp::os::Bottle &bot)
Unserializes a scaler from a bottle.
Definition: Normalizer.cpp:68
virtual void writeBottle(yarp::os::Bottle &bot)
Writes a serialization of the scaler into a bottle.
Definition: Normalizer.cpp:61
virtual bool configure(yarp::os::Searchable &config)
Definition: Normalizer.cpp:75
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.