Continue to Train an Already Trained Keras Model with New Data

Chris Achard
InstructorChris Achard

Share this video with your friends

Send Tweet
Published 3 years ago
Updated 3 years ago

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.

Instructor: [00:01] 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.

[00:18] 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.

[00:41] 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.

[01:01] 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.

[01:15] 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.

Vatsaev Aslan
Vatsaev Aslan
~ 3 years ago

Could've talked about transfer learning a little bit

Chris Achard
Chris Achardinstructor
~ 3 years ago

Vatsaev: this was meant to be a more "intro" level course, but Yes! transfer learning would be a great topic in a follow on course. Using an already trained model is definitely where a lot of the power of using neural networks comes into play.

Shawn Wang
Shawn Wang
~ 3 years ago

seconding transfer learning

Eliezer Steinbock
Eliezer Steinbock
~ 3 years ago

Would love to see a follow up to this course! I want more!

Rene
Rene
~ 3 years ago

yes, a follow up would be nice. how to learn with different counts of inputs ? e.g. short and long text ?

Alplob
Alplob
~ 2 years ago

Thanks a lot for that very practical course, I am big fan of it! If there is a new course about Keras, I would be very interested about handling multiple time series data like those about Antarctica weather shown in the course 5.