GestureRecognitionToolkit  Version: 0.2.0
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
RegressionSample.cpp
1 /*
2 GRT MIT License
3 Copyright (c) <2012> <Nicholas Gillian, Media Lab, MIT>
4 
5 Permission is hereby granted, free of charge, to any person obtaining a copy of this software
6 and associated documentation files (the "Software"), to deal in the Software without restriction,
7 including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
9 subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in all copies or substantial
12 portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
15 LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
18 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 */
20 
21 #define GRT_DLL_EXPORTS
22 #include "RegressionSample.h"
23 
24 GRT_BEGIN_NAMESPACE
25 
26 RegressionSample::RegressionSample(){
27 }
28 
29 RegressionSample::RegressionSample(const VectorFloat &inputVector,const VectorFloat &targetVector){
30  this->inputVector = inputVector;
31  this->targetVector = targetVector;
32 }
33 
34 RegressionSample::RegressionSample(const RegressionSample &rhs){
35  this->inputVector = rhs.inputVector;
36  this->targetVector = rhs.targetVector;
37 }
38 
39 RegressionSample::~RegressionSample(){
40 }
41 
42 void RegressionSample::clear(){
43  inputVector.clear();
44  targetVector.clear();
45 }
46 
47 void RegressionSample::set(const VectorFloat &inputVector,const VectorFloat &targetVector){
48  this->inputVector = inputVector;
49  this->targetVector = targetVector;
50 }
51 
52 UINT RegressionSample::getNumInputDimensions() const{
53  return inputVector.getSize();
54 }
55 
56 UINT RegressionSample::getNumTargetDimensions() const{
57  return targetVector.getSize();
58 }
59 
60 Float RegressionSample::getInputVectorValue(const UINT index) const{
61  if( index < inputVector.getSize() ) return inputVector[index];
62  else return 0;
63 }
64 Float RegressionSample::getTargetVectorValue(const UINT index) const{
65  if( index < targetVector.getSize() ) return targetVector[index];
66  else return 0;
67 }
68 
69 const VectorFloat& RegressionSample::getInputVector() const{
70  return inputVector;
71 }
72 
73 const VectorFloat& RegressionSample::getTargetVector() const{
74  return targetVector;
75 }
76 
77 GRT_END_NAMESPACE
78 
UINT getSize() const
Definition: Vector.h:191
This class stores the input vector and target vector for a single labelled regression instance...