Skip to content
Snippets Groups Projects
Select Git revision
  • f2ef17d6f66f80162beca16247be4a85f553aa65
  • main default protected
2 results

plots.py

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    plots.py 710 B
    import matplotlib.pyplot as plt
    
    def plot_accuracy(name, history, ylim=[0,1.01]):
        plt.plot(history.history['accuracy'])
        plt.plot(history.history['val_accuracy'])
        plt.title('model accuracy')
        plt.ylabel('accuracy')
        plt.xlabel('epoch')
        plt.ylim(ylim[0], ylim[1])
        plt.legend(['training', 'validation'], loc='upper left')
        plt.savefig(name)
        plt.show()
    
    def plot_loss(name, history, ylim=[-0.5,2]):
        plt.plot(history.history['loss'])
        plt.plot(history.history['val_loss'])
        plt.title('model loss')
        plt.ylabel('loss')
        plt.xlabel('epoch')
        plt.ylim(ylim[0],ylim[1])
        plt.legend(['training', 'validation'], loc='upper left')
        plt.savefig(name)
        plt.show()