-
-
Save Karts27/de62a58e57d493d8a0ceb37e8939f317 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Function to plot "accuracy vs epoch" graphs and "loss vs epoch" graphs for training and validation data | |
def plot_metrics(model_name, metric = 'accuracy'): | |
if metric == 'loss': | |
plt.title("Loss Values") | |
plt.plot(model_name.history['loss'], label = 'train') | |
plt.plot(model_name.history['val_loss'], label = 'test') | |
plt.legend() | |
plt.show() | |
else: | |
plt.title("Accuracy Values") | |
plt.plot(model_name.history['accuracy'], label='train') | |
plt.plot(model_name.history['val_accuracy'], label='test') | |
plt.legend() | |
plt.show() | |
plot_metrics(history, 'accuracy') | |
plot_metrics(history, 'loss') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment