Deploying trained CARET Machine Learning Model with Docker and Plumber

I have been busy learning Docker, as it was one of those things I have been putting off for a while. But, I am so glad that I did. Essentially, I have gone through all the pain so you don’t have to.

Building the ML Model and creating API with Plumber

I can’t tell you how much I love Plumber. This tool allows you to create REST APIs so quickly. Additionally, with the inclusion of swagger, it allows you to have a user interface to effectively deploy your machine learning models at scale.

To find out how to build the model with CARET and create the Plumber API, see:

Scaling up our web service with Docker

Building on the example above I then take you through the process of working with Docker. Docker is set out as below:

Hello Docker - Things Solver

This allows you to connect to a host Daemon and build images and containers. Here I show you how to build the image and run the service. This service can then be accessed in a web browser and would persist if you had a web server, Azure Cloud account or R Connect. The essence is it creates an isolated environment for you to build a mini R environment and deploy your services.

What the heck is Swagger?

I thought this was something from my Oasis days when I first heard it, thinking more Liam than Noel.

Swagger is an API framework to allow easy hosting of APIs and creates a nice user interface to test models. Otherwise you are stuck using postman and other HTTP apps to send and receive requests.

How can you deploy to Docker?

The YouTube below takes your through the process of:

  1. Testing the Plumber API
  2. Building a Dockerfile
  3. Deploying your API to Docker with a REST API Swagger interface
  4. Learn a bit of Windows Powershell, for good measure.

See how:

Where can I get this code?

The code can be accessed for each of the tutorials in the supporting GitHub account. Please feel free to have a nosey around other directories of interest. Also, please star and fork the code – I don’t mind.

It is good, as a Windows user, to be able to use Linux containers and deploy services under different Operating Systems. I like this comparison when my Linux friends pile on the pressure to uninstall Windows:

Windows Vs Mac Vs Linux: 10 Funny Jokes In Pictures