Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Continue to Train an Already Trained Keras Model with New Data


    As we get new data, we will want to re-train our old models with that new data. We’ll look at how to load the existing model, and train it with new data, and then save the newly trained model.



    Become a Member to view code

    You must be a Pro Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    orLog In




    Instructor: We can load an existing model by importing Load Model from Keras.Models, and then call Load Model and pass the file name of our saved model. We can look at the summary of that model to better understand what we just loaded.

    We can also continue training the saved model if we want to. We don't have the model defined in this file at all, but the saved file contains all the information that we need to pick up training right where we left off. We can import Numpy and use that to load the IRIS CSV file.

    We need to remember to switch the y-values from just a number to a one-hot encoded vector. First, import two-categorical and then we can use that on the y-values.

    We need to make sure to shuffle the data again since we're going to be using the validation split method. Finally, we can call fit just like normal.

    The model will pick up just where it left off and continue to train the network. This can be especially helpful if you get new data and you want to train an old model, or if you simply want to pause training because it's taking a long time and resume at a later time.