43 #ifndef GRT_DTW_HEADER
44 #define GRT_DTW_HEADER
46 #include "../../CoreModules/Classifier.h"
47 #include "../../Util/TimeSeriesClassificationSampleTrimmer.h"
63 this->dist = rhs.dist;
80 averageTemplateLength=0;
88 UINT averageTemplateLength;
109 DTW(
bool useScaling=
false,
bool useNullRejection=
false,Float nullRejectionCoeff=3.0,UINT rejectionMode = DTW::TEMPLATE_THRESHOLDS,
bool dtwConstrain=
true,Float radius=0.2,
bool offsetUsingFirstSample=
false,
bool useSmoothing =
false,UINT smoothingFactor = 5, Float nullRejectionLikelihoodThreshold = 0.99);
174 virtual bool reset();
182 virtual bool clear();
341 Float d(
int m,
int n,
MatrixFloat &distanceMatrix,
const int M,
const int N);
342 Float
inline MIN_(Float a,Float b, Float c);
356 bool loadLegacyModelFromFile( std::fstream &file );
367 bool useZNormalisation;
368 bool offsetUsingFirstSample;
370 bool constrainWarpingPath;
371 bool trimTrainingData;
373 Float zNormConstrainThreshold;
376 Float maximumTrimPercentage;
377 Float nullRejectionLikelihoodThreshold;
379 UINT smoothingFactor;
381 UINT averageTemplateLength;
384 enum DistanceMethods{ABSOLUTE_DIST=0,EUCLIDEAN_DIST,NORM_ABSOLUTE_DIST};
385 enum RejectionModes{TEMPLATE_THRESHOLDS=0,CLASS_LIKELIHOODS,THRESHOLDS_AND_LIKELIHOODS};
391 #endif //GRT_DTW_HEADER
virtual bool predict_(VectorFloat &inputVector)
UINT getRejectionMode() const
virtual bool predict(VectorFloat inputVector)
virtual bool loadModelFromFile(std::fstream &file)
bool setRejectionMode(UINT rejectionMode)
Vector< VectorFloat > getInputDataBuffer() const
virtual bool train_(TimeSeriesClassificationData &trainingData)
bool enableTrimTrainingData(bool trimTrainingData, Float trimThreshold, Float maximumTrimPercentage)
virtual bool train(ClassificationData trainingData)
Vector< DTWTemplate > getModels()
bool setContrainWarpingPath(bool constrain)
bool enableZNormalization(bool useZNormalization, bool constrainZNorm=true)
bool setWarpingRadius(Float radius)
DTW & operator=(const DTW &rhs)
const Vector< MatrixFloat > & getDistanceMatrices() const
bool setModels(Vector< DTWTemplate > newTemplates)
virtual bool saveModelToFile(std::string filename) const
bool setNullRejectionThreshold(Float nullRejectionLikelihoodThreshold)
virtual bool loadModelFromFile(std::string filename)
virtual bool recomputeNullRejectionThresholds()
DTW(bool useScaling=false, bool useNullRejection=false, Float nullRejectionCoeff=3.0, UINT rejectionMode=DTW::TEMPLATE_THRESHOLDS, bool dtwConstrain=true, Float radius=0.2, bool offsetUsingFirstSample=false, bool useSmoothing=false, UINT smoothingFactor=5, Float nullRejectionLikelihoodThreshold=0.99)
virtual bool deepCopyFrom(const Classifier *classifier)
bool setOffsetTimeseriesUsingFirstSample(bool offsetUsingFirstSample)
const Vector< Vector< IndexDist > > & getWarpingPaths() const
Vector< T > getData(const bool rawBuffer=false) const
virtual bool saveModelToFile(std::fstream &file) const