🏦 Credit Risk Assessment DNN

A custom Deep Neural Network with Feature Attention Gate trained on the Taiwan Credit Card Default dataset (30,000 samples, 23 features) to predict credit default risk.

Model Architecture

CreditRiskDNN( FeatureAttention(23 β†’ 23) # soft attention gate per feature Linear(23 β†’ 128) + BatchNorm + ReLU + Dropout(0.3) Linear(128 β†’ 64) + BatchNorm + ReLU + Dropout(0.3) Linear(64 β†’ 32) + BatchNorm + ReLU Linear(32 β†’ 1) # binary output )

Performance

Metric Score
ROC-AUC ~0.79
F1 (default) ~0.68
Threshold 0.4

Usage

from huggingface_hub import hf_hub_download
import torch, pickle

# Download artifacts
hf_hub_download("pankajkapri/credit-risk-dnn", "best_model.pth", local_dir="outputs")
hf_hub_download("pankajkapri/credit-risk-dnn", "scaler.pkl",     local_dir="outputs")

# Load
scaler = pickle.load(open("outputs/scaler.pkl", "rb"))
model  = CreditRiskDNN(n_features=23)
model.load_state_dict(torch.load("outputs/best_model.pth", map_location="cpu"))
model.eval()

# Predict
raw      = [200000, 2, 2, 2, 35, -1, -1, -1, -1, -1, -1,
            50000, 48000, 45000, 43000, 41000, 40000,
            5000,  5000,  5000,  5000,  5000,  5000]
scaled   = scaler.transform([raw]).tolist()
X        = torch.tensor([scaled], dtype=torch.float32)
with torch.no_grad():
    prob = torch.sigmoid(model(X)).item()
print(f"Default probability: {prob:.1%}")

Live Demo

Fairness

Audited across age groups using fairlearn β€” demographic parity difference and equalized odds reported.

Explainability

SHAP KernelExplainer used for global feature importance and per-prediction waterfall charts.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support