Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

plot.py 752 B

You have to be logged in to leave a comment. Sign In
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
  1. import matplotlib.pyplot as plt
  2. import pickle
  3. import conf
  4. import os
  5. with open(os.path.join(conf.data_dir, 'history.p'), 'rb') as fd:
  6. hist = pickle.load(fd)
  7. acc = hist['acc']
  8. val_acc = hist['val_acc']
  9. loss = hist['loss']
  10. val_loss = hist['val_loss']
  11. epochs = range(len(acc))
  12. plt.plot(epochs, acc, 'bo', label='Training acc')
  13. plt.plot(epochs, val_acc, 'b', label='Validation acc')
  14. plt.title('Training and validation accuracy')
  15. plt.legend()
  16. plt.savefig(os.path.join(conf.data_dir, 'plot_acc.jpeg'))
  17. plt.close()
  18. plt.plot(epochs, loss, 'bo', label='Training loss')
  19. plt.plot(epochs, val_loss, 'b', label='Validation loss')
  20. plt.title('Training and validation loss')
  21. plt.legend()
  22. plt.savefig(os.path.join(conf.data_dir, 'plot_loss.jpeg'))
  23. plt.close()
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...