People analytics
Expected Goals, but for Quitting
Borrowing expected goals from hockey to measure attrition fairly, and to find the leaders who are quietly outperforming.
Hockey worked out something a while ago that people analytics is still catching up to: a goal isn't just a goal. A shot from a brutal angle that beats the goalie means something different than a tap-in on an empty net. So analysts built "expected goals," a way to ask how many a typical shooter would have scored from those exact chances, then compare it to what actually happened. The gap is the skill.
I kept coming back to that idea while building an attrition model, because workforce turnover has the same blind spot.
Here's the trap. A leader's team has 15% turnover. The company sits at 12%. On paper, that leader looks like a problem. But what if their group was always going to be high-risk? New hires, in-demand trades, a remote site nobody wants to relocate to. A typical manager handed that exact team might have seen 18%. Suddenly 15% isn't a red flag. It's a quietly good year.
Raw rates can't see any of that. So I built something that could.
The foundation
First I needed a model that predicts, for any active employee, the probability they'll voluntarily leave in the next six months. Not retirements or layoffs. The departures a company might actually have influenced.
The unglamorous part is where most of the work went. The data is a monthly panel: a snapshot of every employee, every month, across several years. It's easy to build a model here that looks brilliant and is secretly useless, usually by letting it peek at the future. So the discipline was strict. Every feature is known strictly as-of that month. People who left for non-preventable reasons are censored, not mislabeled as "stayed." Validation is done across time, training on the past and testing on the future, never a random split.
The result is a model with modest, stable accuracy (an AUC around 0.70) that's well calibrated and concentrates risk where it matters: the top risk decile catches a meaningful share of future leavers at a few times the base rate. It won't tell you who's leaving. It tells you where to look. I tried to be plain about that in the write-up rather than dress it up.
One constraint shaped the whole thing: it runs entirely locally. No data leaves the building. For something this sensitive, that wasn't negotiable.
A hypothesis I had to let go
I went in convinced that relative pay would matter. The idea that if you're the lowest-paid person on your team, you know it, and it nudges you toward the door. It's a clean story.
I tested it properly, with a feature-by-feature ablation, and it didn't hold up. Once the model already knew someone's absolute pay, tenure, and role, their pay rank within the team added nothing. So I cut it. A model is more trustworthy for the things you remove than the things you pile on.
Attrition Above Expected
This is the part I find the most fun. Take the per-employee predictions and roll them up to a leader. Sum them, and you get that team's expected turnover, given exactly who's on it. Compare it to what actually happened. The difference is the leader's signal, with the cohort they inherited controlled for.
Negative means they retained better than expected. That's the manager quietly holding onto a team the model thought was a flight risk.
The parts that took the most care
Getting this fair was harder than getting it to run.
The expected number can only use what a leader inherits: tenure, age, role, location, pay. If you let it see the team's own turnover history, it just learns to predict the leader's effect and explains it away. So the "expected" model is deliberately blind to anything the leader caused.
It also has to be calibrated. Across everyone, expected has to equal actual, the same way expected goals are tuned so a season's worth adds up to the real goal total. Without that, every manager looks like they're failing against a bar that's set too low.
And small teams will fool you. A five-person team can swing wildly on a single departure. So instead of a hard "we'll only rate teams above size N" cutoff, which hides good leaders of small teams, I moved to a discrete-time hazard view that counts every person-month of exposure and reports an honest confidence level based on how many departures actually back the estimate. Long-serving leaders of small teams still show up. They just show up with the uncertainty they've earned, not false precision.
The stack
Python, pandas, and scikit-learn doing the heavy lifting (gradient-boosted trees for the model). Local sentence-transformers handle the free-text side of the broader platform, so even the survey comments never touch an outside service. Everything lands in a conformed star schema that feeds the BI layer, so the risk scores and the leader metric sit right next to headcount and the rest of the people data, sliceable by the same filters.
What I took from it
The metric I'm proudest of isn't the model's accuracy. It's the restraint around it: a disconfirmed hypothesis I removed, a leader score that's a flag and not a verdict, and a confidence number that's willing to say "we don't have enough to judge this one yet." Borrowing a frame from hockey was the easy, fun part. Earning the right to trust the number was the work.
Regards, jordan kirchner / amoredatus / love data