import sys
import collections
import itertools
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import mode

from classes import *

plt.style.use('bmh')



'''
Measuring the DTW distance
'''

time = np.linspace(0, 20, 1000)
amplitude_a = 5*np.sin(time)
amplitude_b = 3*np.sin(time + 1)

m = knn_dtw.KnnDtw()

distance = m._dtw_distance(amplitude_a, amplitude_b)

fig = plt.figure(figsize=(12, 4))
_ = plt.plot(time, amplitude_a, label='A')
_ = plt.plot(time, amplitude_b, label='B')
_ = plt.title('DTW distance between A and B is %.2f' % distance)
_ = plt.ylabel('Amplitude')
_ = plt.xlabel('Time')
_ = plt.legend()

m._dist_matrix(np.random.random((4, 50)), np.random.random((4, 50)))






