RapidLib  v2.2.0
A simple library for interactive machine learning
dtw.h
Go to the documentation of this file.
1 
10 #ifndef DTW_H
11 #define DTW_H
12 
13 #include <vector>
14 #include "warpPath.h"
15 #include "searchWindow.h"
16 
17 template<typename T>
18 class dtw
19 {
20 public:
21  dtw();
22  ~dtw();
23 
24  /* Calculates and returns a simple cost value between two input series */
25  T getCost(const std::vector<std::vector<T>> &seriesX, const std::vector<std::vector<T > > &seriesY);
26 
27  /* Calculates both cost and the warp path */
28  warpInfo<T> dynamicTimeWarp(const std::vector<std::vector<T> > &seriesX, const std::vector<std::vector<T> > &seriesY); //This returns everything, including a path
29 
30  /* Calculates both the cost and the warp path, with a given window as a constraint */
31  warpInfo<T> constrainedDTW(const std::vector<std::vector<T> > &seriesX, const std::vector<std::vector<T> > &seriesY, searchWindow<T> window); //This takes a window object
32 
33 private:
34  inline T distanceFunction(const std::vector<T> &pointX, const std::vector<T> &point);
35  std::vector<std::vector<T> > costMatrix;
36  warpPath calculatePath(std::size_t seriesXsize, std::size_t seriesYsize) const;
37 };
38 
39 #endif
Definition: dtw.h:19
warpInfo< T > dynamicTimeWarp(const std::vector< std::vector< T > > &seriesX, const std::vector< std::vector< T > > &seriesY)
Definition: dtw.cpp:118
dtw()
Definition: dtw.cpp:17
~dtw()
Definition: dtw.cpp:20
warpInfo< T > constrainedDTW(const std::vector< std::vector< T > > &seriesX, const std::vector< std::vector< T > > &seriesY, searchWindow< T > window)
Definition: dtw.cpp:129
T getCost(const std::vector< std::vector< T >> &seriesX, const std::vector< std::vector< T > > &seriesY)
Definition: dtw.cpp:44
Definition: searchWindow.h:20
Definition: warpPath.h:16
Definition: warpPath.h:33