Abstract
With economic development and social progress, loans have become a cornerstone of modern banking. To mitigate financial risk, effective forecasting methods are essential. This paper proposes a loan forecasting pipeline based on XGBoost and feature importance evaluation. After rigorous data cleaning, we evaluate several machine learning models, finding that XGBoost performs best. To provide actionable insights for financial institutions, we employ SHAP (SHapley Additive exPlanations) to analyze feature importance and explain model outputs. Our results indicate that the principal paid by the borrower, the financing amount, and recovery amounts after default are the primary factors affecting risk. These findings offer a robust reference for risk management in loan approval processes.
Introduction
For modern financial institutions, loan interest is a primary revenue stream, but defaults represent a significant threat to stability. While Machine Learning (ML) has been applied to credit scoring, two major hurdles remain: the need for high efficiency and accuracy in processing massive fintech datasets, and the "black box" problem of model interpretability. Bank staff and regulators require transparency regarding why a loan is flagged as high-risk. This study addresses these challenges by comparing multiple algorithms and integrating interpretability tools to provide actionable risk insights.
Methodology
The research follows a rigorous data science workflow:
- Data Preprocessing: Features with over 95% identical values or 50% missing data were removed. Categorical data was transformed using Label Encoding.
- Model Selection: The study compared five algorithms: XGBoost, Support Vector Machines (SVM), Random Forest, Naive Bayes, and Decision Trees.
- XGBoost Optimization: XGBoost was selected as the core model due to its use of second-order Taylor expansion for the loss function and built-in regularization. Hyperparameters were tuned using Grid Search and 5-fold cross-validation.
- Interpretability Layer: SHAP values were used to quantify feature contributions to individual predictions, while Permutation Importance verified global variable impact.
Dataset
The study utilized a publicly available dataset from Lending Club, a major US peer-to-peer lending platform. The dataset contained 39,718 records. Initially comprising 111 features, the data was refined to 33 key variables after cleansing. The target variable was the loan status, categorized into "Fully Paid," "Charged Off," and "Current."
Results and Model Interpretability
XGBoost achieved a near-perfect score across all metrics, significantly outperforming the Bayesian and SVM baselines.
| Model | Accuracy | Precision | Recall | F1 Score |
|---|---|---|---|---|
| XGBoost | 0.9942 | 0.9943 | 0.9942 | 0.9942 |
| Random Forest | 0.9920 | 0.9921 | 0.9920 | 0.9920 |
| Decision Tree | 0.9854 | 0.9854 | 0.9854 | 0.9854 |
| SVM | 0.9472 | 0.9409 | 0.9472 | 0.9366 |
| Bayesian | 0.7035 | 0.8868 | 0.7035 | 0.7462 |
Beyond raw performance, the SHAP analysis revealed critical insights into the model's decision-making process. The most significant predictor of loan safety is total_rec_prncp (total principal received to date), as borrowers who have repaid a significant portion of their principal demonstrate both intent and capacity to fulfill their contracts.
Additionally, funded_amnt (the total loan amount) was the second most critical factor, as higher amounts correlate with increased repayment pressure. The study also mapped how features interact to influence the final risk assessment.
Conclusion
This research demonstrates that XGBoost, combined with SHAP interpretability, provides a powerful tool for loan default prediction. While the model achieves high accuracy on the Lending Club dataset, future work should incorporate dynamic, real-time credit data and test the model against more diverse global datasets to ensure broader generalizability across different financial markets.
Summary updated