Editing
AI for Risk Management in Banking
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== <span style="color: #FFFFFF;">Applying</span> == '''Credit risk model with SHAP explainability for regulatory compliance:''' <syntaxhighlight lang="python"> import pandas as pd import numpy as np from sklearn.model_selection import TimeSeriesSplit from sklearn.metrics import roc_auc_score from sklearn.calibration import CalibratedClassifierCV import lightgbm as lgb import shap # Load loan application + performance data df = pd.read_csv("loan_data.csv") # LendingClub or internal loan data df['default'] = (df['loan_status'].isin(['Charged Off', 'Default'])).astype(int) # Feature engineering df['dti_ratio'] = df['dti'] / 100 df['installment_to_income'] = df['installment'] / (df['annual_inc'] / 12) df['credit_history_years'] = (pd.to_datetime(df['issue_d']) - pd.to_datetime(df['earliest_cr_line'])).dt.days / 365 features = ['loan_amnt', 'int_rate', 'dti_ratio', 'installment_to_income', 'fico_range_low', 'delinq_2yrs', 'inq_last_6mths', 'open_acc', 'pub_rec', 'revol_util', 'total_acc', 'credit_history_years'] X, y = df[features].fillna(df[features].median()), df['default'] # Time-series CV (critical: must not use future data for credit models) tscv = TimeSeriesSplit(n_splits=5) ginis = [] for train_idx, val_idx in tscv.split(X): model = lgb.LGBMClassifier(n_estimators=300, max_depth=5, learning_rate=0.05, min_child_samples=50, reg_lambda=1.0) model.fit(X.iloc[train_idx], y.iloc[train_idx]) preds = model.predict_proba(X.iloc[val_idx])[:, 1] ginis.append(2 * roc_auc_score(y.iloc[val_idx], preds) - 1) print(f"Mean Gini: {np.mean(ginis):.3f} Β± {np.std(ginis):.3f}") # Target: >0.40 # SHAP for regulatory explainability (SR 11-7 compliance) model.fit(X, y) explainer = shap.TreeExplainer(model) shap_values = explainer.shap_values(X) # Global: feature importance for model documentation shap.summary_plot(shap_values, X) # Individual: explain a specific loan decision (adverse action notice) loan_idx = 42 print("\nLoan decision explanation:") for feat, val in sorted(zip(features, shap_values[loan_idx]), key=lambda x: abs(x[1]), reverse=True)[:5]: direction = "β risk" if val > 0 else "β risk" print(f" {feat}: {direction} (SHAP={val:.3f}, value={X.iloc[loan_idx][feat]:.2f})") # Calibration: PD must be well-calibrated for IFRS 9 calibrated = CalibratedClassifierCV(model, cv='prefit', method='isotonic') calibrated.fit(X, y) # Ensures predicted PD = actual default rate at each score level </syntaxhighlight> ; Banking risk AI tools : '''Credit scoring''' β FICO Score (traditional), zest.ai, Scienaptic AI (ML credit) : '''Market risk''' β MSCI RiskManager, Axioma Qontigo, Bloomberg PORT : '''Stress testing''' β Moody's Analytics, S&P Global Market Intelligence : '''Explainable ML''' β InterpretML (EBM), SHAP, IBM AI Fairness 360 : '''Systemic risk''' β SRISK (NYU Stern), BIS network analysis tools </div> <div style="background-color: #8B4500; color: #FFFFFF; padding: 20px; border-radius: 8px; margin-bottom: 15px;">
Summary:
Please note that all contributions to BloomWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
BloomWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information