Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 7

Framing Business Problems for Machine Learning

This lesson is built with resources from youtube.com, machinelearningplus.com and 1 more site.

Welcome to your seventh lesson. In our previous discussion, we weighed the crucial architectural trade-offs between deploying machine learning models using a Python microservice versus a native .NET approach. This gave you a strategic map for integrating AI into your production environment.

Today, we take one crucial step back from the implementation architecture to focus on the absolute foundation of any successful AI project: problem formulation. Your goal is to become an AI System Architect, and no skill is more critical than the ability to translate a vague business objective into a precise, solvable machine learning problem. This lesson is designed to equip you with a systematic process to formulate a business problem, like customer churn, as a specific machine learning task, such as binary classification.

We will move from the abstract business goal of "reducing churn" to a concrete, actionable plan that a machine learning model can execute, setting the stage for our first hands-on project.

From Business Goal to Machine Learning Task

As an experienced engineering leader, you know that building the right thing is more important than building the thing right. In AI, this is paramount. An incredibly accurate, efficient, and scalable model is utterly useless if it solves the wrong problem. The process of "problem framing" is what ensures you're aiming at the correct target before you write a single line of code or provision any infrastructure.

The journey from a business need to a machine learning solution follows a structured path, as illustrated in the diagram below. Today, we are focused on that critical first step: converting the business problem into an ML problem.

This flowchart shows the key steps in translating a business requirement into a machine learning task. It begins with defining the business problem and ends with the formulation of an ML problem, a process we will deconstruct in this lesson.

The Three Lenses of Problem Framing

Most business problems that can be solved with supervised machine learning can be viewed through one of three primary "lenses": Classification, Regression, or Ranking. Understanding these lenses is the first step to structuring your thinking.

A great blog post from Code by Night, "A Primer to Framing Business Problems for Machine Learning," breaks this down clearly.

A Primer to Framing Business Problems for Machine Learning

This article provides an excellent, practical overview of how to frame problems. It directly addresses the danger of jumping to solutions before understanding the core question.

Please read the following sections: Start from the beginning and read through the introduction to understand why framing is critical. Next, read the section on Classification. This is the most relevant for our churn project. Pay close attention to how the business problem "we're losing customers" is reframed as a binary classification task. Finally, briefly review the sections on Regression and Ranking to understand the alternative frames. This will help you categorize future business problems you encounter.

To summarize for our context:

  • Classification: Predicts a category. For our churn project, the question is, "Will this customer churn or not?" This is a binary classification problem because there are two possible outcomes (Yes/No).
  • Regression: Predicts a continuous number. A related business problem framed as regression might be, "What will be the total revenue from this customer over the next year?"
  • Ranking: Predicts an order. For your platform, this could be, "In what order should we display subscription plans to maximize the likelihood of an upgrade?" This is directly applicable to your goal of building a recommendation system.

A 5-Step Process for Framing the Churn Problem

Now, let's apply this framework to our specific goal of predicting customer churn on your subscription platform. We'll follow a methodical, step-by-step process, similar to the one outlined in the article from MLPlus.

How to formulate machine learning problem - MLPlus

This article provides a structured, 5-step approach to translate a business problem into a predictive modeling problem, using a telecom churn scenario that is a strong parallel to our own.

Focus on the logic presented in these sections: First, review the business scenario presented. Next, walk through Step 1: Identify the business pain point(s) and Step 2: Translate to a quantifiable metric that can be predicted. This is the core of problem formulation. Pay close attention to how they move from a general problem to the specific concept of churn modeling. Finally, read Step 3: What data if exists can help predict the response?, as it connects the prediction task to the underlying data requirements.

Let's use this structured thinking for your project.

Step 1: Start with the Business Decision
What action will be taken based on the model's output? A model without a corresponding action is an academic exercise.

  • Business Goal: Reduce customer churn.
  • Actionable Decision: If we predict a customer is likely to churn, we will proactively engage them with a targeted retention offer (e.g., a personalized discount, a temporary plan upgrade, or a check-in from a customer success agent). Customers predicted not to churn will be left alone, saving marketing resources and avoiding spamming happy users.

Step 2: Define the Ideal Output and Choose the ML Lens
What specific piece of information does the decision-maker (in this case, your automated marketing system) need?

  • Ideal Output: For each customer, we need to know their likelihood of churning. A simple Yes/No is good, but a probability score (e.g., "Customer X has an 85% probability of churning") is even better. It allows for more nuanced actions, like offering bigger discounts to higher-risk customers.
  • ML Lens: Since the output is a probability that maps to a "Yes/No" decision, this is clearly a binary classification problem.

Step 3: Define "Churn" and the Prediction Window
This is a critical business logic step. What does "churn" actually mean for your platform?

  • Definition: A customer is considered "churned" if their paid subscription is not renewed within X days of its expiration date. You must define X (e.g., 7 days, 14 days). This definition must be precise and unambiguous.
  • Prediction Window: When do we want to make the prediction? We need to predict churn before it happens. A useful framing is: "Based on the customer's data today, will they churn in the next 30 days?" This 30-day window gives the marketing team enough time to act on the prediction.

Step 4: Identify the Unit of Analysis
What, exactly, are we making a prediction for? This defines the rows of our future dataset.

  • Unit of Analysis: We are making one prediction per active customer.

Step 5: Identify the Target Variable and Potential Features
This step translates the problem into data terms.

  • Target Variable (the "y"): This is what the model learns to predict. It's a single column in your dataset representing the outcome. For our problem, it would be a column named is_churned, where 1 means the customer churned within the prediction window, and 0 means they did not.
  • Features (the "X"): These are the input signals the model will use to make its prediction. Drawing from your system's data in PostgreSQL, these could include:
    • Subscription Data: plan_type (monthly, annual), subscription_age (tenure), days_until_renewal.
    • Activity Data: last_login_date, number_of_sessions_last_30_days, key_features_used.
    • Transaction Data: number_of_past_renewals, use_of_coupons, history_of_payment_failures.
    • CRM Data: number_of_support_tickets, customer_satisfaction_scores.

The following video shows a data scientist walking through a similar churn project. Notice how she defines the problem and selects her features and target.

Data Science Portfolio Project - Churn prediction model

This video provides a practical walkthrough of a churn prediction project. It reinforces the concepts we've just discussed.

Focus on these key moments: The introduction provides a solid business definition of churn and why companies care about it. Here, the presenter explicitly defines the target variable: the 'exited' column, where 1 means the customer churned. This is the concrete data representation of our problem. This segment shows the process of selecting the features (X) and separating them from the target variable (y), which is the final step in translating the business problem into a machine-learnable format.

This end-to-end flow is also captured visually below, showing how historical data feeds a predictive model to classify customers as either at-risk or happy.

A high-level view of a churn prediction system. Customer history and pattern recognition inform a machine learning model, which in turn predicts which customers are happy versus those at risk of churn, enabling proactive re-engagement.

Conclusion

You have now learned the crucial process of problem formulation, moving from a high-level business objective to a specific, well-defined machine learning task. This is the most impactful activity an AI System Architect performs, as it sets the direction for the entire project.

Key Takeaways:

  • Problem framing is paramount. Never jump to solutions before you have precisely defined the problem you are trying to solve and the business action it will enable.
  • Translate ambiguity into precision. The goal is to move from "reduce churn" to a concrete ML task.
  • Our Churn Problem Formulation:
    • Type: Binary Classification.
    • Question: For each customer, what is the probability they will fail to renew their subscription in the next 30 days?
    • Target Variable: is_churned (1 if churned, 0 if not).
    • Unit of Analysis: Per active customer.
    • Action: Target customers with a churn probability > X% with a retention campaign.

With the problem now clearly defined, our next step is to gather the data needed to solve it. In the next lesson, we will get our hands on the keyboard and complete the final step of this foundational module: extracting a sample dataset from your PostgreSQL database using SQL and loading it into a Pandas DataFrame. This will be the raw material for our churn prediction model.