Customer churn prediction and retention analysis
For a subscription business, we built a churn prediction model and a retention analysis. The model scores every active customer for cancellation risk. The analysis shows how long customers stay, by plan and by signup month.
- Client
- Subscription business
- Service
- Predictive analysis
- Data
- 12 months of history, 10,000+ records
- Tools
- Python, pandas, scikit-learn, PostgreSQL, matplotlib
The questions
- Which active customers are most likely to cancel in the next 30 days?
- What do customers do differently in the weeks before they cancel?
- Which plans and signup months keep customers longest?
Example outputs
Client data stays confidential, so these charts use sample numbers in the same format as the delivered reports.
- 52%of cancellations fall in the top 10% of scored customers
- 26%next-month churn in the high-risk band, against 5% overall
- 29%of promo signups still subscribed after a year, against 55% on monthly plans
Signals ranked by importance
Permutation importance on the test months, scaled so the largest is 100.
Retention by signup month
Share of each month's signups still subscribed. M1 is one month after signup.
| Signup month | M1 | M2 | M3 | M4 | M5 | M6 |
|---|---|---|---|---|---|---|
| January | 87% | 80% | 75% | 72% | 70% | 67% |
| February | 86% | 79% | 74% | 71% | 69% | |
| March | 88% | 82% | 77% | 74% | ||
| April | 81% | 72% | 66% | |||
| May | 86% | 79% | ||||
| June | 87% |
Retention by plan
Share of signups still subscribed, by months since signup. Promo means the customer joined on a promotional offer and is not counted in Monthly.
- Annual
- Monthly
- Monthly, promo
Risk bands
Scored customers grouped by predicted risk, with the action for each band.
| Risk band | Share of active customers | Cancel in the next 30 days | Share of all cancellations | Action |
|---|---|---|---|---|
| High | 10% | 26% | 52% | Personal outreach this week |
| Medium | 25% | 7% | 35% | Re-engagement emails |
| Low | 65% | 1% | 13% | No contact, rescore next month |
| All customers | 100% | 5% | 100% |
Approach
- 1
Agree what churn means
A cancellation request, a lapsed renewal and a card that fails for good are different events. The model needs one definition and one prediction window, such as the next 30 days.
- 2
Take a snapshot for each month
Record what was known about every active customer on the first day of the month, then whether they cancelled in the window. Nothing dated after the snapshot goes into the features, which stops the model from learning from the future.
- 3
Build the features
Days since last login, change in usage against the previous month, failed payments, support tickets, plan, tenure and how the customer joined.
- 4
Train, then test on later months
Fit a gradient-boosted classifier and compare it with a logistic regression baseline. Test both on the most recent months, which neither model has seen, and count how many real cancellations land in the top-scored 10% of customers.
- 5
Calibrate and set the bands
Check that customers scored at 25% do cancel about one time in four. Then cut the scores into bands sized to the number of customers the business can contact.
- 6
Report retention
Build retention curves by plan and a cohort table by signup month, refreshed on a schedule along with the scores.