AiTeky Original Interactive Learning & Practice Advanced
Survival analysis: how long until it happens, when some have not happened yet
Handle customers still subscribed with censoring, build Kaplan-Meier curves and log-rank tests by hand, model monthly risk with a discrete-time hazard, judge the model with concordance and calibration, value a retention offer, and fit a failure model for a warranty reserve.
"How long will a customer stay?" sounds like a question for an average. It is not. Some customers left in month 3, some left in month 14, and some are still here: you do not know their lifetime, only that it is longer than what you have seen so far. If you average the months you have watched, you underestimate. If you drop the people still here, you underestimate even more. If you count the share who left, the number depends on how long you happened to watch. The same trap appears when you time machine failures, loan defaults, hospital stays or the days until a support ticket closes.
Survival analysis is the set of methods that handle this properly. Its central idea is censoring: an observation that tells you "at least this long". This course teaches it on simulated subscription customers, with Python you write yourself (no special library, so everything runs in your browser): a Kaplan-Meier curve, a log-rank test, a hazard model fitted with logistic regression on customer-months, and the checks that say whether the model can be trusted.
You start by seeing the three wrong averages and the one right curve. You compare monthly and annual plans, read the renewal cliff, and measure how price and support tickets change the monthly risk. You judge the model with the concordance index and a calibration table. The industry lessons price a retention offer using expected lifetime value and decide whom to offer it to, and fit a Weibull failure model with censoring to size a warranty reserve for devices that have not all had time to fail.
All the data are simulated with a fixed random seed (3,000 customers followed for up to 24 months, and 2,000 devices up to 18 months), so we know the true answer and can check the methods against it. The prices, margins, costs and the effect of the retention offer are assumptions flagged in each lesson. Real data are messier; use these lessons as a method and measure your own.
You need the statistics and machine learning courses (logistic regression); the experiments and causal inference course is a natural companion.
- Learn lessons explain one idea at a time and let you compute it.
- Industry ready lessons decide and plan. Each ends with the interview questions that go with it.
- βΆ Run code in your browser. Nothing to install
- β Exercises that check themselves
- π Tap a word to see what it means
Locked. Sign up free
Learn
Understand each idea with everyday examples. No coding background needed.
- 01 50 min Free sample π AiTeky Pass Censoring: why the average lifetime is wrong Simulate 3,000 subscribers joined over two years, see why the mean of months watched, the mean of those who left and the share who left all mislead, and build the Kaplan-Meier estimate that uses everyone, checked against the true answer the simulation knows.
- 02 50 min π AiTeky Pass Comparing curves: monthly against annual, and the log-rank test Draw Kaplan-Meier curves for the two plan types with a confidence band, read the renewal cliff of the annual plan, test whether two curves differ with a log-rank test written by hand, and summarise each curve as the average months kept in the first two years.
- 03 50 min π AiTeky Pass Hazards: the monthly risk and what raises it Turn each customer into one row per month watched, estimate the monthly leaving risk (the hazard), fit a logistic regression on those rows to see how price, support tickets and plan change the risk, compare the result with the true effects the simulation used, and see what a missing renewal term does to the plan's effect.
- 04 50 min π AiTeky Pass Predicting survival and checking it: concordance and calibration Turn the hazard model into a survival curve for each customer, hold out 30% of the customers, measure how well it ranks them with the concordance index, check whether its predicted 12-month risk matches what happened with a calibration table, and see what a ranking-only score cannot tell you.
Industry ready
Real problems from real jobs, and the questions interviewers ask about them.
- 05 55 min π AiTeky Pass On the job: is a retention offer worth it, and for whom? Convert each customer's predicted survival into a discounted lifetime value, price a Rs 300 retention credit that lowers the monthly risk by an assumed 20% for a year, find how small the effect can be before the offer loses money, compare who to target, and write the recommendation.
- 06 55 min π AiTeky Pass On the job: sizing a warranty reserve when most devices have not failed yet Fit a Weibull failure model to 2,000 devices of which only 8% have failed, show what the failures-only shortcut gets wrong, forecast the warranty claims for the next 12 months with a bootstrap range, price an extension from 24 to 36 months, and write the reserve recommendation.

