Skip to content

How to Build a Customer Churn Prediction Model

By Newtown Analytics · · 8 min read

For ecommerce, marketing & growth leaders

Churn prediction is the practice of estimating which customers are likely to stop buying, so that the company can act before they leave, and it is a core part of business analytics for finance and operations. For subscription businesses churn is a cancellation. For product companies it is usually a lapse: a customer who has not purchased for longer than their normal cycle. The prediction is only the first half of the job. The second half is deciding whom to contact, with what offer and at what cost, so that the retention effort earns more than it spends. This guide shows how to build a churn prediction model in practical steps: define churn, assemble data, create features, split by time, build a simple model, evaluate it with lift and decile tables and decide how deep into the ranked list to go using a worked example with checked arithmetic. It also covers deployment and common mistakes. It follows AI in FP&A and anomaly detection in finance data, and leads to analytics automation and Python vs. Excel for analysis. Retention economics connect to revenue churn vs. logo churn and to budgeting and forecasting.

Step 1: Define churn precisely

An unclear definition ruins the model. For a subscription, churn is a cancellation or a non-renewal. For repeat purchase businesses, set a rule such as "no purchase in 180 days, for a customer whose usual gap is under 90." Choose a prediction window: you are predicting whether a customer will churn within the next N days. Choose N to match the time you need to act. Predicting churn next week is useless if the retention campaign takes a month to run. Also decide which customers are in scope: customers who have been active, and not those already lapsed.

Step 2: Assemble the data

Collect one row per customer per observation date. Include the target (did the customer churn within the window after that date) and features known at that date. Typical sources: orders and invoices, subscription records, product usage, support tickets, marketing responses, discounts and returns, and customer attributes such as segment, region and tenure. Make sure the data reflects what was known at the time. Records updated after the fact can leak the answer into the features.

Step 3: Create features

Features that tend to matter are about behavior and change.

  • Recency: days since last purchase or login.
  • Frequency: number of orders in the last 30, 90 and 365 days.
  • Monetary: spend in recent periods and average order value.
  • Trend: change in frequency or spend versus the prior period, such as orders in the last 90 days divided by orders in the prior 90.
  • Engagement: product usage, email opens, site visits.
  • Service: support tickets, complaints, returns and delivery problems.
  • Price and promotion: discount reliance, price changes experienced.
  • Tenure and contract: months as a customer, time to renewal.

Trend features are often the most informative. A customer whose order frequency has halved is more at risk than one with a low but steady frequency.

Step 4: Split by time, not at random

Train on earlier observation dates and test on later ones. A random split lets the model see the future, because the same customer appears in both sets at different dates. Use, for example, observation dates up to month 12 for training and month 13 to 15 for testing. Keep the test set untouched until you finish tuning.

Step 5: Build a simple model first

Start with a baseline: churn rates by recency band, or a rule such as "no order in 90 days." Then try a logistic regression or a decision tree, which are fast to train and easy to explain. If needed, try gradient boosted trees. Compare each on the test set against the baseline. Prefer the simplest model that performs well enough, since it is easier to explain, maintain and trust. See machine learning vs. simple statistical models.

Step 6: Evaluate with lift and deciles

Accuracy is a poor measure when churn is uncommon: a model that predicts "no churn" for everyone is 90 percent accurate when 10 percent churn. Instead, rank customers by predicted risk, divide into ten equal groups (deciles) and compare the actual churn in each with the average.

Suppose there are 5,000 customers in the test set and 10 percent churn, which is 500 churners (hypothetical). The top decile has 500 customers, and 210 of them are churners.

  • Precision in the top decile: 210 / 500 = 42 percent
  • Lift: 42 / 10 = 4.2
  • Recall: 210 / 500 churners = 42 percent

Taking the top two deciles (1,000 customers), suppose 330 churners are captured. Precision is 330 / 1,000 = 33 percent, lift is 3.3 and recall is 330 / 500 = 66 percent. Taking the top three deciles (1,500 customers), suppose 400 churners are captured: precision is 400 / 1,500 = 26.7 percent, lift is 2.7 and recall is 80 percent.

Step 7: Decide how deep to contact

The right cutoff comes from economics, not from the model's statistics. Suppose a retention contact costs $25 per customer, and 20 percent of the contacted customers who would have churned are saved. A saved customer is worth $600 in future margin (hypothetical).

ContactedCustomersChurners capturedCostCustomers saved (20%)Value savedNet value
Top decile500210$12,50042$25,200$12,700
Top 2 deciles1,000330$25,00066$39,600$14,600
Top 3 deciles1,500400$37,50080$48,000$10,500

Check: 500 × 25 = 12,500; 0.20 × 210 = 42; 42 × 600 = 25,200; 25,200 - 12,500 = 12,700. For two deciles: 1,000 × 25 = 25,000; 0.20 × 330 = 66; 66 × 600 = 39,600; 39,600 - 25,000 = 14,600. For three: 1,500 × 25 = 37,500; 0.20 × 400 = 80; 80 × 600 = 48,000; 48,000 - 37,500 = 10,500.

The net value peaks at the top two deciles, at $14,600. The marginal analysis shows why. Adding the second decile costs $12,500 and captures 120 more churners (330 - 210), saving 24 more customers worth $14,400, a net gain of $1,900 (14,600 - 12,700). Adding the third decile costs $12,500 and captures 70 more churners (400 - 330), saving 14 customers worth $8,400, a net loss of $4,100 (10,500 - 14,600). So the company should contact the top 20 percent. Notice that the threshold depends on the cost of contact, the save rate and the value of a customer. If the save rate were 30 percent, the third decile would be worth contacting: 70 × 0.30 × 600 = $12,600 against a cost of $12,500. Estimate the save rate with a controlled test: hold out a random part of the at-risk group and compare. That test also measures whether the program works at all.

Step 8: Choose the action

Match the intervention to the reason for risk, where possible. Customers with service problems need a resolution. Customers who have drifted may respond to a reminder or a replenishment prompt. Price-sensitive customers may respond to an offer, but offers cost margin and can train customers to wait for discounts. Valuable customers may deserve a personal call. Document which action goes to which segment, and test alternatives.

Step 9: Deploy and monitor

Score customers on a schedule, such as weekly, and send the list to the team or system that takes action. Track the number contacted, the response and the churn rate of contacted versus held-out customers. Retrain every few months, or sooner if performance falls. Watch for drift: if a pricing change alters customer behavior, the model's patterns may no longer hold. Keep a record of the model version, the data and the results.

Common mistakes

  1. A vague churn definition.
  2. Random train-test splits that leak the future.
  3. Judging by accuracy when churn is uncommon.
  4. Using features that reveal the outcome, such as "cancellation requested."
  5. No holdout to test whether the intervention works.
  6. Contacting too many customers, as the economics show.
  7. Ignoring customer value, so that low-value customers absorb effort.
  8. Never retraining.

Explaining the model to the people who use it

Retention teams act on a score only when they understand where it comes from. For each customer on the contact list, show the top two or three reasons for the risk in plain words, such as "orders down 60 percent in the last 90 days" or "two unresolved support tickets." A logistic regression offers this directly through its coefficients, and tree-based models offer similar information through importance measures. Review the reasons across the list: if most flagged customers show the same problem, such as late deliveries, the fix is operational, and no campaign will repair it. The model becomes a diagnostic tool as well as a targeting tool.

Respect the customer

Retention contacts should help the customer, and not irritate them. Avoid contacting people more than your policy allows, honor opt-outs and privacy rules, and be careful with offers. Discounting to customers who show signs of leaving can teach others to threaten to leave. Where possible, use non-price interventions: fix the problem, offer help, remind the customer of benefits. Track the customer experience of the program as well as the financial results.

When timing matters: a note on survival analysis

A churn flag says whether a customer is likely to leave in a fixed window. Survival methods estimate when, which can be more useful when contract renewal dates or purchase cycles vary. They also handle customers who have not yet had the chance to churn. If you find that your fixed-window model works poorly because customers differ widely in their cycles, ask an analyst to test a time-to-event approach. For most mid-sized companies, the fixed-window model with a well-chosen definition is a good start.

FAQs

What is churn prediction?

Estimating which customers are likely to stop buying or cancel within a given period, so that the company can act to retain them.

What data do I need?

Customer purchase or subscription history, usage, service interactions, attributes and the outcome, with features known at the time of prediction.

How do I evaluate a churn model?

Use lift and decile tables on a later test period rather than overall accuracy, and translate the result into net value after the cost of contact.

How many customers should I contact?

As many as remain profitable at the margin: add groups from the ranked list while the extra value saved exceeds the extra cost of contact.

How do I know the retention action works?

Hold out a random group of at-risk customers, contact the rest and compare churn rates.

This article is for general information. It is not accounting, tax, legal or investment advice, and examples use illustrative numbers rather than client data. Confirm decisions that carry financial or legal consequences with a qualified professional.

Better forecasts. Healthier inventory. More working capital.

Newtown Analytics advises growing consumer-product companies on demand planning and inventory optimization.