GestureRecognitionToolkit  Version: 0.1.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 #include "RegressionSample.h"
22 
23 GRT_BEGIN_NAMESPACE
24 
25 RegressionSample::RegressionSample(){
26 }
27 
28 RegressionSample::RegressionSample(const VectorFloat &inputVector,const VectorFloat &targetVector){
29  this->inputVector = inputVector;
30  this->targetVector = targetVector;
31 }
32 
33 RegressionSample::RegressionSample(const RegressionSample &rhs){
34  this->inputVector = rhs.inputVector;
35  this->targetVector = rhs.targetVector;
36 }
37 
38 RegressionSample::~RegressionSample(){
39 }
40 
41 void RegressionSample::clear(){
42  inputVector.clear();
43  targetVector.clear();
44 }
45 
46 void RegressionSample::set(const VectorFloat &inputVector,const VectorFloat &targetVector){
47  this->inputVector = inputVector;
48  this->targetVector = targetVector;
49 }
50 
51 UINT RegressionSample::getNumInputDimensions() const{
52  return inputVector.getSize();
53 }
54 
55 UINT RegressionSample::getNumTargetDimensions() const{
56  return targetVector.getSize();
57 }
58 
59 Float RegressionSample::getInputVectorValue(const UINT index) const{
60  if( index < inputVector.getSize() ) return inputVector[index];
61  else return 0;
62 }
63 Float RegressionSample::getTargetVectorValue(const UINT index) const{
64  if( index < targetVector.getSize() ) return targetVector[index];
65  else return 0;
66 }
67 
68 const VectorFloat& RegressionSample::getInputVector() const{
69  return inputVector;
70 }
71 
72 const VectorFloat& RegressionSample::getTargetVector() const{
73  return targetVector;
74 }
75 
76 GRT_END_NAMESPACE
77 
unsigned int getSize() const
Definition: Vector.h:193
This class stores the input vector and target vector for a single labelled regression instance...