iCub-main
TrainEvent.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2010 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_TRAINEVENT__
20 #define LM_TRAINEVENT__
21 
22 #include <string>
23 
24 #include <yarp/sig/Vector.h>
25 
29 
30 namespace iCub {
31 namespace learningmachine {
32 
33 class IEventListener;
34 
44 class TrainEvent : public IEvent {
45 protected:
49  yarp::sig::Vector input;
50 
54  yarp::sig::Vector desired;
55 
60 
61 public:
69  TrainEvent(const yarp::sig::Vector& input, const yarp::sig::Vector& desired, const Prediction& predicted);
70 
74  virtual ~TrainEvent() { }
75 
76  /*
77  * Inherited from IEvent.
78  */
79  virtual void visit(IEventListener& listener);
80 
81  /*
82  * Inherited from IEvent.
83  */
84  std::string toString();
85 
90  yarp::sig::Vector& getInput() {
91  return this->input;
92  }
93 
98  yarp::sig::Vector& getDesired() {
99  return this->desired;
100  }
101 
107  return this->predicted;
108  }
109 
110 };
111 
112 } // learningmachine
113 } // iCub
114 
115 #endif
A class that represents a prediction result.
Definition: Prediction.h:44
A TrainEvent is raised when the machine handles a training sample.
Definition: TrainEvent.h:44
Prediction & getPredicted()
Accessor for the prediction.
Definition: TrainEvent.h:106
yarp::sig::Vector desired
Vector of desired outputs.
Definition: TrainEvent.h:54
std::string toString()
Returns a string representation of the Event.
Definition: TrainEvent.cpp:36
TrainEvent(const yarp::sig::Vector &input, const yarp::sig::Vector &desired, const Prediction &predicted)
Constructor.
Definition: TrainEvent.cpp:26
yarp::sig::Vector & getDesired()
Accessor for the vector of desired outputs.
Definition: TrainEvent.h:98
virtual void visit(IEventListener &listener)
Causes the Event to visit an EventListener.
Definition: TrainEvent.cpp:32
virtual ~TrainEvent()
Destructor (empty).
Definition: TrainEvent.h:74
yarp::sig::Vector & getInput()
Accessor for the vector of inputs.
Definition: TrainEvent.h:90
yarp::sig::Vector input
Vector of inputs.
Definition: TrainEvent.h:49
Prediction predicted
Predicted outputs.
Definition: TrainEvent.h:59
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.