-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotChart.py
More file actions
22 lines (21 loc) · 723 Bytes
/
plotChart.py
File metadata and controls
22 lines (21 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import matplotlib.pyplot as plt
def PlotHistory(H):
try:
acc = H.history['acc']
N = range(1, len(acc) + 1)
plt.style.use("ggplot")
plt.figure()
plt.plot(N, H.history["loss"], label="train_loss")
plt.plot(N, H.history["val_loss"], label="val_loss")
plt.plot(N, H.history["acc"], label="train_acc")
plt.plot(N, H.history["val_acc"], label="val_acc")
plt.title("Training Loss and Accuracy (Simple NN)")
plt.xlabel("Epoch #")
plt.ylabel("Loss/Accuracy")
plt.legend()
plt.savefig("data/train_chart_loss_acc.png")
return 0
except Exception, e:
print 'Error gen plot!'
print e
return 0