Chapter 10. Deployment Patterns for Machine Learning Models

Throughout this book, we’ve been discussing the machine learning lifecycle. As a quick reminder, at a high level, the lifecycle of a machine learning system is similar to the software development lifecycle. This means it includes multiple stages, which we can summarize as follows:

Development
Training the model
Validation
Validating the model
Staging
Testing the model in a production-like environment
Deployment
Putting the machine learning system into production
Archiving
Retiring the model and, if necessary, replacing it with a new version

In the previous chapters, we’ve covered the first few stages of the lifecycle in depth, including various tools and methods for distributed training. In this final chapter, I will provide guidance on how to think through the deployment process and what considerations you should be aware of. Deployment takes place once you have a model that produces accurate results that you are content with and you’re ready to serve it and put it into production. If this is not the case, it’s best to continue exploring with additional algorithms and parameters, and perhaps fresh data.

When thinking about deploying a model, we need to define when and where it will be used in the overall production system workflow. It may be part of a bigger data flow, or it may be a standalone application exposing APIs for users to interact with. The model can also be wrapped and served as a UDF as part of a Spark ...

Get Scaling Machine Learning with Spark now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.