Building a Service for Deploying ML Models

Introduction

Sometimes you find yourself writing the same code over and over. When that starts happening you know it’s time to take what you’ve learned and create a reusable piece of code that can be applied in the future. Because of the experience that we’ve gained in writing previous blog posts, I think that it is a good time to make a reusable service that can host any number of machine learning models.

In previous blog posts we’ve built many different types of services that can host ML models, in this blog post we’ll aim at building a reusable service that…


The ml_base package defines a common set of base classes that are useful for working with machine learning model prediction code. The base classes define a set of interfaces that help to write ML code that is reusable and testable. The core of the ml_base package is the MLModel class which defines a simple interface for doing machine learning model prediction. In this blog post, we’ll show how to use the MLModel class.

To get started we’ll install the ml_base package:

pip install ml_base

Creating a Simple Model

To show how to work with the MLModel base class we’ll create a simple model that…


This blog post builds on the ideas started in three previous blog posts.

This blog post also references previous blog posts in which I deployed the same ML model in several different ways. …


Using Apache Beam to deploy an ML model

This blog post builds on the ideas started in three previous blog posts.

In this blog post I’ll show how to deploy the same ML model that we deployed as a batch job in this blog post, as a task queue in this blog post, inside an AWS Lambda in this blog post, as a Kafka streaming application in this blog post, a gRPC service in this blog post, as a MapReduce job in this blog post, as a Websocket service in this blog post, and as a ZeroRPC service in this blog post.

The code in this blog post…


Using a ZeroRPC service to deploy an ML model

This blog post builds on the ideas started in three previous blog posts.

In this blog post I’ll show how to deploy the same ML model that we deployed as a batch job in this blog post, as a task queue in this blog post, inside an AWS Lambda in this blog post, as a Kafka streaming application in this blog post, a gRPC service in this blog post, as a MapReduce job in this blog post, and as a Websocket service in this blog post.

The code in this blog post can be found in this github repo.

Code

Introduction

There…


Using a WebSocket service to deploy an ML model

This blog post builds on the ideas started in three previous blog posts.

In this blog post I’ll show how to deploy the same ML model that we deployed as a batch job in this blog post, as a task queue in this blog post, inside an AWS Lambda in this blog post, as a Kafka streaming application in this blog post, a gRPC service in this blog post, and as a MapReduce job in this blog post.

The code in this blog post can be found in this github repo.

Code

Introduction

In the world of web applications, the ability to…


Using Hadoop to deploy an ML model

This blog post builds on the ideas started in three previous blog posts.

In this blog post I’ll show how to deploy the same ML model that l deployed as a batch job in this blog post, as a task queue in this blog post, inside an AWS Lambda in this blog post, as a Kafka streaming application in this blog post, and a gRPC service in this blog post.

The code in this blog post can be found in this github repo.

Introduction

Because of the growing need to process large amounts of data across many computers, the Hadoop project…


Using a gRPC Service to deploy an ML model

This blog post builds on the ideas started in three previous blog posts.

In this blog post I’ll show how to deploy the same ML model that l deployed as a batch job in this blog post, as a task queue in this blog post, inside an AWS Lambda in this blog post, and a Kafka streaming application in this blog post.

The code in this blog post can be found in this github repo.

Introduction

With the rise of service oriented architectures and microservice architectures, the gRPC system has become a popular choice for building services. gRPC is a fairly…


Using Kafka to Deploy an ML Model

This blog post builds on the ideas started in three previous blog posts.

In this blog post I’ll show how to deploy the same ML model that l deployed as a batch job in this blog post, as a task queue in this blog post, and inside an AWS Lambda in this blog post.

The code in this blog post can be found in this github repo.

Introduction

In general, when a client communicates with a software service two patterns are available: synchronous and asynchronous communication. When doing synchronous communication, a message is sent to the service which blocks the sender…


Using the serverless framework to deploy an ML Model

This blog post builds on the ideas started in three previous blog posts.

I also showed how to deploy the same ML model used in this blog post as a batch job in this blog post, and in a task queue in this blog post.

The code in this blog post can be found in this github repo.

Introduction

In the last few years, a new cloud computing paradigm has emerged: serverless computing. This new paradigm flips the normal way of provisioning resources in a cloud environment on its head. …

Brian Schmidt

Coder and machine learning enthusiast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store