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);
131 DTW& operator=(
const DTW &rhs);
174 virtual bool reset();
182 virtual bool clear();
191 virtual bool save( std::fstream &file )
const;
200 virtual bool load( std::fstream &file );
223 bool setRejectionMode(UINT rejectionMode);
230 bool setNullRejectionThreshold(Float nullRejectionLikelihoodThreshold);
240 bool setOffsetTimeseriesUsingFirstSample(
bool offsetUsingFirstSample);
248 bool setContrainWarpingPath(
bool constrain);
258 bool setWarpingRadius(Float radius);
274 bool enableZNormalization(
bool useZNormalization,
bool constrainZNorm =
true);
292 bool enableTrimTrainingData(
bool trimTrainingData,Float trimThreshold,Float maximumTrimPercentage);
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
UINT getRejectionMode() const
UINT getNumTemplates() const
virtual bool recomputeNullRejectionThresholds()
virtual bool predict_(VectorFloat &inputVector)
Vector< VectorFloat > getInputDataBuffer() const
Vector< DTWTemplate > getModels() const
const Vector< MatrixFloat > & getDistanceMatrices() const
virtual bool save(const std::string filename) const
virtual bool load(const std::string filename)
virtual bool deepCopyFrom(const Classifier *classifier)
virtual bool train_(ClassificationData &trainingData)
const Vector< Vector< IndexDist > > & getWarpingPaths() const