This document describes the current machine learning specification for the Credit Growth Analytics Pipeline.
The repository implements a responsible credit-growth Next-Best-Action system. The objective is not to automate credit approval. The objective is to prioritise customers for suitable commercial review by combining:
P(conversion) × P(responsible credit behaviour) × Expected Credit Value × Eligibility Rules
The current implemented classifier is:
sklearn.ensemble.ExtraTreesClassifier
It is wrapped inside a scikit-learn Pipeline with preprocessing.
The choice of Extra Trees is suitable for this portfolio version because it is:
- robust for mixed numerical and categorical tabular features after encoding;
- relatively fast to train;
- able to capture non-linear interactions;
- less sensitive to monotonic transformations than linear models;
- useful as a strong, reproducible tabular benchmark.
A HistGradientBoostingClassifier is a strong candidate for a future model comparison layer, but it is not the current implemented champion in this repository. The current repository should describe the implemented model as Extra Trees unless the code is later changed.
| Component | Target / output | Model type | Purpose |
|---|---|---|---|
| Conversion model | converted_next_3m |
Extra Trees classifier | Estimate probability of customer conversion |
| Responsible behaviour model | responsible_credit_behaviour_6m |
Extra Trees classifier | Estimate probability of responsible credit behaviour |
| Expected value layer | expected_credit_value |
Deterministic product-value calculation | Estimate commercial value by recommended product |
| Ranking layer | responsible_nba_score |
Business scoring equation | Rank customers for Next-Best-Action review |
Current classifier configuration:
| Parameter | Value | Rationale |
|---|---|---|
n_estimators |
120 | stable ensemble size for the synthetic portfolio scale |
max_depth |
9 | limits complexity and reduces overfitting risk |
min_samples_leaf |
25 | smooths terminal leaves and improves generalisation |
class_weight |
balanced |
accounts for imbalanced target rates |
random_state |
42 | reproducibility |
n_jobs |
-1 | parallel training |
The model uses a scikit-learn ColumnTransformer.
| Feature type | Transformation |
|---|---|
| Numeric features | median imputation |
| Categorical features | most-frequent imputation + one-hot encoding |
| Unlisted fields | dropped from the model matrix |
The one-hot encoder uses handle_unknown='ignore', which allows the scoring pipeline to handle categories not observed during training.
The current model uses 21 features:
| Feature group | Features |
|---|---|
| Profile | age, tenure_months, annual_income, income_band_score |
| Engagement | digital_engagement_score, engagement_score, salary_inflow_flag |
| Financial behaviour | savings_balance, credit_balance, recent_balance_growth |
| Credit exposure | utilisation_ratio, arrears_last_6m, credit_to_income_ratio |
| Relationship depth | number_of_products, product_depth_score |
| Affordability | affordability_proxy, balance_to_income_ratio |
| Categorical context | region, employment_type, customer_segment |
| Recent enquiry | recent_credit_enquiry_flag |
The feature list is defined centrally in src/config.py to keep training and scoring consistent.
The repository uses a time-ordered train/test split. The test set uses the latest labelled months with at least one positive label for the selected target.
This avoids an uninformative validation period where the latest month has no positive observations.
Current split outputs:
| Model | Train rows | Test rows | Train positive rate | Test positive rate |
|---|---|---|---|---|
| Conversion model | 18,000 | 3,600 | 8.71% | 8.83% |
| Responsible behaviour model | 18,000 | 3,600 | 80.07% | 80.44% |
| Model | Target | ROC-AUC | PR-AUC | Brier score | Precision@50 | Precision@100 |
|---|---|---|---|---|---|---|
| Conversion model | converted_next_3m |
0.631 | 0.155 | 0.225 | 28% | 27% |
| Responsible behaviour model | responsible_credit_behaviour_6m |
0.649 | 0.868 | 0.230 | 92% | 90% |
These metrics are generated from synthetic data and should be treated as demonstration outputs, not real-world credit-risk evidence.
After both models generate probabilities, the scoring layer selects a recommended product and calculates:
responsible_nba_score =
p_conversion × p_responsible × expected_credit_value × eligible_for_responsible_offer
Eligibility rules set the score to zero where customers fail responsible-lending guardrails.
Current eligibility exclusions include:
- recent arrears signal;
- utilisation ratio above 90%;
- no stable income signal;
- annual income below the portfolio threshold.
The validation layer compares three targeting approaches:
| Approach | Precision@50 conversion | Precision@50 responsible conversion | Expected value captured | Eligible share |
|---|---|---|---|---|
| Manual rule-based segmentation | 20% | 16% | £59,500 | 100% |
| Conversion-only model | 26% | 20% | £55,196 | 82% |
| Responsible NBA model | 24% | 22% | £59,500 | 100% |
The Responsible NBA model is positioned as the preferred decision approach because it balances conversion, responsible behaviour, expected value, and eligibility discipline.
The pipeline saves trained model artefacts to:
outputs/models/conversion_model.joblib
outputs/models/responsible_behaviour_model.joblib
It also exports dashboard-ready metrics to:
dashboard/data/model_metrics.csv
dashboard/data/benchmark_comparison.csv
dashboard/data/nba_ranked_customers.csv
dashboard/data/governance_checks.csv
Future versions may add:
- HistGradientBoostingClassifier as a challenger model;
- Logistic Regression as an interpretable baseline;
- calibration curves and probability calibration;
- SHAP or permutation importance for richer explainability;
- uplift modelling once treatment-log outcomes exist;
- fairness and segment-performance diagnostics;
- model registry-style artefact tracking;
- automated GitHub Actions validation.
This model is designed for demonstration and decision support. In a real financial institution, final usage would require:
- formal affordability assessment;
- credit risk policy approval;
- compliance and fair-treatment review;
- consent and data-protection controls;
- human review before customer contact;
- post-deployment monitoring;
- intervention logging and outcome measurement.