← All projects

Credit Risk Early Warning System

Predicting sovereign rating changes 30 to 90 days ahead from daily market data with an LSTM and MLP fusion model.

Context
Course project, Machine Learning in Practice II
When
Spring 2026
Stack
Python, pandas, PyTorch, scikit-learn
Confusion matrix on the test period
Confusion matrix on the test period

The question

Can market signals that move every day, such as CDS spreads, bond yields and FX volatility, warn a bank that a country's S&P credit rating is about to change? The model looks at a 60-day window and predicts an upgrade, a downgrade or no change in the 30 to 90 days after it.

Data

Daily CDS, 10-year yield and FX volatility per country from 2010, exported from Bloomberg, plus monthly inflation, FX reserves and the policy rate forward-filled onto the daily grid. Targets come from the S&P rating history. About 96% of the training windows are "no change", which is the real difficulty of the task.

Approach

Result

The weighted model catches about half of the real upgrades and downgrades in the test period, but only by raising far too many false alarms, so in this form it is not a usable early warning system. I keep it in the portfolio as an honest negative result: with a handful of rating actions per country the event classes are too small for a sequence model, and a ranking formulation (flag the riskiest country-days) on engineered features is the better next step.