Risk Analytics · Python · LightGBM · SHAP

Customer Financial Risk Scoring System

A customer-level risk analytics system built for Narsent to identify deteriorating payment behavior before it became obvious in traditional receivables reporting.

The system combined predictive modeling, risk calibration, portfolio segmentation, exposure analysis, and explainability into a single scoring pipeline designed to support finance and collection decisions.

GitHub repository

My role

The risk-scoring system was developed by a three-person team. My primary contribution was designing the analytical framework: defining how PD, LGD, DPD, exposure, risk buckets, and explainability should fit together, and adapting the system to receivables and financial-risk use cases.

That meant translating business and sector requirements into analytical and modeling requirements, and defining how model outputs should support portfolio and collection decisions. I also wrote code — co-developing the implementation and contributing directly to the Python modeling pipeline and validation work — but the implementation was collaborative rather than solely mine.

From overdue reporting to forward-looking risk

Traditional receivables reports are largely backward-looking. They tell a finance team which accounts are already overdue, but provide less help in distinguishing temporary payment friction from customers whose risk is materially deteriorating.

I approached the problem as three related risk dimensions:

Probability
How likely is the customer to move into a high-risk payment state?
Severity
If that happens, how much financial exposure could be affected?
Timing
How much payment delay should be expected?

The system modeled these through PD, LGD, and DPD signals and translated them into a portfolio-level scoring framework.

Three risk dimensions

PD — Probability of Default
A probability-style signal representing customer default / high-risk payment behavior.
LGD — Loss Given Default
A loss-severity signal representing potential financial loss if the customer defaults.
DPD — Days Past Due
Expected payment delay measured in days.

PD and LGD in this implementation are engineered proxy targets derived from payment behavior and exposure variables, rather than regulatory-grade estimates trained on realized default and recovery outcomes.

DPD is based on observed payment-delay behavior.

Combining non-linear and interpretable models

The modeling layer combines gradient boosting with linear models so that non-linear customer behavior can be captured without relying on a single modeling approach.

LightGBM captures non-linear relationships and interactions, while the regression branch provides a simpler complementary model.

PD
LightGBM + Logistic Regression
LGD
LightGBM + Linear Regression
DPD
LightGBM + Linear Regression
Ensemble weighting
70% LightGBM · 30% linear / logistic model

The implementation uses a time-based 80/20 split rather than a random split.

The shared feature layer is StandardScaler-transformed features, not a neural-network embedding.

Signals behind the score

  • average payment delay
  • delayed-payment ratio
  • payment ratio
  • current outstanding debt
  • total invoice amount
  • upstream propensity-to-pay score
  • historical risk score
  • severe-delay counts
  • risk volatility
  • recent risk trend

The scoring module consumes customer-level engineered features from an upstream payment-prediction pipeline.

Optional external and collections enrichment is supported as a system capability, and is not assumed present in every training run.

Turning predictions into a decision signal

  1. Generate PD, LGD, and DPD predictions.
  2. Calibrate individual model outputs.
  3. Normalize DPD.
  4. Combine the three dimensions into a composite risk measure.
  5. Scale the composite score to 0–100.
  6. Assign the customer to a risk bucket.
  7. Calculate risk-adjusted exposure.
  8. Surface urgent cases for operational review.
Composite weighting
PD: 50% · LGD: 30% · DPD: 20%
Low
0–40
Medium
40–70
High
70–85
Critical
85–100
Urgent-contact logic
risk score > 90 AND default probability > 0.80

The output is designed for portfolio triage and prioritization, not simply as an ML prediction.

Risk is more useful when connected to exposure

A high probability of payment stress does not carry the same business consequence for every customer.

The pipeline therefore combines risk information with current outstanding debt to produce a risk-adjusted exposure measure. This creates a more useful portfolio view: finance teams can distinguish between customers who are risky but financially small and accounts where deterioration could materially affect cash collection.

The final output also identifies high-risk customers and generates urgent-contact flags for accounts crossing both score and probability thresholds.

Why is this customer risky?

A portfolio score is difficult to use operationally if the user cannot understand what is driving it.

The pipeline uses SHAP TreeExplainers on the LightGBM models to calculate customer-level feature contributions for PD, LGD, and DPD.

The three explanation layers are combined using the same conceptual risk weighting: PD: 50% · LGD: 30% · DPD: 20%.

For each customer, the system can surface the most influential risk factors rather than returning only a score.

Examples of interpretable risk drivers in the implementation include payment delays, current debt, payment ratios, severe-delay frequency, risk volatility, and recent risk trends.

This makes the model output more useful for analyst review and operational follow-up.

Evaluating different types of risk

Different risk targets require different evaluation approaches.

PD
ROC-AUC
LGD
RMSE · MAE
DPD
RMSE · MAE

The implementation uses an ordered 80/20 holdout rather than a random split, preserving the sequence of the input data.

What the pipeline produces

  • calibrated risk score, 0–100
  • default-probability signal
  • loss-severity signal
  • predicted days past due
  • Low / Medium / High / Critical risk bucket
  • risk-adjusted financial exposure
  • top SHAP risk drivers
  • high-risk customer count
  • urgent-contact flag
  • urgent-contact customer list

What this model is, and what it is not

This system was developed as an operational receivables-risk layer within a broader decision pipeline, not as a regulatory credit underwriting model.

PD and LGD targets in the current implementation are engineered proxies based on observed payment behavior, debt, payment ratios, and upstream risk signals rather than realized default and recovery histories.

Where realized outcomes are unavailable, the calibration layer can operate using self-calibration. A production credit-risk implementation would instead require observed outcomes, out-of-time validation, stability monitoring, calibration testing, and formal model-governance controls.

Data and public reproducibility

The original risk-scoring system was connected to a broader AWS-based data pipeline. Production data and upstream pipeline inputs are confidential and intentionally excluded from the public repository, so the public notebooks do not contain a reproducible production run or publishable performance outputs.

For that reason, this case study focuses on the system design, risk framework, modeling methodology, calibration logic, and explainability rather than showing unverifiable performance charts.

What I learned

The project changed how I think about risk modeling.

A useful risk system is not only about maximizing predictive performance. It also requires a clear definition of risk, appropriate validation, calibrated outputs, exposure context, interpretable drivers, and a way to translate model signals into portfolio decisions.

Working across those layers made the distinction between building a model and building a usable risk-analysis system much more concrete for me.