Model packaging
In the previous section, we built two versions of the model. In this section, let's package one of the models and save it for model scoring and deployment. As mentioned in the previous section, let's package the XGBClassifier
model. Again, for packaging, there are different solutions and tools available. To avoid setting up another tool, I will be using the joblib
library to package the model:
- Continuing in the same notebook that produced the
XGBClassifier
model, the following code block installs thejoblib
library:#install job lib library for model packaging !pip install joblib
- After installing the
joblib
library, the next step is to package the model object using it. The following code block packages the model and writes the model to a specific location on the filesystem:import joblib joblib.dump(xgb_model, '/content/customer_segment-v0.0')
The preceding code block creates a file in the /content
folder. To...