I Built a Machine Learning Recession Tracker. Here's What It Says Right Now.
The yield curve uninverted 590 days ago. Every historical deadline has passed. But 4 red flags are still flashing — here's why that matters.
My Investments professor told me there’s no magic number of days a yield curve needs to stay inverted before it officially signals a recession. “If you try to find a pattern, you’ll find one — because you want to.”
He’s not wrong that confirmation bias is real. But he’s also wrong that the data has nothing to say.
So I built a model to find out for certain.
The Setup
The 2Y10Y yield curve — the spread between 10-year and 2-year Treasury yields — is the most-watched recession indicator in finance. Every major U.S. recession since 1976 has been preceded by an inversion. The conventional wisdom is that a recession follows 12–18 months after inversion ends.9.7 month median.
But “conventional wisdom” is just vibes dressed up in a suit. I wanted the actual numbers.
I pulled every daily 2Y10Y observation from FRED going back to 1976 and identified 44 distinct inversion episodes. Then I built a three-phase ML system to answer two questions:
Does inversion duration actually predict recessions, and if so, what’s the threshold?
What additional features push predictive accuracy from “better than random” to “actually useful”?
Phase 1: Duration Alone
The first surprising finding: the optimal duration threshold is 2 days.
That sounds like noise, but it’s actually meaningful. The model isn’t saying that 2-day inversions are dangerous — it’s saying that any sustained inversion carries signal. The threshold is effectively zero. My professor is right that there’s no magic number. The wrong conclusion is that there’s therefore no signal.
The logistic regression trained only on duration and depth features returned an AUC of 0.590 — barely better than a coin flip. My professor would say “I told you so.” But that’s Phase 1.
Phase 2: Adding Macro Context
When I added 14 features across five domains — credit spreads, labor market momentum, Fed policy regime, ISM/industrial data, and curve shape — the model jumped to AUC 0.819.
The LASSO automatically selected 8 of 21 features as actually predictive. The top three by SHAP importance:
Unemployment distance from cycle low — how far unemployment has risen from its trough when the inversion begins
Industrial production trend — the 6-month slope of IP at inversion start
10Y yield level at inversion start — the absolute rate environment
The single strongest binary signal: whether the 3M10Y spread also inverted (the “double inversion”). When both the 2Y10Y and 3M10Y are simultaneously negative, the model treats it as a high-confidence confirmation. In the 2022–2024 cycle, both inverted — the 3M10Y stayed negative from October 2022 all the way through December 2024.
Phase 3: Live Tracker
The system now runs daily, pulls fresh FRED data, and scores the current macro environment against the trained ensemble. It outputs a 0–100 recession risk score, updated every evening at 6pm ET.
Here’s what it said this morning:
Recession Risk Score: 37/100 — MODERATE LASSO: 38.2% | RF: 36.7% | Ensemble: 37.4%
Days since uninversion: 590 (19.4 months)
Status: BEYOND P90 WINDOW — RISK RECEDING
The historical median lead time from inversion end to recession start is 9.7 months — that window passed in June 2025. The P90 upper bound was January 2026. Both have passed without a recession.
Why 4 Red Flags Are Still Lit
A 37/100 score with a “BEYOND P90” status sounds like an all-clear. It isn’t — and this is the part worth paying attention to.
The model flags three features still in the RED zone from the 2022–2024 episode:
1. Log-duration = 6.7 (783 days). This inversion was the longest in recorded history. Every historical lead-time distribution in my training data was built from episodes averaging far shorter. When the model extrapolates a P90 window, it’s doing so from a sample that has no true analog to a 783-day inversion. The confidence interval on that P90 is wide.
2. HY credit spread at inversion start: 580 bps. High-yield spreads were already elevated when the curve first inverted in July 2022. That’s the credit market pricing in stress before the curve even broke. Historically, elevated HY spreads at inversion onset are associated with faster and deeper downstream damage.
3. Fed was hiking during inversion. The Fed raised rates 525 basis points across this cycle. Hiking while the curve is inverted accelerates the credit transmission mechanism — banks tighten lending standards, refinancing costs spike, and the damage compounds. The full effect of that tightening cycle may not have fully cleared.
The honest read: the base case is no recession. The +52 bps spread, no double inversion, and a BEYOND P90 status all point toward a soft landing holding. But the structural damage from the longest inversion in history — running through an aggressive Fed hiking cycle against a backdrop of already-stressed credit — means tail risk is non-trivially elevated. The tariff shock arriving in April 2026 is exactly the kind of exogenous catalyst that could activate latent damage the model is still flagging.
The Methodology Note
This model was trained on 44 inversion episodes with approximately 8 recession outcomes — a small-N problem I’m not going to hide. AUC 0.819 with LOO cross-validation is the right methodology for that sample size, and the improvement from 0.59 → 0.82 by adding macro features is robust. But wide confidence intervals come with the territory. I’m not publishing a 95% confidence interval because it would span most of the probability space — that’s the honest truth of building a recession model on 50 years of data with infrequent outcomes.
What I can say: the feature selection is economically intuitive, the validation is structurally sound, and the live tracker updates daily from official FRED data. That’s more rigor than most of what you’ll read on financial Twitter.
Disclaimer: Not investment advice. Model trained on historical data; past relationships between yield curve inversions and recessions may not persist.






