-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcommon_visualization.py
More file actions
32 lines (26 loc) · 886 Bytes
/
common_visualization.py
File metadata and controls
32 lines (26 loc) · 886 Bytes
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
import matplotlib.pyplot as plt
plt.style.use('ggplot')
def plot_history(history, x_size, y_size):
print(history.keys())
# Prepare plotting
plt.rcParams["figure.figsize"] = [x_size, y_size]
fig, axes = plt.subplots(nrows=4, ncols=4, sharex=True)
# summarize history for MAE
plt.subplot(211)
plt.plot(history['mean_absolute_error'])
plt.plot(history['val_mean_absolute_error'])
plt.title('Training vs Validation MAE')
plt.ylabel('MAE')
plt.xlabel('Epoch')
plt.legend(['Train', 'Validation'], loc='upper left')
# summarize history for loss
plt.subplot(212)
plt.plot(history['loss'])
plt.plot(history['val_loss'])
plt.title('Training vs Validation Loss')
plt.ylabel('Loss')
plt.xlabel('Epoch')
plt.legend(['Train', 'Validation'], loc='upper left')
# Plot the results
plt.draw()
plt.show()