Early-warning index for systemic risk & financial stress in Morocco: market-based CISS + CamemBERT news-sentiment index + RNN forecasting.
# Financial-stress early-warning index (CISS + French NLP sentiment)
An early-warning system for **systemic risk and financial stress in Morocco**. It combines a
quantitative composite stress index (CISS) built from market data with a **qualitative sentiment
index** extracted from French-language economic news via CamemBERT, then forecasts stress ahead
of time with recurrent neural networks. Built as an engineering end-of-studies project, in
collaboration with a financial-market regulator in Morocco (name withheld).
**Author:** @zriri9a (co-authored)
**Period:** 2025-01 → 2025-06
**Status:** shipped (defended) — research prototype, not a production service
**Stack:** Python, pandas, numpy, statsmodels, scikit-learn (+ SHAP), TensorFlow/Keras (LSTM/SimpleRNN),
Hugging Face Transformers (CamemBERT), `arch` (GARCH), hmmlearn / Markov regime-switching, matplotlib/seaborn
## What's interesting here
- **Two complementary stress signals, compared head-to-head.** A market-based CISS and a
news-sentiment index are built on the same timeline, and the notebooks show the sentiment index
turning *before* the market index at COVID-19 (2020) and the 2022 energy shock — the whole point
of the project.
- **A GDP-regressed weighting scheme for CISS.** Instead of equal-weighting the four market
sub-indices (money, bond, equity, FX), sub-index weights come from a regression on quarterly GDP
(`02_ciss_regression_gdp_weighting.ipynb`). The "CISS Reg" reacts more sharply and meaningfully to
real macro shocks than the equal-weighted version.
- **French financial NLP that actually works.** CamemBERT sentiment scoring of economic articles,
plus a lexicon fallback (FEEL + a Kaggle FR lexicon), with an alert threshold on the sentiment
score.
- **A full forecasting ladder.** Classical (ARIMA / linear / Markov-switching) → tree/ML (RandomForest
+ SHAP, GARCH volatility) → deep learning (LSTM/RNN). The RNN wins on the non-linear dynamics.
## How to run it
The data files are **not** included …