Saving and Loading Models
You will eventually need to transfer some of the models you have trained to a different computer so they can be put into production. There are various utilities for doing this, but the one we will discuss is called joblib
.
joblib
supports saving and loading models, and it saves the models in a format that is supported by other machine learning architectures, such as ONNX
.
joblib
is found in the sklearn.externals
module.
Exercise 6.14: Saving and Loading a Model
In this exercise, you will train a simple model and use it for prediction. You will then proceed to save the model and then load it back in. You will use the loaded model for a second prediction, and then compare the predictions from the first model to those from the second model. You will make use of the car dataset for this exercise.
The following steps will guide you toward the goal:
- Open a Colab notebook.
- Import the required libraries:
import pandas as pd from sklearn.model_selection...