| import matplotlib.pyplot as plt | |
| epochs = list(range(1, 21)) | |
| train_losses = [1.3119755745442077, 0.9600333069366488, 0.8390481574460864, 0.7701934007504447, 0.717232290782373, 0.6732362943955443, 0.640223667872223, 0.6034004604443908, 0.5805023299868811, 0.5493806966749782, 0.5178858606483449, 0.500999446132813, 0.4832796, 0.460667, 0.47479944, 0.42715, 0.41295, 0.39818,0.387744, 0.383766] | |
| train_accuracies = [53.27, 66.35, 71.0, 73.23, 74.88, 76.48, 77.46, 79.1, 79.7, 80.81, 81.81, 82.51, 83.02, 83.99, 83.45, 85.1, 85.44, 86.01, 86.52, 86.57] | |
| val_losses = [1.0182, 0.8836, 0.8109, 0.775, 0.7249, 0.7244, 0.7125, 0.6808, 0.6616, 0.6461, 0.6628, 0.622, 0.6296, 0.6310, 0.6382, 0.6436, 0.6271, 0.7244, 0.7164, 0.6104] | |
| val_accuracies = [63, 68, 71, 73, 75, 74, 75, 76, 77, 77, 76, 79, 78,77, 79, 78, 79, 78,77, 79] | |
| plt.figure(figsize=(10, 5)) | |
| plt.subplot(1, 2, 1) | |
| plt.plot(epochs, train_losses, label='Training Loss') | |
| plt.plot(epochs, val_losses, label='Validation Loss') | |
| plt.title('Training and Validation Loss') | |
| plt.xlabel('Epoch') | |
| plt.ylabel('Loss') | |
| plt.legend() | |
| plt.subplot(1, 2, 2) | |
| plt.plot(epochs, train_accuracies, label='Training Accuracy') | |
| plt.plot(epochs, val_accuracies, label='Validation Accuracy') | |
| plt.title('Training and Validation Accuracy') | |
| plt.xlabel('Epoch') | |
| plt.ylabel('Accuracy') | |
| plt.legend() | |
| plt.tight_layout() | |
| plt.show() | |