ML System Design

Framework:

flowchart TD
    A[Clarifying Requirements] --> B[Framing the problem as an ML Task]
    B --> C[Data Preparation]
    C --> D[Model Development]
    D --> E[Evaluation]
    E --> F[Deployment and Serving]
    F --> G[Monitoring and Infrastructure]

Clarifying Requirements

Framing the problem as ML Task

  1. Define the ML Objective
  2. Define the input and output
  3. Choosing the right ML Category

Define ML Objective:

I need to convert the business objective from the step 1 to a ML objective. Let's say the business objective is to increase sales by 20% for a product recommendation model. But we can't ask a model to increase sales by 20%. We have to think how can actually product recommendation model helps to increase sales? By showing more relevant products that the user want to see or want to buy? So a better ML objective would be to increase click-through rate or correctly predict the relevant product based on the user. The former is an online metric where the latter one is an offline metric, that we can use to train

Define the Input & Output:

Here, we need to define what would be input and output of the model. The input can be different type for the same model, like for product recommendation model we can only use user's embedding as input (collaborative based filtering) or use both user and product embedding as input (content based filtering). In both of the ways, the output can be binary (relevant or not) - in reality, the model will output a probability of a product being relevant.

Choosing the right ML category

Choose between the following ones

Data Preparation

Data Engineering:

There are 3 key

Framing the problem as ML Task

  1. Define the ML Objective
  2. Define the input and output

Questions to Ask

  1. What are the constraint of the system?
    1. End devices?
    2. What is the use of the model?
  2. Data characteristics
    1. Size
    2. Output - Categorical or Continuous
    3. Labeled - Supervised Learning / Unsupervised Learning / Semi-supervised Learning
    4. Missing data - Handling Missing Data
    5. Imbalanced? - Handling Imbalanced Dataset
    6. Outliers - Handling Outliers
  3. Which Machine learning to use?
    1. Machine Learning Algorithm Selection
    2. Need to be interpretable?
    3. Online Learning?
    4. Recommendation system?
  4. Model Evaluation
    1. #evaluation
    2. Positive is more important or negative

Related Notes