How to ship an ML service to production with a small team: a cloud case

Alexander Kuzmichev, Alexander Kaznacheev18 Dec 2023

Problem

A small team at VK built a customer churn model for Premium Bonus, a company that offers customer-data automation. The task was to score each customer's propensity to leave, where "left" means no return purchase within 60 days. The task was simple enough for one model. Production was harder: it needs a hosting platform, resources and an interface that hands the scores to the client. The authors wanted the user to need no DevOps engineer at all.

Example from the article: a dataset of 2 million records over 1.5 years, 11% average monthly churn and more than 100,000 customers a month, served as a REST API from a 2 CPU, 2 GB instance.

Solution in brief

One monolithic CatBoost classifier is trained on purchase-history features and checked on an out-of-time sample. It is packaged with MLflow and deployed on a managed cloud ML platform. A small wrapper class makes MLflow call predict_proba. The client sends raw features in one request and gets a probability.

Questions this case answers
  • How to predict individual customer churn over a fixed horizon from purchase history and expose the score to a client with no ML infrastructure of their own
  • How to serve a tabular model through a generic model-packaging layer that expects a single predict method
  • How to predict whether a retail customer will leave within 60 days and serve the score to a client without building a platform
  • How to deploy a CatBoost model on MLflow when the platform only calls predict

Tools and methods

  • CatBoost — gradient boosting classifier for the churn score
  • Feature selection — drops weak features by univariate power and correlation (137 to 50)
  • MLflow and MLflow Deploy — packaging and REST deployment of the model
  • JupyterHub (VK Cloud ML Platform) — environment for loading and logging the model
Continue reading — it's free

Google or a one-time email code. No password.