forked from lehaifeng/T-GCN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
visualization.py
68 lines (61 loc) · 2.09 KB
/
visualization.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
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
def plot_result(test_result,test_label1,path):
##all test result visualization
fig1 = plt.figure(figsize=(7,1.5))
# ax1 = fig1.add_subplot(1,1,1)
a_pred = test_result[:,0]
a_true = test_label1[:,0]
plt.plot(a_pred,'r-',label='prediction')
plt.plot(a_true,'b-',label='true')
plt.legend(loc='best',fontsize=10)
plt.savefig(path+'/test_all.jpg')
plt.show()
## oneday test result visualization
fig1 = plt.figure(figsize=(7,1.5))
# ax1 = fig1.add_subplot(1,1,1)
a_pred = test_result[0:96,0]
a_true = test_label1[0:96,0]
plt.plot(a_pred,'r-',label="prediction")
plt.plot(a_true,'b-',label="true")
plt.legend(loc='best',fontsize=10)
plt.savefig(path+'/test_oneday.jpg')
plt.show()
def plot_error(train_rmse,train_loss,test_rmse,test_acc,test_mae,path):
###train_rmse & test_rmse
fig1 = plt.figure(figsize=(5,3))
plt.plot(train_rmse, 'r-', label="train_rmse")
plt.plot(test_rmse, 'b-', label="test_rmse")
plt.legend(loc='best',fontsize=10)
plt.savefig(path+'/rmse.jpg')
plt.show()
#### train_loss & train_rmse
fig1 = plt.figure(figsize=(5,3))
plt.plot(train_loss,'b-', label='train_loss')
plt.legend(loc='best',fontsize=10)
plt.savefig(path+'/train_loss.jpg')
plt.show()
fig1 = plt.figure(figsize=(5,3))
plt.plot(train_rmse,'b-', label='train_rmse')
plt.legend(loc='best',fontsize=10)
plt.savefig(path+'/train_rmse.jpg')
plt.show()
### accuracy
fig1 = plt.figure(figsize=(5,3))
plt.plot(test_acc, 'b-', label="test_acc")
plt.legend(loc='best',fontsize=10)
plt.savefig(path+'/test_acc.jpg')
plt.show()
### rmse
fig1 = plt.figure(figsize=(5,3))
plt.plot(test_rmse, 'b-', label="test_rmse")
plt.legend(loc='best',fontsize=10)
plt.savefig(path+'/test_rmse.jpg')
plt.show()
### mae
fig1 = plt.figure(figsize=(5,3))
plt.plot(test_mae, 'b-', label="test_mae")
plt.legend(loc='best',fontsize=10)
plt.savefig(path+'/test_mae.jpg')
plt.show()