Esempio n. 1
0
def draw_example():
    plt.figure()
    seqA = [0, 0, 0, 3, 6, 13, 25, 22, 7, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    seqB = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 12, 24, 23, 8 ,3, 1, 0, 0, 0, 0, 0]
    from featureEncoding import dynamicTimeWarp
    cmap = plt.cm.Blues
    cost = dynamicTimeWarp(seqA,seqB)
    plt.imshow(cost, interpolation='nearest', cmap=cmap)
    plt.colorbar()
    plt.tight_layout()
    plt.show()
Esempio n. 2
0
def draw_cross_similarity():
    sensor_data = data = np.genfromtxt('./ICS_slipperData/Alice0105db.csv', dtype=float, delimiter=',', names=True)
    from featureEncoding import dynamicTimeWarp
    cost = dynamicTimeWarp(sensor_data['Axis1'],sensor_data['Axis1'])
    plt.figure()
    title = 'Cross Similarity'
    cmap = plt.cm.Blues
    plt.imshow(cost, interpolation='nearest', cmap=cmap)
    plt.title(title)
    plt.colorbar()
    #plt.xticks(np.arange(len(label_names)), label_names, rotation=45)
    #plt.yticks(np.arange(len(label_names)), label_names)
    plt.tight_layout()
    plt.ylabel('True label')
    plt.xlabel('Predicted label')
    plt.show()