-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviz.py
39 lines (31 loc) · 912 Bytes
/
viz.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
import numpy as np
import matplotlib.pyplot as plt
import pickle
from plot_cm import plot_confusion_matrix
from options import *
activities = [
"A-Checking",
"A-Moving",
"A-Preparing",
"A-Sitting",
"A-Standing",
"A-Taking-Dropping",
"A-Transporting",
"C-Compacting",
"C-Leveling",
"C-Placing",
"C-Transporting",
"F-Machining",
"F-Placing-Fixing",
"F-Transporting",
"R-Machining",
"R-Placing-Fixing",
"R-Transporting"
]
cf = pickle.load(open(os.path.join(param_fdp_results, "results_{}_{}_cm.p".format(8, 0)), "rb"))
# Plot normalized confusion matrix
plt.figure(figsize=(8, 6))
plot_confusion_matrix(cf, classes=range(1, len(activities) + 1), normalize=True,
title='Normalized confusion matrix, average accuracy: 98.77%')
# plt.show()
plt.gcf().savefig('confusion.png', dpi=300, bbox_inches='tight', pad_inches=0)