-
Notifications
You must be signed in to change notification settings - Fork 1
/
plots.py
71 lines (57 loc) · 3.76 KB
/
plots.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
import pandas as pd
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings("ignore")
folder = 'results/'
# file_hdcc = folder + 'opengpu_num_threads_20_vector_size_hdcc_08_01_2023_00:03:30'
file_hdcc = folder + 'pi_num_threads_4_vector_size_hdcc_03_02_2023_16:19:00'
file_torchhd = folder + 'rasp_torchhd_11_02_2023_15:44:11'
file_torchhd_opengpu = folder + 'opengpu_torchhd_22_01_2023_09:42:05'
file_hdcc_opengpu = folder + 'opengpu_num_threads_20_vector_size_hdcc_23_01_2023_16:18:55'
file_hdcc_openlab = folder + 'openlab_num_threads_20_vector_size_hdcc_24_01_2023_08:50:02'
file_torchhd_openlab = folder + 'openlab_torchhd_21_01_2023_11:05:57'
file_hdcc_ubuntu = folder + 'ubuntu_num_threads_4_vector_size_hdcc_24_01_2023_01:25:49'
file_torchhd_ubuntu = folder + 'ubuntu_torchhd_21_01_2023_20:13:18'
# file_torchhd = folder + 'opengpu_torchhd_08_01_2023_07:21:50'
machines_names = ['ARM','Intel1','Intel2','Intel3']
dataset_hdcc = [pd.read_csv(file_hdcc), pd.read_csv(file_hdcc_openlab), pd.read_csv(file_hdcc_opengpu), pd.read_csv(file_hdcc_ubuntu)]
dataset_torchhd = [pd.read_csv(file_torchhd), pd.read_csv(file_torchhd_openlab), pd.read_csv(file_torchhd_opengpu), pd.read_csv(file_torchhd_ubuntu)]
first = True
machines = 1
names = ['Isolet','Mnist','Emg','Lang recognition']
fig, axs = plt.subplots(3, 4)
key = ['voicehd','mnist','emgppp','languages']
for j in range(len(key)):
for i in range(machines):
time_hdc = dataset_hdcc[i][:][dataset_hdcc[i].Application == key[j]][["Dimensions", "Application", "Time"]].groupby('Dimensions').mean().reset_index()
time_hdc['Tool'] = 'HDCC'
time_torchhd = dataset_torchhd[i][:][dataset_torchhd[i].Application == key[j]][["Dimensions", "Application", "Time"]].groupby('Dimensions').mean().reset_index()
time_torchhd['Tool'] = 'TORCHHD'
accuracy_hdc = dataset_hdcc[i][:][dataset_hdcc[i].Application == key[j]][["Dimensions", "Application", "Accuracy"]].groupby('Dimensions').mean().reset_index()
accuracy_hdc['Tool'] = 'HDCC'
accuracy_torchhd = dataset_torchhd[i][:][dataset_torchhd[i].Application == key[j]][
["Dimensions", "Application", "Accuracy"]].groupby('Dimensions').mean().reset_index()
accuracy_torchhd['Tool'] = 'TORCHHD'
memory_hdc = dataset_hdcc[i][:][dataset_hdcc[i].Application == key[j]][["Dimensions", "Application", "Memory"]].groupby('Dimensions').mean().reset_index()
memory_hdc['Tool'] = 'HDCC'
memory_torchhd = dataset_torchhd[i][:][dataset_torchhd[i].Application == key[j]][
["Dimensions", "Application", "Memory"]].groupby('Dimensions').mean().reset_index()
memory_torchhd['Tool'] = 'TORCHHD'
# axs[1,i].set_ylim(ymin=0.6)
axs[0, j].plot(time_hdc['Dimensions'], time_hdc['Time'], label='HDCC '+machines_names[i])
axs[0, j].plot(time_torchhd['Dimensions'], time_torchhd['Time'], label='TorchHD '+machines_names[i])
axs[1, j].plot(accuracy_hdc['Dimensions'], accuracy_hdc['Accuracy'], label='HDCC '+machines_names[i])
axs[1, j].plot(accuracy_torchhd['Dimensions'], accuracy_torchhd['Accuracy'], label='TorchHD '+machines_names[i])
axs[2, j].plot(memory_hdc['Dimensions'], memory_hdc['Memory'], label='HDCC '+machines_names[i])
axs[2, j].plot(memory_torchhd['Dimensions'], memory_torchhd['Memory'], label='TorchHD '+machines_names[i])
axs[0, j].set_title(label=names[j]+'\n\nTime')
axs[0, j].set_xlabel('Dimensions')
axs[0, j].set_ylabel('Time (s)')
axs[1, j].set_title(label='Accuracy')
axs[1, j].set_xlabel('Dimensions')
axs[1, j].set_ylabel('Accuracy')
axs[2, j].set_title(label='Peak memory')
axs[2, j].set_xlabel('Dimensions')
axs[2, j].set_ylabel('Memory (bytes)')
plt.legend(loc='center left', bbox_to_anchor=(1, 0.5))
plt.show()