-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaccuracy-visualize.py
97 lines (62 loc) · 3.15 KB
/
accuracy-visualize.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pickle
import os
directory = os.getcwd()
gin_directory = directory + "\output\GIN_accuracy.txt"
mlstm_fcn_directory = directory + "\output\MLSTM_FCN_accuracy.txt"
inception_directory = directory + "\output\InceptionTime_accuracy.txt"
lstm_fcn_directory = directory + "\output\LSTM_FCN_accuracy.txt"
fcn_directory = directory + "\output\FCN_accuracy.txt"
lstm_directory = directory + "\output\LSTM_accuracy.txt"
tcn_directory = directory + "\output\TCN_accuracy.txt"
mlp_directory = directory + "\output\MLP_accuracy.txt"
mWDN_directory = directory + "\output\mWDN_accuracy.txt"
XCM_directory = directory + "\output\XCM_accuracy.txt"
with open(gin_directory, "rb") as fp: # Unpickling
acc_array_gin = pickle.load(fp)
with open(mlstm_fcn_directory, "rb") as fp: # Unpickling
acc_array_mlstm_fcn = pickle.load(fp)
with open(inception_directory, "rb") as fp: # Unpickling
acc_array_inception = pickle.load(fp)
with open(lstm_directory, "rb") as fp: # Unpickling
acc_array_lstm = pickle.load(fp)
with open(tcn_directory, "rb") as fp: # Unpickling
acc_array_tcn = pickle.load(fp)
with open(mWDN_directory, "rb") as fp: # Unpickling
acc_array_mWDN = pickle.load(fp)
with open(XCM_directory, "rb") as fp: # Unpickling
acc_array_XCM = pickle.load(fp)
with open(fcn_directory, "rb") as fp: # Unpickling
acc_array_fcn = pickle.load(fp)
with open(mlp_directory, "rb") as fp: # Unpickling
acc_array_mlp = pickle.load(fp)
with open(lstm_fcn_directory, "rb") as fp: # Unpickling
acc_array_lstm_fcn = pickle.load(fp)
acc_arr_inception = np.array(acc_array_inception)[:,2]
acc_arr_mlstm_fcn = np.array(acc_array_mlstm_fcn)[:,2]
acc_arr_gin = np.array(acc_array_gin)[:,2]
acc_arr_lstm = np.array(acc_array_lstm)[:,2]
acc_arr_lstm_fcn = np.array(acc_array_lstm_fcn)[:,2]
acc_arr_mlp = np.array(acc_array_mlp)[:,2]
acc_arr_XCM = np.array(acc_array_XCM)[:,2]
acc_arr_mWDN = np.array(acc_array_mWDN)[:,2]
acc_arr_fcn = np.array(acc_array_fcn)[:,2]
acc_arr_tcn = np.array(acc_array_tcn)[:,2]
print(acc_arr_inception.shape, acc_arr_fcn.shape, acc_arr_tcn.shape, acc_arr_lstm.shape, acc_arr_XCM.shape, acc_arr_mWDN.shape, acc_arr_mlp.shape, acc_arr_gin.shape)
accuracies = np.stack((acc_arr_gin, acc_arr_inception, acc_arr_mlstm_fcn, acc_arr_lstm, acc_arr_lstm_fcn, acc_arr_mlp, acc_arr_XCM, acc_arr_mWDN, acc_arr_fcn, acc_arr_tcn), axis=1)
df = pd.DataFrame(accuracies, columns = ['VisGIN', 'InceptionTime', 'MLSTM-FCN', 'LSTM', 'LSTM-FCN', 'MLP', 'XCM', 'mWDN', 'FCN', 'TCN'])
columns = ['VisGIN', 'InceptionTime', 'MLSTM-FCN', 'LSTM', 'LSTM-FCN', 'MLP', 'XCM', 'mWDN', 'FCN', 'TCN']
df[columns] = df[columns].apply(lambda x: x*100)
print(df)
print(type(df))
_, ax = plt.subplots(figsize=(8,6))
figure = sns.kdeplot(ax=ax, data=df)
figure.set(xlim=(95, 100))
figure.set_ylabel("Density",fontsize=14)
sns.move_legend(ax, "center left", fontsize='x-large', title_fontsize='20')
plt.xlabel('Accuracy (%)', fontsize=14)
plt.savefig('3pulse_acc_denst.jpg', dpi=500)
plt.show()