35 #ifndef GRT_GESTURE_RECOGNITION_PIPELINE_HEADER
36 #define GRT_GESTURE_RECOGNITION_PIPELINE_HEADER
45 #include "../DataStructures/TimeSeriesClassificationDataStream.h"
46 #include "../Util/ClassificationResult.h"
47 #include "../Util/TestResult.h"
51 #define INSERT_AT_END_INDEX 99999
98 bool train(
const ClassificationData &trainingData,
const UINT kFoldValue,
const bool useStratifiedSampling =
false );
208 bool predict(
const VectorDouble &inputVector);
228 bool map(
const VectorDouble &inputVector);
245 bool save(
const string &filename)
const;
262 bool load(
const string &filename);
286 bool preProcessData(VectorDouble inputVector,
bool computeFeatures =
true);
768 if( moduleIndex < preProcessingModules.size() ){
769 return (T*)preProcessingModules[ moduleIndex ];
781 if( moduleIndex < featureExtractionModules.size() ){
782 return (T*)featureExtractionModules[ moduleIndex ];
795 if( classifier == NULL )
return NULL;
800 return dynamic_cast<T*
>(classifier);
814 if( regressifier == NULL )
return NULL;
819 return (T*)regressifier;
833 if( clusterer == NULL )
return NULL;
838 return (T*)clusterer;
851 if( moduleIndex < postProcessingModules.size() ){
852 return (T*)postProcessingModules[ moduleIndex ];
864 template <
class T> T*
getContextModule(
const UINT contextLevel,
const UINT moduleIndex)
const{
865 if( contextLevel < contextModules.size() ){
866 if( moduleIndex < contextModules[ contextLevel ].size() ){
867 return (T*)contextModules[ contextLevel ][ moduleIndex ];
892 string getInfo()
const;
1102 bool setInfo(
const string info);
1105 bool predict_classifier(
const VectorDouble &inputVector);
1106 bool predict_regressifier(
const VectorDouble &inputVector);
1107 bool predict_clusterer(
const VectorDouble &inputVector);
1108 void deleteAllPreProcessingModules();
1109 void deleteAllFeatureExtractionModules();
1110 void deleteClassifier();
1111 void deleteRegressifier();
1112 void deleteClusterer();
1113 void deleteAllPostProcessingModules();
1114 void deleteAllContextModules();
1115 bool updateTestMetrics(
const UINT classLabel,
const UINT predictedClassLabel,VectorDouble &precisionCounter,VectorDouble &recallCounter,
double &rejectionPrecisionCounter,
double &rejectionRecallCounter,VectorDouble &confusionMatrixCounter);
1116 bool computeTestMetrics(VectorDouble &precisionCounter,VectorDouble &recallCounter,
double &rejectionPrecisionCounter,
double &rejectionRecallCounter,VectorDouble &confusionMatrixCounter,
const UINT numTestSamples);
1121 UINT inputVectorDimensions;
1122 UINT outputVectorDimensions;
1123 UINT predictedClassLabel;
1124 UINT predictedClusterLabel;
1126 UINT predictionModuleIndex;
1127 UINT numTrainingSamples;
1128 UINT numTestSamples;
1129 double testAccuracy;
1130 double testRMSError;
1131 double testSquaredError;
1133 double trainingTime;
1134 VectorDouble testFMeasure;
1135 VectorDouble testPrecision;
1136 VectorDouble testRecall;
1137 VectorDouble regressionData;
1138 double testRejectionPrecision;
1139 double testRejectionRecall;
1141 vector< TestResult > crossValidationResults;
1142 vector< TestInstanceResult > testResults;
1144 vector< PreProcessing* > preProcessingModules;
1145 vector< FeatureExtraction* > featureExtractionModules;
1149 vector< PostProcessing* > postProcessingModules;
1150 vector< vector< Context* > > contextModules;
1152 enum PipelineModes{PIPELINE_MODE_NOT_SET=0,CLASSIFICATION_MODE,REGRESSION_MODE,CLUSTER_MODE};
1155 enum ContextLevels{START_OF_PIPELINE=0,AFTER_PREPROCESSING,AFTER_FEATURE_EXTRACTION,AFTER_CLASSIFIER,END_OF_PIPELINE,NUM_CONTEXT_LEVELS};
1161 #endif //GRT_GESTURE_RECOGNITION_PIPELINE_HEADER
bool getIsClustererSet() const
UINT getNumFeatureExtractionModules() const
UINT getInputVectorDimensionsSize() const
double getCrossValidationAccuracy() const
T * getClassifier() const
This is the main base class that all GRT Clustering algorithms should inherit from.
MatrixDouble getTestConfusionMatrix() const
bool map(const VectorDouble &inputVector)
double getTrainingTime() const
bool setRegressifier(const Regressifier ®ressifier)
virtual ~GestureRecognitionPipeline(void)
VectorDouble getRegressionData() const
VectorDouble getNullRejectionThresholds() const
TestResult getTestResults() const
double getMaximumLikelihood() const
bool removeRegressifier()
UINT getPredictedClassLabel() const
Context * getContextModule(const UINT contextLevel, const UINT moduleIndex) const
bool test(const ClassificationData &testData)
bool setPostProcessingModule(const PostProcessing &postProcessingModule)
UINT getOutputVectorDimensionsSize() const
bool addPostProcessingModule(const PostProcessing &postProcessingModule, UINT insertIndex=INSERT_AT_END_INDEX)
bool getIsFeatureExtractionSet() const
VectorDouble getTestFMeasure() const
double getTestAccuracy() const
bool getIsInitialized() const
UINT getNumPostProcessingModules() const
bool removePreProcessingModule(UINT moduleIndex)
VectorDouble getPreProcessedData() const
double getTestTime() const
string getPipelineModeAsString() const
UINT getNumClassesInModel() const
double getTestRejectionRecall() const
T * getPreProcessingModule(const UINT moduleIndex) const
bool save(const string &filename) const
bool getIsPipelineModeSet() const
double getTestRejectionPrecision() const
Clusterer * getClusterer() const
bool setInfo(const string info)
Regressifier * getRegressifier() const
UINT getPredictionModuleIndexPosition() const
bool removeAllPreProcessingModules()
bool removeAllPostProcessingModules()
bool addContextModule(const Context &contextModule, UINT contextLevel, UINT insertIndex=INSERT_AT_END_INDEX)
bool loadPipelineFromFile(const string &filename)
vector< TestResult > getCrossValidationResults() const
VectorDouble getTestRecall() const
T * getRegressifier() const
bool removeAllFeatureExtractionModules()
bool setFeatureExtractionModule(const FeatureExtraction &featureExtractionModule)
bool getIsRegressifierSet() const
bool removeAllContextModules()
bool removePostProcessingModule(const UINT moduleIndex)
VectorDouble getFeatureExtractionData() const
string getRegressifierType() const
string getClustererType() const
bool addPreProcessingModule(const PreProcessing &preProcessingModule, UINT insertIndex=INSERT_AT_END_INDEX)
bool setClusterer(const Clusterer &clusterer)
bool savePipelineToFile(const string &filename) const
T * getPostProcessingModule(const UINT moduleIndex) const
bool getIsPipelineInClassificationMode() const
bool getIsPipelineInRegressionMode() const
This is the main base class that all GRT Classification algorithms should inherit from...
bool train(const ClassificationData &trainingData)
bool predict(const VectorDouble &inputVector)
This is the main base class that all GRT PostProcessing algorithms should inherit from...
UINT getNumPreProcessingModules() const
bool getIsContextSet() const
bool addFeatureExtractionModule(const FeatureExtraction &featureExtractionModule, UINT insertIndex=INSERT_AT_END_INDEX)
UINT getNumClasses() const
double getTrainingRMSError() const
bool removeFeatureExtractionModule(UINT moduleIndex)
UINT getUnProcessedPredictedClassLabel() const
Classifier * getClassifier() const
UINT getNumTestSamples() const
T * getContextModule(const UINT contextLevel, const UINT moduleIndex) const
bool setPreProcessingModule(const PreProcessing &preProcessingModule)
T * getFeatureExtractionModule(const UINT moduleIndex) const
string getClassifierType() const
bool setClassifier(const Classifier &classifier)
bool getIsPostProcessingSet() const
VectorDouble getTestPrecision() const
GestureRecognitionPipeline(void)
This is the main base class that all GRT PreProcessing algorithms should inherit from.
bool preProcessData(VectorDouble inputVector, bool computeFeatures=true)
VectorDouble getClassDistances() const
double getTrainingSSError() const
VectorDouble getUnProcessedRegressionData() const
vector< UINT > getClassLabels() const
UINT getPipelineModeFromString(string pipelineMode) const
UINT getNumTrainingSamples() const
VectorDouble getClassLikelihoods() const
GestureRecognitionPipeline & operator=(const GestureRecognitionPipeline &rhs)
FeatureExtraction * getFeatureExtractionModule(const UINT moduleIndex) const
vector< TestInstanceResult > getTestInstanceResults() const
PreProcessing * getPreProcessingModule(const UINT moduleIndex) const
bool getIsPreProcessingSet() const
double getTestRMSError() const
double getTestSSError() const
bool removeContextModule(const UINT contextLevel, const UINT moduleIndex)
bool load(const string &filename)
PostProcessing * getPostProcessingModule(UINT moduleIndex) const
This is the main base class that all GRT Feature Extraction algorithms should inherit from...
bool getIsClassifierSet() const
string getModelAsString() const
This is the main base class that all GRT Regression algorithms should inherit from.
bool updateContextModule(bool value, UINT contextLevel=0, UINT moduleIndex=0)