CHAPTER 12Deploying Machine Learning Models

Deploying ML

The main goal of machine learning is to create a model that you can use for making predictions. Over the past few chapters in this book, you learned about the various algorithms used to build an ideal machine learning model. At the end of the entire process, what you really want is to make your model accessible to users so that they can utilize it to do useful tasks, like making predictions (such as helping doctors with their diagnosis, and so forth).

A good way to deploy your machine learning model is to build a REST (REpresentational State Transfer) API, so that the model is accessible by others who may not be familiar with how machine learning works. Using REST, you can build multi‐platform front‐end applications (such as iOS, Android, Windows, and so forth) and pass the data to the model for processing. The result can then be returned back to the application. Figure 12.1 summarizes the architecture that we will use for deploying our machine learning model.

Illustration demonstrating how to deploy a machine learning model as a REST API for front-end applications using Python to allow users to make some predictions.

Figure 12.1: Deploying your machine learning model as a REST API allows front‐end applications to use it for predictions

In this chapter, we will go through a case study, build a machine learning model, and then deploy it as a REST service. Finally, we will build a console front‐end application using Python to allow users to make some predictions.

Case Study

Get Python Machine Learning 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.