180304 the Acc+loss+val_acc+val_loss in the training process of keras in the image viewing model

Source: Internet
Author: User
Tags keras


- First Step

# define the function
def training_vis (hist):
    loss = hist.history[' loss ']
    Val_loss = hist.history[' Val_ Loss ']
    acc = hist.history[' acc ']
    VAL_ACC = hist.history[' Val_acc ']

    # make a figure
    fig = plt.figure ( Figsize= (8,4))
    # subplot loss
    Ax1 = fig.add_subplot (121)
    Ax1.plot (loss,label= ' Train_loss ')
    Ax1.plot (val_loss,label= ' Val_loss ')
    ax1.set_xlabel (' epochs ')
    Ax1.set_ylabel (' loss ')
    ax1.set_ Title (' Loss on Training and Validation Data ')
    ax1.legend ()
    # subplot acc
    ax2 = fig.add_subplot (122)
    ax2.plot (acc,label= ' TRAIN_ACC ')
    ax2.plot (val_acc,label= ' VAL_ACC ')
    ax2.set_xlabel (' epochs ')
    Ax2.set_ylabel (' accuracy ')
    ax2.set_title (' accuracy on  Training and Validation Data ')
    Ax2.legend ()
    plt.tight_layout ()
Step Two
# Train the model
hist = Model.fit (...)
Step three
# Call the function
Training_vis (hist)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.