An interactive tool for bank advisors to assess client loan default risk, explore similar client profiles, and make informed credit decisions — powered by a LightGBM classifier.
When a client applies for a loan, a bank advisor opens this dashboard, enters the client's ID, and instantly sees:
- A default probability score — how likely is this client to miss a payment?
- A clear accept / monitor recommendation based on a configurable risk threshold
- Similar client profiles from the historical database for comparison
- Demographic comparisons — how does this client compare to people with the same education level, income bracket, marital status, or employer type?
- Interactive radar and bar charts for visual explanation to the client
- Model performance metrics (confusion matrix, ROC curve, precision-recall curve) for advisors who want to understand model reliability
Enter a client ID (range 100 002 – 112 188) and set the maximum acceptable default probability with the threshold slider.
The dashboard immediately shows:
- Default probability as a percentage
- ✅ Low risk — credit can be considered
⚠️ High risk — client requires closer review- Whether the client has a prior default history
The right panel shows the client's key financial indicators in plain language:
| Indicator | What it means |
|---|---|
| Loan Duration | Length of the requested loan in months |
| Annuity | Monthly repayment amount (€) |
| Age | Client's age at application |
| Employment Start | Years since the client started their current job |
| Annuity / Income ratio | Monthly repayment as a share of monthly income |
The model finds the 5 most similar clients in the historical database (using nearest-neighbour search) and displays their profiles and outcomes. This helps advisors understand how comparable cases were handled.
Select a demographic dimension — gender, education level, income bracket, company type, or marital status — to see:
- A bar chart showing how many clients in the same group repaid vs. defaulted
- A radar chart overlaying the client's profile against the average good-payer and average defaulter in their group
This gives advisors a visual story they can share directly with the client.
Expand the metrics panel to inspect the classifier's historical performance:
- Confusion matrix — true/false positive and negative rates
- ROC curve — overall discrimination ability (AUC)
- Precision-Recall curve — performance on the minority (default) class
- Python 3.10 or higher
- Git
git clone https://github.com/mhaegeman/scoring-bank-project.git
cd scoring-bank-project
pip install -r requirements.txtPYTHONPATH=src streamlit run src/scoring_bank/dashboard/app.pyOpen your browser at http://localhost:8501.
scoring-bank-project/
├── src/
│ └── scoring_bank/ # Installable Python package
│ ├── config.py # Centralised file paths & constants
│ ├── features/
│ │ └── engineering.py # Feature engineering & EDA utilities
│ ├── models/
│ │ ├── scorer.py # LightGBM prediction helpers
│ │ └── similarity.py # Nearest-neighbour client lookup
│ ├── data/
│ │ └── loader.py # Data loading functions
│ └── dashboard/
│ ├── app.py # Streamlit application entry point
│ └── visualizations.py # Radar charts & bar plots
├── models/ # Pre-trained model files (.pkl)
├── data/
│ └── data_api.csv # 10 000 client records (130+ features)
├── notebooks/ # Archived exploration notebooks
│ ├── 01_scoring_pipeline.ipynb
│ └── 02_api_data_prep.ipynb
├── tests/ # pytest test suite (43 tests, 64% coverage)
├── .github/workflows/ci.yml # GitHub Actions CI (lint + test on every push)
├── pyproject.toml # Package config, ruff, black, pytest, coverage
├── requirements.txt # Pinned runtime dependencies
└── requirements-dev.txt # Dev/test dependencies
The credit scoring model is a LightGBM classifier trained on the Home Credit Default Risk dataset. It combines features from seven source tables:
| Source table | What it contributes |
|---|---|
| Application | Demographics, income, employment, credit amount |
| Bureau | Previous loans from other institutions |
| Bureau Balance | Monthly status of those loans |
| POS Cash | Point-of-sale & cash loan history |
| Credit Card | Credit card balance history |
| Installments | Previous loan repayment behaviour |
| Previous Applications | Past Home Credit loan applications |
The model outputs a probability between 0 and 1. A bank advisor sets their own acceptance threshold — the maximum default probability they are willing to accept — depending on the portfolio risk appetite.
pip install -r requirements-dev.txt
PYTHONPATH=src pytest tests/ -vruff check src/scoring_bank/ tests/
black src/scoring_bank/ tests/Every push triggers the GitHub Actions pipeline which runs:
ruff— pyflakes + pycodestyle checksblack --check— formatting consistencypytestwith coverage (≥ 60% required on testable code)
To populate the images above, take screenshots of the running dashboard and save them to docs/images/:
docs/images/
├── 01_client_score.png
├── 02_client_profile.png
├── 03_similar_clients.png
├── 04_comparison_charts.png
└── 05_model_metrics.png
This project is for educational and demonstration purposes.




