Chapter 7. Publishing models

 

This chapter covers

  • Persisting learned models
  • Modeling microservices using Akka HTTP
  • Containerization of services using Docker

In this chapter, we’ll consider how to publish models (see figure 7.1). Throughout this book, you’ve been learning and using models, but making models available for use in a real machine learning system can involve some complexities that you haven’t yet seen. When you’re exploring models in a REPL like the Spark shell, you can directly call methods on the instance of a model already in memory. But in real-world systems, it’s common for a model to be learned in a pipeline, as you saw in chapters 4 and 5, before being used in a completely different application. This chapter will show you how to make models available for use in the complex environment of a real-world machine learning system. We’ll work through an approach to packaging models into services and then making those services into independently deployable units.

Figure 7.1. Phases of machine learning

7.1. The uncertainty of farming

Machine learning is used in all sorts of industries, not just ones that you think of as having a lot of technology involved. The world of farming, for example, requires a great deal of technological sophistication. Consider Hareloom Farms, an organic farm, run entirely by rabbits. The rabbits grow fruits and vegetables, including celery, tomatoes, and, of course, carrots.

7.2. Persisting models

7.3. Serving models

7.4. Containerizing applications

7.5. Reactivities

Summary