#501
Predictive Analytics
Forecast the next 12 months of sales and score which customers are likely to leave.
Technique: Holt-Winters seasonal smoothing, linear regression, logistic regression (gradient descent)
Read the code:
src/main/java/com/study/advlab/predict/ForecastService.javasrc/main/java/com/study/advlab/predict/ChurnModel.java
Next 12 months
41.5 M
forecast revenue, THB
Growth
+8.8%
vs the last 12 months
Back-test error
3.1%
MAPE on 6 hidden months (straight line: 6.7%)
Smoothing found
α 0.05 · β 0.0 · γ 0.75
level · trend · season
Monthly sales and forecast
Forecast table THB
| Month | Forecast | 95 % range |
|---|---|---|
| 2026-10 | 3,314,577 | 3,077k - 3,551k |
| 2026-11 | 3,773,386 | 3,438k - 4,108k |
| 2026-12 | 4,292,925 | 3,882k - 4,702k |
| 2027-01 | 3,044,503 | 2,571k - 3,517k |
| 2027-02 | 3,118,222 | 2,588k - 3,647k |
| 2027-03 | 3,415,177 | 2,835k - 3,994k |
| 2027-04 | 3,805,723 | 3,179k - 4,431k |
| 2027-05 | 3,301,492 | 2,632k - 3,970k |
| 2027-06 | 3,260,399 | 2,550k - 3,970k |
| 2027-07 | 3,386,163 | 2,637k - 4,134k |
| 2027-08 | 3,362,285 | 2,577k - 4,147k |
| 2027-09 | 3,470,317 | 2,650k - 4,290k |
Which customers will leave? logistic regression
Accuracy
80%
on 44 test customers the model never saw
AUC
0.907
0.5 = coin flip, 1 = perfect
Precision / recall
82% / 78%
of predicted leavers / of real leavers found
Churn rate
49.5%
of all customers left
What the model learned
Tenure (months)
-1.01Monthly spend
-0.30Support tickets
0.70Days since last login
1.12Red raises the risk, green lowers it. Features are standardised, so the weights can be compared.
Confusion matrix test set
| Predicted leave | Predicted stay | |
|---|---|---|
| Left | 18 | 5 |
| Stayed | 4 | 17 |
Most at risk still customers today
| Customer | Main reason | Risk |
|---|---|---|
| Chai Tanaka Gamer |
Support tickets | 99% |
| Lena Johansson Office |
Days since last login | 90% |
| Omar Patel Office |
Days since last login | 88% |
| Olivia Haddad Gamer |
Tenure (months) | 86% |
| Somchai Rossi Gamer |
Days since last login | 83% |
| Arisa Johansson Creator |
Tenure (months) | 75% |
| Sofia Brown Creator |
Days since last login | 71% |
| Nina Garcia Office |
Tenure (months) | 68% |
| Ploy Srisuk Office |
Support tickets | 68% |
| Anan Nguyen Gamer |
Days since last login | 67% |
| Ploy Kim Mobile first |
Days since last login | 62% |
| Ravi Smith Gamer |
Days since last login | 60% |
| Kenji Thongdee Office |
Days since last login | 59% |
| Kittisak Sombat Office |
Support tickets | 57% |
| Emma Garcia Creator |
Days since last login | 57% |
What if...?
Chance to leave
-