October 09, 2026
Predictive model of default risk in banking customers using machine learning techniques
Predictive Model of Default Risk in Banking Customers Using Machine Learning Techniques
Luis Alberto Valverde Fernández; Cleverson Henrique de Freitas
DOI: 10.22167/2675-6528-202603212
Article derived from a Course Conclusion Work (TCC), with content based on the student’s original work and adapted to the editorial format of the E&S Magazine with the support of the ResumeAI tool, an artificial intelligence solution developed by Instituto Pecege for textual synthesis and organization.
Summary
Financial exclusion and the prevalence of informal credit in Peru motivated the search for innovative solutions for risk assessment. The objective was to develop a predictive model of default using machine learning techniques to support more accurate credit decisions and expand access to the formal financial system. For this purpose, a historical database of 3,478 credit records from a Peruvian municipal savings and loan cooperative was used, containing 22 cadastral, economic, and behavioral variables. Logistic Regression, Random Forest, and XGBoost models were tested, with data balancing via SMOTE, and evaluated by metrics such as AUC-ROC, KS, and Recall, in addition to explainability with SHAP. The XGBoost model achieved the best performance, with an AUC of 0.966 and a Recall of 88.9%, correctly identifying most defaulters. The business existence duration variable proved to be the most relevant for risk prediction. A risk scorecard was developed for operationalizing decisions. It was concluded that the proposed model offers a robust tool for microfinance institutions, enabling safer and more efficient credit decisions, reducing critical classification errors, and promoting financial inclusion through data-driven policies, such as maturity thresholds and guarantor requirements.
Keywords: Default; Machine learning; Microfinance; Peru; Credit risk.
1. Introduction
Access to credit is a fundamental pillar for financial inclusion and economic development, especially in emerging economies. In the Latin American context, Peru still stands out for presenting one of the lowest banking rates. Recent data indicate that, between 2020 and 2022, the share of the Peruvian population with a bank account grew from 42% to 52% (BCRP, 2023; Garrido Allepuz, 2024). However, this expansion is not homogeneous, with significant regional inequalities persisting, with Lima Metropolitana reaching about 63% banking penetration, while the Sierra and Selva regions register less than 44%. In these rural areas, low income is a limiting factor that hinders access to the formal financial system, making financial digitalization a promising alternative to expand inclusion.
Low financial inclusion in Peru has favored the proliferation of informal credit, manifested in schemes such as “gota a gota”. Although these loans are disbursed quickly and do not require collateral, they impose extremely high interest rates. According to the Peruvian Economic Institute, 49% of informal credits charge rates exceeding 500% per year. This type of credit exposes borrowers to severe risks, including over-indebtedness, violence, and significant financial losses, primarily affecting small entrepreneurs and vulnerable populations. Traditional credit models, often based on linear logistic regression, prove insufficient to capture the complexity and fluctuation of informal income, contributing to financial exclusion.
Given this scenario, a market vacuum is identified for more sophisticated risk assessment approaches. Financial institutions that adopt non-linear algorithms have the opportunity to read hidden risk, allowing them to absorb good clients who are currently rejected by the rigidity of traditional banking models. Machine learning emerges as a powerful tool to overcome these limitations, offering techniques such as Logistic Regression, Random Forest, and XGBoost, capable of processing large volumes of data and identifying complex default patterns. Additionally, Explainable Artificial Intelligence (XAI), through tools like SHAP, can bring transparency to these models, making their decisions understandable and reliable.
The relevance of this study lies in the urgency to improve credit decisions to mitigate the risks associated with informal credit and, simultaneously, expand access to the formal financial system for marginalized populations. Thus, the present work seeks to develop a predictive model of nonpayment using machine learning techniques (Logistic Regression, Random Forest, and XGBoost) to support more accurate credit decisions and expand access to the formal financial system in Peru.
2. Material and Methods
This research was characterized as a study of a quantitative nature and applied approach, aiming at the development of a predictive model. The central objective was to build and evaluate a system capable of predicting default in credit operations, using machine learning techniques. The methodology employed sought to provide subsidies for more assertive credit decisions, aligning with the need to expand access to the formal financial system in Peru.
The unit of analysis consisted of a historical database of credits, from a municipal savings bank located in Lambayeque, Peru. The dataset comprised 3,478 records of credit operations, each detailed by 22 distinct variables. These variables covered customer registration information, economic data, and behavioral aspects related to credit history.
The study’s target variable was default/non-payment, categorized in a binary fashion: 1 for defaulting clients and 0 for non-defaulting ones. Before modeling, a rigorous data preprocessing step was performed. Initially, missing values were handled, ensuring the completeness and integrity of the dataset for subsequent analysis stages.
Additionally, variables that presented potential for *data leakage*, a phenomenon that could introduce future information into the model’s training, compromising its real predictive capacity, were removed. Categorical variables were encoded using *one-hot encoding*, binary, and ordinal techniques, according to the nature of each attribute. Numerical variables, in turn, were subjected to normalization processes.
To select the most relevant variables, the *Information Value* (IV) of each attribute in relation to the target variable was calculated. This procedure allowed the identification and prioritization of variables with greater discriminatory power, optimizing the performance of predictive models and reducing the dimensionality of the dataset, focusing on the most significant predictors.
The exploratory data analysis stage included investigating the distribution of the target variable, where the proportion of default/ non-payment in the dataset was observed. Univariate and bivariate analyses of the variables were performed to identify patterns, relationships, and important characteristics that could influence default/ non-payment, providing an initial understanding of the data.
For predictive modeling, the dataset was divided into two parts: 80% for model training and 20% for testing. This split ensured that the models were evaluated on data not seen during training, providing a more realistic estimate of their performance in future scenarios. Supervised machine learning models were trained.
The machine learning algorithms selected for the development of the predictive model were Logistic Regression, Random Forest, and XGBoost. Each of these models was trained with both the original dataset and the balanced dataset, using the SMOTE (Synthetic Minority Over-sampling Technique) technique, in order to mitigate the imbalance between the default and non-default classes.
The performance evaluation of the models was carried out through several metrics. The Area Under the ROC Curve (AUC-ROC), the Kolmogorov-Smirnov (KS) statistic, the Gini coefficient, Precision, Recall, and F1-score were used. These metrics allowed for a comprehensive analysis of the discriminatory capacity, accuracy, and robustness of each model in predicting default.
After individual training and evaluation, the models’ performance was compared to identify the one with the best predictive performance. Additionally, an *overfitting* analysis was performed, examining the difference between the models’ performance on the training and test sets, to ensure the generalization capability of the developed models.
For the interpretability of the model’s decisions, the SHAP (SHapley Additive exPlanations) technique was applied. This tool allowed us to understand the global importance of each variable and the individual impact of each attribute on the model’s predictions. Based on the results, a risk *scorecard* was developed, with scores from 0 to 100, to assist in classifying credit risk.
3. Results and Discussion
The analysis of historical credit data from a Peruvian municipal savings bank revealed an overall default rate of 20.8%, a value significantly higher than the average of 6.1% observed in the Peruvian financial system. This finding underscores the urgency of improving risk assessment methods, especially in the microfinance sector, where the vulnerability of borrowers is accentuated. The high default rate not only compromises the sustainability of financial institutions but also perpetuates the cycle of exclusion, hindering access to formal credit for small entrepreneurs and marginalized populations, who often resort to high-cost and high-risk informal alternatives.
The in-depth investigation of default patterns allowed the identification of crucial risk factors impacting the microcredit portfolio. Firstly, sectoral risk proved to be a significant component, with 52.5% of defaults concentrated in the Personal Services and Beauty sectors. These businesses are characterized by their high sensitivity to economic shocks and the absence of substantial fixed assets, making them more vulnerable to market fluctuations and unforeseen events. Understanding this sectoral vulnerability is essential for formulating more adapted and preventive credit policies.
Secondly, the presence of a guarantee, specifically the figure of a guarantor, emerged as a statistically vital risk mitigation factor. It was observed that the nonpayment rate for loans with a guarantor was 9.07%, a significant reduction compared to the 22.65% recorded in operations without this protection. This data highlights the importance of the moral pressure exerted by the guarantor, which acts as an additional incentive for the fulfillment of financial obligations. The inclusion of guarantors, therefore, is not just a security measure, but a mechanism that strengthens the borrower’s responsibility and commitment.
Business maturity risk constituted the third prominent factor, revealing a strong inverse correlation with non-payment. It was found that 83.9% of overdue cases were associated with businesses less than two years old. As the venture’s maturity increased, the default rate progressively decreased, reaching 0% for businesses with more than six years of continuous operation. This result suggests that stability and accumulated experience over time confer greater financial resilience to businesses, making them less prone to payment failures on their debts.
To address the complexity of these risk factors, different predictive models for nonpayment were tested, including Logistic Regression, Random Forest, and XGBoost, with the aim of identifying the most effective approach. Logistic Regression, although offering high interpretability, demonstrated lower accuracy when attempting to model complex non-linear relationships, achieving an AUC of 0.954, a KS of 0.758, and a Recall of 86.8%. The Random Forest model, in turn, presented good spatial segregation and a superior Recall of 90.3%, with an AUC of 0.954 and a KS of 0.805, but proved prone to a higher rate of false positives in contexts of unbalanced data.
The XGBoost model, without the application of SMOTE for balancing, stood out as the best performing, being considered the “absolute champion” among the tested algorithms. This model achieved an AUC of 0.966, a KS of 0.810, and a Recall of 88.9%. Its superiority lies in its ability to capture subtle patterns in the data without distorting the original information, presenting an ideal balance between the detection rate of defaulters and generalization stability. The robustness of XGBoost allows for more accurate and reliable prediction, fundamental for credit decision-making in a microfinance environment.
The performance of the XGBoost model was evaluated by rigorous metrics, confirming its world-class accuracy. The AUC value of 0.966 widely surpasses the market threshold of 0.80 for operational credit models, indicating an almost perfect ability to separate good and bad payers. The KS statistic of 0.810 demonstrates a discrimination capability significantly superior to the average of 0.70 operated in the Peruvian financial system. Furthermore, the Recall rate of 88.9% is particularly relevant, as the model correctly identified 128 out of 144 actual defaulters in the test set, directly protecting the institution’s capital against imminent financial losses.
The stability of the XGBoost model was confirmed through 5-fold stratified cross-validation, which resulted in an average AUC of 0.969 ± 0.007, with no signs of overfitting (Δ < 0.10). This validation ensures that the model not only performs well on the training data but also maintains its effectiveness on new data, guaranteeing its practical applicability and long-term reliability. Generalization capability is a critical attribute for predictive models in dynamic environments such as the microfinance market.
The model’s explainability, achieved using the SHAP (SHapley Additive exPlanations) tool, allowed for the identification of variables that truly define default risk. The five most important variables were: business existence time, number of income sources, presence of fixed assets, initial debt, and monthly installment. The SHAP analysis increased the transparency of the model’s decisions, making the weight of each factor in risk prediction understandable. This clarity is fundamental for the acceptance and implementation of the model by credit analysts and for building trust with clients.
Among the identified variables, the business’s time in existence stood out as the most relevant factor. More mature businesses, with longer operating times, were associated with a lower risk of nonpayment, while recent ventures showed a higher probability of failure. This observation reinforces the interpretation that a business’s financial stability and resilience increase with experience and market establishment. Business maturity, therefore, serves as a robust indicator of payment capacity and venture solidity.
A practical example of the model’s application illustrates how risk factors combine to determine the probability of default. For a client classified with a 99.9% probability of default, the factors that most contributed to the increased risk were: the business being recent (only 0.9 years of existence, with an impact of +7.37), a high initial debt requested (+1.69), and possessing only one source of income (+0.51). In contrast, the presence of fixed assets (-0.28) and homeownership (-0.26) were factors that marginally reduced the risk, but were not sufficient to offset the high-risk elements. This transparent analysis allows analysts to understand the logic behind each decision.
The importance of the “business age” variable was further highlighted when comparing the model’s performance with and without its inclusion. Model A, which incorporated the age, presented an AUC of 0.966 and only 16 false negatives, demonstrating superior performance. In contrast, Model B, without this variable, obtained an AUC of 0.862 and 44 false negatives, representing a 175% increase in undetected defaulters. This result underscores that business maturity is the most important variable in the model, significantly reducing critical classification errors and, consequently, costs for the financial institution.
The analysis of costs associated with classification errors revealed that false positives, i.e., good customers rejected, represented 6.6% of the total, corresponding to 46 customers. This is the customer cost, a loss of business opportunity. False negatives, i.e., undetected defaulters, totaled 2.3%, equivalent to 16 defaulters. This is the bank’s cost, representing a higher risk of loss. The inclusion of business maturity in the model not only improves predictive performance but also reduces these critical costs, resulting in safer and more efficient credit decisions.
Despite the high performance of the XGBoost model, the analysis of the 16 false negatives, termed “camouflaged defaulters”, revealed an inherent limitation of machine learning. While classic defaulters were characterized by incipient businesses (average of 1.9 years), centralized income (1.46 sources), and low collateral (only 38% with assets), the camouflaged ones presented apparently ideal profiles at the time of disbursement, with established businesses (average of 3.5 years), diversified income (1.88 sources), and high anchoring (81% with collateral fixed assets).
The diagnosis for these disguised defaulters indicated that the default invariably occurred due to drastic and unpredictable external shocks, not cataloged in the structural data of the survey. Examples include natural phenomena such as El Niño or severe family health emergencies. This finding suggests that the absolute limit of machine learning lies in its inability to predict random and unpredictable events that occur post-credit granting, highlighting the need to complement algorithmic analysis with an understanding of the clients’ context and reality.
To operationalize the algorithm and translate complex probabilities into immediate guidelines, a risk scorecard was developed. This scorecard categorizes clients into four risk levels based on their score: Low Risk (Score 80-100), Medium Risk (Score 60-79), High Risk (Score 40-59), and Very High Risk (Score 0-39). For each category, a specific operational action is recommended, from automatic approval for low risks to summary rejection for very high risks, allowing for standardized and efficient decision-making.
Based on the model’s findings, three new implementable credit guidelines were proposed, which complement the algorithmic decision and enhance the approval process. The first is the “4-Year Maturity Threshold”, which exempts from the co-signer requirement only documented businesses that prove more than four years of continuous operation. This policy aims to reward stability and experience, aligning with the most important variable identified by the model.
The second guideline is the “Personal Services Security Lock”, which establishes the mandatory and non-negotiable requirement of a guarantor for entrepreneurs in the Personal Services and Beauty sector. This measure aims to mitigate the identified high sectoral risk of 52.5%, protecting the credit portfolio in more vulnerable segments. The third policy, the “Human Intervention Point”, makes manual analysis and in-person interviews mandatory for applications classified in the “Orange Zone” (score between 40 and 60). This human intervention seeks to reduce unfair rejections of micro-entrepreneurs with recovery potential, recognizing the limits of the model and the importance of qualitative assessment.
In summary, the results demonstrate that the XGBoost-based default predictive model offers a robust and accurate tool for microfinance institutions in Peru, outperforming traditional models and the market average across several metrics. The identification of business age as the most relevant variable, along with the ability to detect most defaulters and the proposal of a risk scorecard and clear credit guidelines, significantly contributes to safer and more efficient credit decisions. Such advancements promote financial inclusion by enabling institutions to absorb good clients who would be rejected by rigid models, while simultaneously mitigating risks and optimizing portfolio management.
4. Conclusion
This study sought to develop a predictive model of default using machine learning techniques to support more accurate credit decisions and expand access to the formal financial system in Peru. A high rate of default was observed in the microcredit portfolio, at 20.8%, and it was identified that sector risk, the absence of a guarantor, and business maturity were crucial factors. Among the models tested, XGBoost achieved the best predictive performance, with an AUC of 0.966 and a Recall of 88.9%, significantly outperforming market standards. Explainability analysis with SHAP revealed that the business’s time in existence was the most relevant variable for risk prediction. The main contribution lies in the proposal of an operational risk scorecard and innovative credit guidelines, such as the 4-Year Maturity Threshold and the Personal Services Security Lock, which allow microfinance institutions to make safer and more efficient decisions, reducing critical classification errors and promoting financial inclusion.
However, the study acknowledged that machine learning has an inherent limitation in predicting random and unpredictable post-credit granting events, such as drastic external shocks that generate so-called “hidden defaulters”. Furthermore, the results are confined to a single agency and a specific period, which suggests the need to verify their external validity. For future studies, it is recommended to validate the model in other agencies or periods, as well as to incorporate post-granting behavioral variables, in order to further enhance the predictive capacity and robustness of credit decisions. Such advances can strengthen risk management and expand access to formal credit for vulnerable populations, contributing to economic and social development.
Bibliographic References
BCRP, 2023 [Full reference not found in the original document]
Garrido Allepuz, 2024 [Full reference not found in the original document]
Article originating from the Final Course Project of the Specialization in Data Science and Analytics of the MBA USP/Esalq
To learn more about the course, click here and access the MBX Academy platform