|
a |
|
b/Results.py |
|
|
1 |
import scipy.io as sio |
|
|
2 |
import matplotlib.pyplot as plt |
|
|
3 |
|
|
|
4 |
import os |
|
|
5 |
import glob |
|
|
6 |
|
|
|
7 |
import numpy as np |
|
|
8 |
|
|
|
9 |
Patient_id = np.unique(sio.loadmat("Sample Data/trials_subNums.mat")['subjectNum'][0]) #corresponding to the patient id |
|
|
10 |
dir = "Results/" |
|
|
11 |
models = ["Basic", "LSTM", "MaxCNN", "Mix", "TempCNN"] |
|
|
12 |
|
|
|
13 |
Results = np.zeros((len(Patient_id), len(models),20)) |
|
|
14 |
|
|
|
15 |
inc = 0 |
|
|
16 |
for model in models: |
|
|
17 |
inc_patient = 0 |
|
|
18 |
for patient in Patient_id: |
|
|
19 |
doc = glob.glob(dir+"*"+model+"*"+"t"+str(patient)+".mat")[0] |
|
|
20 |
file = sio.loadmat(doc)['res'] |
|
|
21 |
Results[inc_patient,inc, :] = file[:,3] |
|
|
22 |
inc_patient += 1 |
|
|
23 |
inc += 1 |
|
|
24 |
|
|
|
25 |
fig = plt.figure() |
|
|
26 |
|
|
|
27 |
for i in range(len(models)): |
|
|
28 |
a = 5 |
|
|
29 |
plt.plot(np.max(Results[:,i,:],axis=1), '.-', label = models[i]) |
|
|
30 |
|
|
|
31 |
plt.legend() |
|
|
32 |
#plt.boxplot(Results[:,0,:]) |
|
|
33 |
#plt.boxplot(Results[:,1,:]) |
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
lstm = sio.loadmat("Results/result_LSTM.mat")['vacc'] |
|
|
38 |
plt.plot(np.mean(lstm, axis=0)) |
|
|
39 |
|
|
|
40 |
|
|
|
41 |
plt.show() |