35 #ifndef GRT_GESTURE_RECOGNITION_PIPELINE_HEADER
36 #define GRT_GESTURE_RECOGNITION_PIPELINE_HEADER
38 #include "../Util/GRTCommon.h"
46 #include "../DataStructures/ClassificationDataStream.h"
47 #include "../Util/ClassificationResult.h"
48 #include "../Util/TestResult.h"
52 #define INSERT_AT_END_INDEX 99999
57 enum ContextLevels{START_OF_PIPELINE=0,AFTER_PREPROCESSING,AFTER_FEATURE_EXTRACTION,AFTER_CLASSIFIER,END_OF_PIPELINE,NUM_CONTEXT_LEVELS};
149 bool train(
const ClassificationData &trainingData,
const UINT kFoldValue,
const bool useStratifiedSampling =
false );
323 bool save(
const std::string &filename)
const;
340 bool load(
const std::string &filename);
846 if( moduleIndex < preProcessingModules.size() ){
847 return (T*)preProcessingModules[ moduleIndex ];
859 if( moduleIndex < featureExtractionModules.size() ){
860 return (T*)featureExtractionModules[ moduleIndex ];
873 if( classifier == NULL )
return NULL;
878 return dynamic_cast<T*
>(classifier);
892 if( regressifier == NULL )
return NULL;
897 return (T*)regressifier;
911 if( clusterer == NULL )
return NULL;
916 return (T*)clusterer;
929 if( moduleIndex < postProcessingModules.
getSize() ){
930 return (T*)postProcessingModules[ moduleIndex ];
942 template <
class T> T*
getContextModule(
const UINT contextLevel,
const UINT moduleIndex)
const{
943 if( contextLevel < contextModules.
getSize() ){
944 if( moduleIndex < contextModules[ contextLevel ].getSize() ){
945 return (T*)contextModules[ contextLevel ][ moduleIndex ];
970 std::string getInfo()
const;
1181 bool setInfo(
const std::string &info);
1184 bool predict_classifier(
const VectorFloat &inputVector);
1185 bool predict_timeseries(
const MatrixFloat &input );
1187 bool predict_regressifier(
const VectorFloat &inputVector);
1188 bool predict_clusterer(
const VectorFloat &inputVector);
1190 void deleteAllPreProcessingModules();
1191 void deleteAllFeatureExtractionModules();
1192 void deleteClassifier();
1193 void deleteRegressifier();
1194 void deleteClusterer();
1195 void deleteAllPostProcessingModules();
1196 void deleteAllContextModules();
1197 bool updateTestMetrics(
const UINT classLabel,
const UINT predictedClassLabel,
VectorFloat &precisionCounter,
VectorFloat &recallCounter,Float &rejectionPrecisionCounter,Float &rejectionRecallCounter,
VectorFloat &confusionMatrixCounter);
1198 bool computeTestMetrics(
VectorFloat &precisionCounter,
VectorFloat &recallCounter,Float &rejectionPrecisionCounter,Float &rejectionRecallCounter,
VectorFloat &confusionMatrixCounter,
const UINT numTestSamples);
1203 UINT inputVectorDimensions;
1204 UINT outputVectorDimensions;
1205 UINT predictedClassLabel;
1206 UINT predictedClusterLabel;
1208 UINT predictionModuleIndex;
1209 UINT numTrainingSamples;
1210 UINT numTestSamples;
1213 Float testSquaredError;
1220 Float testRejectionPrecision;
1221 Float testRejectionRecall;
1234 enum PipelineModes{PIPELINE_MODE_NOT_SET=0,CLASSIFICATION_MODE,REGRESSION_MODE,CLUSTER_MODE};
1239 #endif //GRT_GESTURE_RECOGNITION_PIPELINE_HEADER
bool removePostProcessingModule(const UINT moduleIndex)
Float getTrainingSSError() const
UINT getOutputVectorDimensionsSize() const
UINT getNumPreProcessingModules() const
VectorFloat getNullRejectionThresholds() const
bool removeAllContextModules()
GestureRecognitionPipeline & operator<<(const PreProcessing &module)
This is the main base class that all GRT Clustering algorithms should inherit from.
bool getIsPipelineInClassificationMode() const
VectorFloat getClassDistances() const
bool train(const ClassificationData &trainingData)
Float getTestRMSError() const
TestResult getTestResults() const
bool getIsPipelineModeSet() const
bool getIsPipelineInRegressionMode() const
MatrixFloat getTestConfusionMatrix() const
UINT getNumPostProcessingModules() const
bool removeContextModule(const UINT contextLevel, const UINT moduleIndex)
std::string getClassifierType() const
Float getMaximumLikelihood() const
Float getTestTime() const
std::string getClustererType() const
VectorFloat getPreProcessedData() const
Float getTestRejectionRecall() const
Float getTestAccuracy() const
bool removeAllFeatureExtractionModules()
bool addContextModule(const Context &contextModule, UINT contextLevel, UINT insertIndex=INSERT_AT_END_INDEX)
bool preProcessData(VectorFloat inputVector, bool computeFeatures=true)
Float getCrossValidationAccuracy() const
UINT getInputVectorDimensionsSize() const
bool setRegressifier(const Regressifier ®ressifier)
UINT getPredictionModuleIndexPosition() const
T * getPreProcessingModule(const UINT moduleIndex) const
Classifier * getClassifier() const
bool removeFeatureExtractionModule(UINT moduleIndex)
bool removeAllPreProcessingModules()
bool setClassifier(const Classifier &classifier)
unsigned int getSize() const
Vector< TestInstanceResult > getTestInstanceResults() const
UINT getNumTrainingSamples() const
std::string getPipelineModeAsString() const
Clusterer * getClusterer() const
bool getIsPreProcessingSet() const
bool getIsClustererSet() const
bool predict(const VectorFloat &inputVector)
bool load(const std::string &filename)
UINT getUnProcessedPredictedClassLabel() const
UINT getNumClassesInModel() const
bool addPreProcessingModule(const PreProcessing &preProcessingModule, UINT insertIndex=INSERT_AT_END_INDEX)
bool setClusterer(const Clusterer &clusterer)
std::string getRegressifierType() const
GestureRecognitionPipeline & operator=(const GestureRecognitionPipeline &rhs)
Float getTrainingRMSError() const
bool savePipelineToFile(const std::string &filename) const
UINT getPipelineModeFromString(std::string pipelineMode) const
bool getIsFeatureExtractionSet() const
UINT getNumTestSamples() const
bool save(const std::string &filename) const
T * getFeatureExtractionModule(const UINT moduleIndex) const
bool getIsContextSet() const
bool getIsClassifierSet() const
Context * getContextModule(const UINT contextLevel, const UINT moduleIndex) const
bool removeAllPostProcessingModules()
bool setFeatureExtractionModule(const FeatureExtraction &featureExtractionModule)
This is the main base class that all GRT Classification algorithms should inherit from...
bool addFeatureExtractionModule(const FeatureExtraction &featureExtractionModule, UINT insertIndex=INSERT_AT_END_INDEX)
bool loadPipelineFromFile(const std::string &filename)
This is the main base class that all GRT PostProcessing algorithms should inherit from...
UINT getNumClasses() const
Vector< TestResult > getCrossValidationResults() const
FeatureExtraction * getFeatureExtractionModule(const UINT moduleIndex) const
bool getIsPostProcessingSet() const
bool setInfo(const std::string &info)
bool map(const VectorFloat &inputVector)
VectorFloat getClassLikelihoods() const
virtual ~GestureRecognitionPipeline(void)
bool addPostProcessingModule(const PostProcessing &postProcessingModule, UINT insertIndex=INSERT_AT_END_INDEX)
bool removePreProcessingModule(UINT moduleIndex)
UINT getPredictedClassLabel() const
bool updateContextModule(bool value, UINT contextLevel=0, UINT moduleIndex=0)
bool setPostProcessingModule(const PostProcessing &postProcessingModule)
Vector< UINT > getClassLabels() const
VectorFloat getRegressionData() const
T * getClassifier() const
PostProcessing * getPostProcessingModule(UINT moduleIndex) const
#define INSERT_AT_END_INDEX
VectorFloat getTestFMeasure() const
Float getTestRejectionPrecision() const
PreProcessing * getPreProcessingModule(const UINT moduleIndex) const
This is the main base class that all GRT PreProcessing algorithms should inherit from.
VectorFloat getUnProcessedRegressionData() const
UINT getNumFeatureExtractionModules() const
Regressifier * getRegressifier() const
VectorFloat getTestRecall() const
bool removeRegressifier()
bool test(const ClassificationData &testData)
Float getTestSSError() const
GRT_DEPRECATED_MSG("use clear() instead.", bool clearAll())
GestureRecognitionPipeline(void)
std::string getModelAsString() const
T * getContextModule(const UINT contextLevel, const UINT moduleIndex) const
T * getPostProcessingModule(const UINT moduleIndex) const
bool getIsRegressifierSet() const
bool setPreProcessingModule(const PreProcessing &preProcessingModule)
VectorFloat getTestPrecision() const
bool getIsInitialized() const
Float getTrainingTime() const
VectorFloat getFeatureExtractionData() const
This is the main base class that all GRT Feature Extraction algorithms should inherit from...
This is the main base class that all GRT Regression algorithms should inherit from.
T * getRegressifier() const