26 #ifndef GRT_DTW_HEADER 27 #define GRT_DTW_HEADER 29 #include "../../CoreModules/Classifier.h" 30 #include "../../Util/TimeSeriesClassificationSampleTrimmer.h" 46 this->dist = rhs.dist;
63 averageTemplateLength=0;
71 UINT averageTemplateLength;
95 enum DistanceMethods{ABSOLUTE_DIST=0,EUCLIDEAN_DIST,NORM_ABSOLUTE_DIST};
96 enum RejectionModes{TEMPLATE_THRESHOLDS=0,CLASS_LIKELIHOODS,THRESHOLDS_AND_LIKELIHOODS};
112 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);
134 DTW& operator=(
const DTW &rhs);
177 virtual bool reset();
185 virtual bool clear();
194 virtual bool save( std::fstream &file )
const;
203 virtual bool load( std::fstream &file );
226 bool setRejectionMode(UINT rejectionMode);
233 bool setNullRejectionThreshold(Float nullRejectionLikelihoodThreshold);
243 bool setOffsetTimeseriesUsingFirstSample(
bool offsetUsingFirstSample);
251 bool setContrainWarpingPath(
bool constrain);
261 bool setWarpingRadius(Float radius);
277 bool enableZNormalization(
bool useZNormalization,
bool constrainZNorm =
true);
295 bool enableTrimTrainingData(
bool trimTrainingData,Float trimThreshold,Float maximumTrimPercentage);
337 static std::string
getId();
351 Float d(
int m,
int n,
MatrixFloat &distanceMatrix,
const int M,
const int N);
352 Float
inline MIN_(Float a,Float b, Float c);
362 bool loadLegacyModelFromFile( std::fstream &file );
373 bool useZNormalisation;
374 bool offsetUsingFirstSample;
376 bool constrainWarpingPath;
377 bool trimTrainingData;
379 Float zNormConstrainThreshold;
382 Float maximumTrimPercentage;
383 Float nullRejectionLikelihoodThreshold;
385 UINT smoothingFactor;
387 UINT averageTemplateLength;
391 static const std::string id;
396 #endif //GRT_DTW_HEADER UINT getRejectionMode() const
std::string getId() const
UINT getNumTemplates() const
virtual bool recomputeNullRejectionThresholds()
virtual bool predict_(VectorFloat &inputVector)
Vector< VectorFloat > getInputDataBuffer() const
Vector< DTWTemplate > getModels() const
virtual bool save(const std::string &filename) const
const Vector< MatrixFloat > & getDistanceMatrices() const
virtual bool deepCopyFrom(const Classifier *classifier)
virtual bool train_(ClassificationData &trainingData)
const Vector< Vector< IndexDist > > & getWarpingPaths() const
virtual bool load(const std::string &filename)
This is the main base class that all GRT Classification algorithms should inherit from...