XGBoost-based credit risk prediction method, equipment and medium
By constructing a five-level credit classification model using the XGBoost algorithm and factor analysis, and combining it with SMOTE oversampling technology and feature importance screening, the problem of high dimensionality and dynamic changes in credit data is solved. This enables high-precision, highly generalized credit risk prediction and seamless integration with business systems, improving the model's real-time performance and reliability.
Patent Information
- Application Number
- CN202511351164.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-22
- Publication Date
- 2025-10-31
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing credit five-level classification models struggle to effectively capture implicit relationships in high-dimensional, non-linear, and dynamically changing borrower data, resulting in insufficient classification accuracy. Furthermore, the lack of a dynamic update mechanism makes them unable to adapt to economic cycle fluctuations, and the model deployment is disconnected from business systems, making it difficult to guarantee the real-time performance and reliability of classification results.
By employing the XGBoost algorithm combined with factor analysis and SMOTE oversampling techniques, a dynamic and adaptive five-level credit classification model is constructed through feature dimensionality reduction and feature importance screening. This model is then seamlessly integrated into the credit business system via an API interface, allowing for real-time updates of model parameters to adapt to environmental changes.
It significantly improves the accuracy and robustness of credit risk prediction, enhances the ability to identify high-risk samples, achieves seamless integration and continuous performance optimization between the model and business systems, and reduces the risk of missed detections and the cost of manual review.
Smart Images

Figure CN120875580A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of financial technology, and in particular to a credit risk prediction method, device and medium based on XGBoost. Background Technology
[0002] Credit classification is a crucial risk management tool for financial institutions. It categorizes loans into five levels: normal, watch list, substandard, doubtful, and loss, providing a basis for risk warning and asset quality assessment. Traditional classification methods heavily rely on expert experience and qualitative analysis, evaluating borrower data through manual rules or simple statistical models. However, with the development of corporate groups, the borrower data faced by finance companies exhibits high dimensionality, non-linearity, and dynamic changes. For example, complex equity structures among member units, dynamic fluctuations in financial indicators, and diverse repayment patterns make it difficult for traditional methods to effectively capture the implicit relationships in this data, leading to insufficient classification accuracy and missed risk assessments. Especially when dealing with multi-source heterogeneous data, expert experience is easily influenced by subjective factors and cannot adapt to changes in risk characteristics brought about by economic cycle fluctuations.
[0003] In existing technologies, some machine learning-based classification models attempt to improve classification efficiency through algorithms such as logistic regression and decision trees, but significant shortcomings remain. First, redundant features in credit data (such as multicollinearity between shareholder background and financial indicators) are not effectively filtered out, leading to model overfitting and limited generalization ability. Second, model parameter optimization relies on manual trial and error, lacking a systematic hyperparameter search and verification mechanism, making it difficult to balance classification accuracy and computational efficiency. Third, credit data naturally suffers from class imbalance, with a large proportion of normal class samples and sparse samples of high-risk categories (such as loss classes). Traditional models are insufficient in identifying these minority categories, easily leading to missed detections of high-risk loans. Furthermore, existing solutions mostly focus on static model construction, lacking a dynamic update mechanism, and cannot iterate model parameters and feature sets in real time based on new credit data, resulting in gradual degradation of classification performance after long-term application.
[0004] Furthermore, existing technologies lack a systematic design for the business deployment and monitoring of the five-level credit classification model. Most solutions only remain at the offline training and testing stage, failing to deeply integrate with core business systems such as credit approval and post-loan management, making it difficult for prediction results to guide risk control decisions in a timely manner. Simultaneously, the lack of a continuous tracking and feedback mechanism for prediction results after model deployment makes it impossible to identify model deviations caused by changes in the economic environment or fluctuations in the borrower's operating status, thus failing to guarantee the real-time nature and reliability of the classification results.
[0005] Therefore, how to construct a high-precision, highly generalized, and dynamically adaptive five-level classification model in credit business scenarios, and achieve seamless integration with business systems and continuous performance optimization, has become a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0006] This application provides a credit risk prediction method, device, and medium based on XGBoost to solve the following technical problem: how to build a high-precision, strong generalization, and dynamically adaptive five-level classification model in credit business scenarios, and achieve seamless integration with business systems and continuous performance optimization.
[0007] In a first aspect, embodiments of this application provide a credit risk prediction method based on XGBoost. The method includes: collecting multi-dimensional credit data of borrowers and preprocessing the multi-dimensional credit data to obtain data to be analyzed; wherein, the multi-dimensional credit data includes at least: customer basic information characteristic variables, financial characteristic variables, and transaction record characteristic variables; performing feature dimensionality reduction on the data to be analyzed using factor analysis to extract core characteristic variables related to credit risk from the data to be analyzed; wherein, the core characteristic variables include shareholder control factors, financial health factors, and repayment ability factors; inputting the core characteristic variables and transaction record characteristic variables as training sets into the XGBoost model, and performing gradient descent... The XGBoost algorithm trains a multi-class decision tree to generate an initial classification model. Grid search and cross-validation are then used to optimize the hyperparameters of the initial classification model to obtain the XGBoost classification model. Core feature variables and transaction record feature variables are input into the XGBoost classification model. Based on the feature importance ranking output by the XGBoost classification model, redundant features with contributions below a preset threshold are filtered out. The filtered feature variables to be applied are then input into the XGBoost classification model to generate a five-level credit classification model. This five-level credit classification model is then deployed to the credit business system to receive borrower data in real time and output the five-level classification results.
[0008] In one embodiment of this application, multi-dimensional credit data is preprocessed to obtain data to be analyzed. Specifically, this includes: identifying and removing outliers in customer basic information feature variables and financial feature variables using the Z-score detection method; filling missing financial feature variables with the mean of similar borrowers and filling missing transaction record feature variables with the median; and standardizing continuous variables in the financial feature variables so that their mean is a first preset value and their standard deviation is a second preset value.
[0009] In one embodiment of this application, before performing feature dimensionality reduction on the data to be analyzed using factor analysis to extract the core feature variables related to credit risk in the data to be analyzed, the method further includes: performing class balancing processing on the data to be analyzed using SMOTE oversampling technology, specifically including: identifying minority class samples of the five-level classification in the data to be analyzed; and generating synthetic samples to expand the minority class samples in the data to be analyzed based on the feature space distribution of the minority class samples.
[0010] In one embodiment of this application, factor analysis is used to reduce the dimensionality of the data to be analyzed in order to extract the core feature variables related to credit risk in the data to be analyzed. Specifically, this includes: calculating the covariance matrix between feature variables based on the data to be analyzed, and extracting initial factors through principal component analysis; rotating the initial factors using the maximum variance method to generate an interpretable factor loading matrix; and selecting factors whose variance contribution rate exceeds a preset threshold as core feature variables based on factor scores.
[0011] In one embodiment of this application, the hyperparameters include: the maximum depth of the tree, the learning rate, and the subsample sampling ratio. The hyperparameters of the initial classification model are optimized using a grid search and cross-validation method to obtain the XGBoost classification model. Specifically, this includes: defining a hyperparameter search space; wherein the maximum tree depth search space is a preset first search range, the learning rate search space is a preset second search range, and the subsample sampling ratio search space is a preset third search range; dividing the training set into several subsets, sequentially selecting a first number of subsets for model training through cross-validation, and validating the model performance using the remaining second number of subsets; traversing all hyperparameter combinations and calculating the cross-validation accuracy, selecting the parameter combination with the highest accuracy to update the initial classification model to obtain the XGBoost classification model.
[0012] In one embodiment of this application, based on the feature importance ranking output by the XGBoost classification model, core feature variables and transaction record feature variables are screened, and redundant features with a contribution value lower than a preset threshold are removed. Specifically, this includes: calculating the contribution of each feature variable to the classification result based on the feature gain value output by the XGBoost model; marking feature variables with a contribution value lower than the preset threshold as redundant features and removing them from the training set.
[0013] In one embodiment of this application, a five-level credit classification model is deployed to a credit business system to receive borrower data in real time and output five-level classification results. Specifically, this includes: encapsulating the five-level credit classification model into a callable API interface and integrating it into the credit approval system; receiving new credit data from borrowers in real time and generating five-level classification results by calling the API interface; mapping the classification results to risk level labels and pushing them to the credit approval terminal and the post-loan management terminal.
[0014] In one embodiment of this application, the method further includes: periodically collecting new credit data and corresponding actual classification labels, dividing the new data into a validation set; calculating the prediction accuracy and recall of the current model based on the validation set; if the recall is lower than a preset threshold, triggering a model retraining process, including: merging the new data with the historical training set, re-executing factor analysis to update the core feature variables; retraining and optimizing the XGBoost classification model based on the updated feature set; and deploying the updated model version to the credit business system.
[0015] Secondly, embodiments of this application also provide a credit risk prediction device based on XGBoost, the device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform an XGBoost-based credit risk prediction method as described above.
[0016] Thirdly, embodiments of this application also provide a non-volatile computer storage medium for credit risk prediction based on XGBoost, which stores computer-executable instructions. When the computer-executable instructions are executed, they implement a credit risk prediction method based on XGBoost as described above.
[0017] The credit risk prediction method, device, and medium based on XGBoost provided in this application have the following beneficial effects: 1. This invention significantly improves the accuracy of risk feature extraction by constructing a multi-dimensional credit data evaluation system and using factor analysis dimensionality reduction technology. In response to the complex and high-dimensional nature of data from group member units, the model effectively captures the implicit risk associations of borrowers by integrating core features such as shareholder control factors and financial health factors. At the same time, by combining dynamic transaction record data, it addresses the problem of insufficient ability of traditional methods to model multidimensional nonlinear relationships, enabling the classification model to accurately distinguish between loans with blurred risk boundaries, such as those in the normal category and those in the watch list category.
[0018] 2. This invention effectively enhances the ability to identify high-risk samples by using SMOTE oversampling technology and XGBoost feature importance screening mechanism. To address the industry pain point of unbalanced credit data categories, this paper expands the high-risk category dataset by generating synthetic samples to avoid the model ignoring minority class samples. Furthermore, by combining the gain evaluation mechanism of XGBoost, redundant features are eliminated to remove interference with the prediction results, which significantly improves the recall rate of high-risk categories such as "substandard" and "suspicious" and greatly reduces the risk of missed detections.
[0019] 3. This invention employs a dual optimization strategy of grid search and dynamic iteration to achieve continuous adaptation of model performance to business scenarios. The grid search mechanism based on cross-validation automatically matches the optimal combination of hyperparameters such as tree depth and learning rate, overcoming the subjective bias of manual parameter tuning. At the same time, by adding data validation and model retraining processes, it corrects feature distribution shifts caused by changes in the economic environment in real time, ensuring that the classification model maintains high accuracy and strong robustness in long-term applications.
[0020] 4. This invention achieves full-process automation of credit risk management through API interface encapsulation and risk warning linkage mechanism. The classification model is seamlessly integrated into the credit approval system, supporting real-time data input and millisecond-level classification response. Combined with early warning signals, it automatically triggers risk control operations such as post-loan verification and credit limit adjustment, solving the problem of disconnect between traditional offline models and business systems. This greatly improves the overall efficiency of risk disposal and saves finance companies a lot of manual review costs. Attached Figure Description
[0021] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 A flowchart of a credit risk prediction method based on XGBoost is provided for embodiments of this application; Figure 2 This is a schematic diagram of the internal structure of a credit risk prediction device based on XGBoost, provided as an embodiment of this application. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0023] This application provides a credit risk prediction method, device, and medium based on XGBoost to solve the following technical problem: how to build a high-precision, strong generalization, and dynamically adaptive five-level classification model in credit business scenarios, and achieve seamless integration with business systems and continuous performance optimization.
[0024] The technical solutions proposed in the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0025] Figure 1 A flowchart illustrating a credit risk prediction method based on XGBoost, provided for embodiments of this application. Figure 1 As shown in the figure, the credit risk prediction method based on XGBoost provided in this application embodiment specifically includes the following steps: Step 101: Collect multi-dimensional credit data of borrowers and preprocess the multi-dimensional credit data to obtain the data to be analyzed.
[0026] In this embodiment, the multi-dimensional credit data includes at least: basic customer information characteristic variables, financial characteristic variables, and transaction record characteristic variables. It is understood that the collection scope of the multi-dimensional credit data covers the entire lifecycle information of borrowers in the finance company's credit business. For example, basic customer information characteristic variables include static attributes such as the industry of the member unit, registered capital, whether it is listed, and the number of employees, as well as related party background data such as whether the shareholders are actual controllers, shareholding ratios, and state-owned share ratios, used to characterize the borrower's credit foundation and decision-making structure; financial characteristic variables cover dynamic indicators such as the debt-to-asset ratio, current ratio, and sales profit margin, reflecting its short-term solvency and long-term operational stability; transaction record characteristic variables include behavioral data such as historical loan contract amounts, repayment methods, and monthly repayment amounts, used to capture the borrower's repayment habits and potential risk trends.
[0027] In one embodiment of this application, multi-dimensional credit data is preprocessed to obtain data to be analyzed. Specifically, this includes: identifying and removing outliers in customer basic information feature variables and financial feature variables using the Z-score detection method; filling missing financial feature variables with the mean of similar borrowers and filling missing transaction record feature variables with the median; and standardizing continuous variables in the financial feature variables so that their mean is a first preset value and their standard deviation is a second preset value.
[0028] It is understandable that borrower data often contains outliers due to industry differences and inconsistent reporting standards. For example, a member unit's registered capital may significantly deviate from the industry average, possibly due to data entry errors or a unique equity structure. To address this, this embodiment uses the Z-score detection method to identify outliers: calculating the mean and standard deviation of each feature variable, and identifying and removing data points exceeding the mean ± 3 times the standard deviation. For missing values, an imputation strategy is selected based on data type differences: when financial feature variables (such as debt-to-equity ratio) are missing, the mean of similar borrowers (such as those in the same industry or with similar asset sizes) is used to maintain a reasonable data distribution; when transaction record feature variables (such as monthly repayment amount) are missing, the median is used to avoid the influence of extreme values. Furthermore, to eliminate the interference of dimensional differences on model training, continuous data in the financial feature variables (such as registered capital and debt-to-equity ratio) are standardized to have a mean of 0 and a standard deviation of 1.
[0029] It should be noted that the above preprocessing directly serves the subsequent feature reduction and model training stages. For example, outlier removal prevents a few erroneous data points from distorting the results of factor analysis; standardization ensures that feature variables of different magnitudes are comparable during model training. For instance, if borrower A's registered capital is 100 million yuan (standardized to 1.2), and borrower B's registered capital is 5 million yuan (standardized to -0.8), the model can more fairly assess the impact weight of registered capital on the classification results based on the standardized values.
[0030] It is understood that, through the above preprocessing process, the raw data in this embodiment is transformed into a high-quality, standardized dataset to be analyzed, laying the foundation for subsequent feature engineering and model building.
[0031] Step 102: Use factor analysis to reduce the dimensionality of the data to be analyzed in order to extract the core feature variables related to credit risk in the data to be analyzed.
[0032] In this embodiment, the core feature variables include shareholder control factors, financial health factors, and repayment ability factors. It should be noted that the core objective of factor analysis is to extract potentially explanatory factors from high-dimensional credit data to eliminate feature redundancy and improve the model's ability to identify key risk characteristics.
[0033] In one embodiment of this application, before performing feature dimensionality reduction on the data to be analyzed using factor analysis to extract the core feature variables related to credit risk in the data to be analyzed, the method further includes: performing class balancing processing on the data to be analyzed using SMOTE oversampling technology, specifically including: identifying minority class samples of the five-level classification in the data to be analyzed; and generating synthetic samples to expand the minority class samples in the data to be analyzed based on the feature space distribution of the minority class samples.
[0034] Understandably, the first step is to perform class balancing on the data to be analyzed to alleviate the problem of imbalanced distribution of samples in the five-level classification. For example, for minority samples such as the "loss" class, the SMOTE oversampling technique is used to generate synthetic data: in the feature space, the K nearest neighbors of a minority class sample are selected (e.g., K=5), and new samples are generated between it and its nearest neighbors through linear interpolation. For instance, if a "loss" class sample has a debt-to-equity ratio of 95% and a monthly repayment-to-income ratio of 80%, and its neighboring samples have a debt-to-equity ratio of 92% and a monthly repayment-to-income ratio of 85%, then the newly generated synthetic sample corresponds to the weighted average of the two (e.g., a debt-to-equity ratio of 93.5% and a monthly repayment-to-income ratio of 82.5%). This method improves the distribution density of minority class samples, preventing the model from ignoring high-risk categories due to data skew.
[0035] Furthermore, factor analysis is used to reduce the dimensionality of the data to be analyzed in order to extract the core feature variables related to credit risk. Specifically, this includes: calculating the covariance matrix between feature variables based on the data to be analyzed, and extracting initial factors through principal component analysis; rotating the initial factors using the maximum variance method to generate an interpretable factor loading matrix; and selecting factors whose variance contribution rate exceeds a preset threshold as core feature variables based on factor scores.
[0036] It is understandable that there is a high correlation between original variables such as shareholder information and financial indicators (e.g., a strong correlation between "shareholding ratio" and "investment amount"), and directly inputting them into the model would lead to redundant calculations and overfitting risks. This embodiment identifies the degree of linear correlation between variables by calculating the covariance matrix among feature variables and extracts initial factors based on principal component analysis. For example, the first three principal components may cumulatively explain more than 85% of the data variance, reflecting the three core dimensions of shareholder control, financial health, and repayment ability.
[0037] It should be noted that the factor rotation and screening process described in this embodiment uses the maximum variance method to rotate the initial factor loading matrix, ensuring that each original variable is strongly correlated with only a single factor, thereby improving the interpretability of the factors. For example, after rotation, variables such as "whether or not the actual controller" and "shareholding ratio" have high loadings on the shareholder control factor, while variables such as "debt-to-equity ratio" and "quick ratio" are concentrated on the financial health factor, thus clearly defining the semantic boundaries of the factors. Finally, factors with a variance contribution rate exceeding a preset threshold (e.g., a single factor variance contribution rate > 10%) are selected as core feature variables for subsequent model training.
[0038] Understandably, this embodiment addresses both the data imbalance problem and feature redundancy through the synergistic effect of SMOTE and factor analysis. For example, when generating synthetic samples, SMOTE operates based on the dimensionality-reduced factor space distribution, avoiding the generation of invalid data due to high-dimensional noise interference; while factor analysis is performed on the balanced dataset, ensuring that the extracted core features comprehensively reflect the differences in risk across categories. This interconnected design provides high-quality input for the subsequent accurate classification of the XGBoost model.
[0039] Step 103: Input the core feature variables and transaction record feature variables as the training set into the XGBoost model, train the multi-class decision tree through the gradient boosting algorithm to generate the initial classification model, and optimize the hyperparameters of the initial classification model using grid search and cross-validation methods to obtain the XGBoost classification model.
[0040] In this embodiment, the training of the XGBoost model aims to capture the nonlinear correlation of credit risk features through ensemble learning and improve classification accuracy based on dynamic parameter optimization.
[0041] In this embodiment, the extracted core feature variables (such as shareholder control factor and financial health factor) are combined with the original transaction record feature variables (such as loan term and repayment method) to form the training set input model. It can be understood that XGBoost iteratively generates multiple decision trees through a gradient boosting algorithm. Each tree uses the prediction residuals of the preceding model as its optimization objective, gradually approximating the true classification result. For example, the first decision tree may coarsely classify normal and watch-list loans based on "shareholder control factor" and "total loan balance," while the second tree focuses on distinguishing between substandard and suspicious categories based on "financial health factor" and "monthly repayment-to-income ratio." Subsequent trees gradually refine the classification boundaries, ultimately outputting a five-level classification result through weighted voting.
[0042] Furthermore, to improve the model's generalization ability, a grid search and cross-validation method is used to optimize the hyperparameters.
[0043] In one embodiment of this application, the hyperparameters include: the maximum depth of the tree, the learning rate, and the subsample sampling ratio. The hyperparameters of the initial classification model are optimized using a grid search and cross-validation method to obtain the XGBoost classification model. Specifically, this includes: defining a hyperparameter search space; wherein the maximum tree depth search space is a preset first search range, the learning rate search space is a preset second search range, and the subsample sampling ratio search space is a preset third search range; dividing the training set into several subsets, sequentially selecting a first number of subsets for model training through cross-validation, and validating the model performance using the remaining second number of subsets; traversing all hyperparameter combinations and calculating the cross-validation accuracy, selecting the parameter combination with the highest accuracy to update the initial classification model to obtain the XGBoost classification model.
[0044] It should be noted that, in this embodiment, when defining the hyperparameter search space, the maximum depth of the tree is set to cover the range of shallow and deep structures to balance model complexity and the risk of overfitting; the learning rate range covers small to large step sizes to control the contribution weight of each tree to the overall model; and the subsample sampling ratio defines the random sampling ratio of the training data to enhance the robustness of the model to data perturbations.
[0045] It should also be noted that in this embodiment, the training set is divided into several subsets (e.g., 10 subsets). Multiple subsets are selected sequentially as training data, and the remaining subsets are used as validation data. For example, each time, 9 subsets are selected to train the model, and the remaining subset is used to validate the model's performance. After iterating through all subset combinations, the average cross-validation accuracy of each hyperparameter combination is calculated. Finally, the parameter combination with the highest accuracy (e.g., medium tree depth, low learning rate, high subsample ratio) is selected as the optimal hyperparameters, and the initial classification model is updated to obtain the XGBoost classification model.
[0046] For example, if a certain combination of hyperparameters (tree depth = 6, learning rate = 0.1, subsample ratio = 0.8) exhibits the highest recall and F1 score in cross-validation, then it is applied to the final model. Understandably, this optimization process, through systematic traversal and validation, ensures the model's classification stability on unknown data while avoiding the subjective biases of manual parameter tuning.
[0047] Through the above process, this embodiment retains the advantages of XGBoost in processing high-dimensional data, and adapts the model to the unique distribution characteristics of financial company credit data through parameter optimization, laying the foundation for subsequent feature selection and deployment.
[0048] Step 104: Input the core feature variables and transaction record feature variables into the XGBoost classification model. Based on the feature importance ranking output by the XGBoost classification model, filter the core feature variables and transaction record feature variables and remove redundant features with a contribution value lower than a preset threshold.
[0049] In this embodiment, the feature importance screening aims to optimize the model input feature set, eliminate the interference of redundant variables on classification accuracy, and improve the interpretability of the model.
[0050] In one embodiment of this application, based on the feature importance ranking output by the XGBoost classification model, core feature variables and transaction record feature variables are screened, and redundant features with a contribution value lower than a preset threshold are removed. Specifically, this includes: calculating the contribution of each feature variable to the classification result based on the feature gain value output by the XGBoost model; marking feature variables with a contribution value lower than the preset threshold as redundant features and removing them from the training set.
[0051] Understandably, after training, the XGBoost classification model outputs a ranking of the contributions of each variable through its built-in feature importance assessment function. For example, feature importance is quantified based on a "gain value" metric, which reflects the cumulative contribution of each feature to the reduction of the loss function during decision tree splits. For instance, if the "financial health factor" is selected as a key splitting node in multiple tree splits, its gain value will be significantly higher than features with weaker risk correlation, such as "registered region."
[0052] In this embodiment, the gain values of each feature are normalized to a percentage contribution. For example, assuming a total gain of 1000, where the "shareholder control factor" contributes 300, its contribution is 30%. A preset threshold is used to define the criteria for removing redundant features: if the contribution of a feature is below this threshold (e.g., 5%), it is determined that its ability to distinguish the classification results is insufficient, and it is marked as a redundant feature and removed from the training set. It is understood that this threshold can be dynamically adjusted according to business needs; for example, in scenarios with strict risk appetite, the threshold can be lowered to retain more potentially relevant features.
[0053] It's important to note that the feature selection process forms a closed loop with model optimization. For example, during initial training, the contribution of "monthly repayment amount" might be underestimated due to differences in unit of measurement. However, after standardization preprocessing, its contribution significantly increases during the selection phase, thus avoiding erroneous exclusion. Furthermore, core feature variables (such as the "repayment ability factor" extracted from factor analysis) typically have high contributions, while some original transaction record variables (such as "loan term") may be excluded due to multicollinearity with other features, thereby simplifying the model structure and accelerating prediction efficiency.
[0054] For example, if the contribution of "economic nature" (such as state-owned enterprises or private enterprises) is only 3%, which is below a preset threshold, then it will be removed from the feature set. It is understandable that such features may be replaced because they are highly correlated with "shareholder control factors" or "state-owned share ratio". Removing them will not significantly affect the model performance, but can reduce noise interference.
[0055] By implementing this step, the model's feature set is streamlined, retaining only variables that have a substantial impact on the five-tier credit classification. This process not only improves classification efficiency but also enhances business personnel's understanding of risk drivers. For example, by ranking contributions, it clarifies that the "financial health factor" is the core criterion for identifying high-risk loans.
[0056] Step 105: Input the selected feature variables to be applied into the XGBoost classification model to generate a credit five-level classification model, and deploy the credit five-level classification model to the credit business system to receive borrower data in real time and output the five-level classification results.
[0057] In this embodiment, the deployment and real-time prediction function of the credit five-level classification model are intended to transform the training results into business decision-making tools and realize dynamic risk monitoring.
[0058] Specifically, the selected feature variables (such as shareholder control factor, total loan balance, and monthly repayment-to-income ratio) are input into the optimized XGBoost classification model to generate the final five-level credit classification model. It can be understood that the model, after feature selection, significantly reduces computational complexity while retaining key risk discrimination capabilities. For example, if the original number of features is 50, retaining 20 high-contribution features after selection improves the model's inference speed by approximately 60%, meeting real-time requirements.
[0059] Furthermore, the five-level credit classification model is deployed to the credit business system to receive borrower data in real time and output five-level classification results. Specifically, this includes: encapsulating the five-level credit classification model into a callable API interface and integrating it into the credit approval system; receiving new credit data from borrowers in real time and generating five-level classification results by calling the API interface; mapping the classification results to risk level labels and pushing them to the credit approval terminal and post-loan management terminal.
[0060] For example, an API designed with a RESTful architecture receives borrower data in JSON format (such as shareholder information, financial statements, and loan contract details), calls the model to perform classification prediction, and returns five-level classification labels (normal, watchlist, substandard, doubtful, and loss). Understandably, this interface integrates seamlessly with the credit approval system. For instance, when a credit officer submits a loan application, the system automatically triggers model prediction and maps the results to risk level labels such as red, yellow, and orange, pushing them to the approval terminal interface to assist in human decision-making.
[0061] In one embodiment of this application, the method further includes: periodically collecting new credit data and corresponding actual classification labels, dividing the new data into a validation set; calculating the prediction accuracy and recall of the current model based on the validation set; if the recall is lower than a preset threshold, triggering a model retraining process, including: merging the new data with the historical training set, re-executing factor analysis to update the core feature variables; retraining and optimizing the XGBoost classification model based on the updated feature set; and deploying the updated model version to the credit business system.
[0062] It should be noted that new credit data and its actual classification labels are collected periodically (e.g., monthly). The new data is divided into a validation set according to a preset proportion (e.g., 20%), and the recall rate of the current model for high-risk categories is calculated. If the recall rate is lower than a preset threshold (e.g., recall rate for the "loss" category <70%), it indicates that the model's ability to capture the latest risk features has decreased, and a retraining process needs to be triggered. Specifically, the new data is merged with the historical training set, factor analysis is re-performed to update the core feature variables (e.g., adding an "industry prosperity index" factor), and the XGBoost model is retrained based on the updated feature set to ensure that the model continues to adapt to changes in the business environment.
[0063] For example, a new loan product specifically for the "green energy industry" has been added, and new features such as "carbon emission indicators" have emerged in the borrower data. Through a dynamic update process, the model automatically identifies the correlation between these features and risk levels, incorporates them into core feature variables, and thus accurately classifies the credit risk of emerging industries.
[0064] Understandably, this step, through a closed-loop design of model deployment and dynamic optimization, satisfies both the timeliness requirement of real-time risk prediction and ensures the stability of the model in long-term applications. For example, in post-loan management, the system periodically calls the model to reclassify existing loans. If a borrower's monthly repayment-to-income ratio continues to deteriorate, the model will automatically adjust its classification from "watch list" to "substandard," triggering the post-loan collection process and achieving proactive risk control.
[0065] The above are embodiments of the method proposed in this application. Based on the same inventive concept, embodiments of this application also provide a credit risk prediction device based on XGBoost, the structure of which is as follows: Figure 2 As shown.
[0066] Figure 2 This is a schematic diagram of the internal structure of a device provided in an embodiment of this application. Figure 2 As shown, the device includes: At least one processor 201; And a memory 202 that is communicatively connected to at least one processor; The memory 202 stores instructions executable by at least one processor, which are executed by at least one processor 201 to enable at least one processor 201 to: Multi-dimensional credit data from borrowers is collected and preprocessed to obtain data for analysis. This multi-dimensional credit data includes at least: basic customer information characteristics, financial characteristics, and transaction record characteristics. Factor analysis is used to reduce the dimensionality of the data to extract core characteristics related to credit risk. These core characteristics include shareholder control factors, financial health factors, and repayment ability factors. The core characteristics and transaction record characteristics are then used as the training set to input into an XGBoost model. A gradient boosting algorithm is used to train a multi-class decision tree, generating an initial classification model. The hyperparameters of the initial classification model were optimized using grid search and cross-validation to obtain the XGBoost classification model. Core feature variables and transaction record feature variables were input into the XGBoost classification model. Based on the feature importance ranking output by the XGBoost classification model, the core feature variables and transaction record feature variables were screened, and redundant features with a contribution below a preset threshold were removed. The screened feature variables to be applied were input into the XGBoost classification model to generate a five-level credit classification model. The five-level credit classification model was then deployed to the credit business system to receive borrower data in real time and output the five-level classification results.
[0067] Some embodiments of this application provide corresponding to Figure 1 A non-volatile computer storage medium for credit risk prediction based on XGBoost, storing computer-executable instructions, wherein the computer-executable instructions are configured as follows: Multi-dimensional credit data from borrowers is collected and preprocessed to obtain data for analysis. This multi-dimensional credit data includes at least: basic customer information characteristics, financial characteristics, and transaction record characteristics. Factor analysis is used to reduce the dimensionality of the data to extract core characteristics related to credit risk. These core characteristics include shareholder control factors, financial health factors, and repayment ability factors. The core characteristics and transaction record characteristics are then used as the training set to input into an XGBoost model. A gradient boosting algorithm is used to train a multi-class decision tree, generating an initial classification model. The hyperparameters of the initial classification model were optimized using grid search and cross-validation to obtain the XGBoost classification model. Core feature variables and transaction record feature variables were input into the XGBoost classification model. Based on the feature importance ranking output by the XGBoost classification model, the core feature variables and transaction record feature variables were screened, and redundant features with a contribution below a preset threshold were removed. The screened feature variables to be applied were input into the XGBoost classification model to generate a five-level credit classification model. The five-level credit classification model was then deployed to the credit business system to receive borrower data in real time and output the five-level classification results.
[0068] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments for IoT devices and media are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0069] The systems, media, and methods provided in this application are one-to-one correspondences. Therefore, the systems and media also have similar beneficial technical effects as their corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the systems and media will not be repeated here.
[0070] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0071] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0072] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0073] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0074] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0075] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0076] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0077] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0078] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A credit risk prediction method based on XGBoost, characterized in that, The method includes: Collect multi-dimensional credit data of borrowers and preprocess the multi-dimensional credit data to obtain data to be analyzed; wherein, the multi-dimensional credit data includes at least: customer basic information characteristic variables, financial characteristic variables, and transaction record characteristic variables; Factor analysis is used to perform feature dimensionality reduction on the data to be analyzed in order to extract the core feature variables related to credit risk in the data to be analyzed; wherein, the core feature variables include shareholder control factor, financial health factor and repayment ability factor; The core feature variables and the transaction record feature variables are used as the training set and input into the XGBoost model. A multi-class decision tree is trained by the gradient boosting algorithm to generate an initial classification model. The hyperparameters of the initial classification model are optimized by grid search and cross-validation methods to obtain the XGBoost classification model. The core feature variables and the transaction record feature variables are input into the XGBoost classification model. Based on the feature importance ranking output by the XGBoost classification model, the core feature variables and transaction record feature variables are screened, and redundant features with a contribution value lower than a preset threshold are removed. The selected feature variables to be applied are input into the XGBoost classification model to generate a credit five-level classification model. The credit five-level classification model is then deployed to the credit business system to receive borrower data in real time and output the five-level classification results.
2. The credit risk prediction method based on XGBoost according to claim 1, characterized in that, The multi-dimensional credit data is preprocessed to obtain the data to be analyzed, specifically including: Outliers in the customer basic information feature variables and financial feature variables were identified and removed using the Z-score detection method. Missing financial characteristic variables were filled with the mean of borrowers of the same type, and missing transaction record characteristic variables were filled with the median. The continuous variables among the financial characteristic variables are standardized so that their mean is a first preset value and their standard deviation is a second preset value.
3. The credit risk prediction method based on XGBoost according to claim 1, characterized in that, Before performing feature dimensionality reduction on the data to be analyzed using factor analysis to extract the core feature variables related to credit risk from the data to be analyzed, the method further includes: The data to be analyzed is subjected to class balancing processing using the SMOTE oversampling technique, specifically including: Identify minority class samples in the five-level classification of the data to be analyzed; Based on the feature spatial distribution of the minority class samples, synthetic samples are generated to expand the minority class samples in the data to be analyzed.
4. The credit risk prediction method based on XGBoost according to claim 1, characterized in that, Factor analysis was used to perform feature dimensionality reduction on the data to be analyzed, in order to extract the core feature variables related to credit risk from the data, specifically including: The covariance matrix among the feature variables is calculated based on the data to be analyzed, and initial factors are extracted through principal component analysis. The initial factors are rotated using the maximum variance method to generate an interpretable factor loading matrix; Factors whose variance contribution rate exceeds a preset threshold are selected as the core feature variables based on their factor scores.
5. The credit risk prediction method based on XGBoost according to claim 1, characterized in that, The hyperparameters include: the maximum depth of the tree, the learning rate, and the subsample sampling ratio; The hyperparameters of the initial classification model are optimized using grid search and cross-validation to obtain the XGBoost classification model, specifically including: Define a hyperparameter search space; wherein, the maximum depth search space of the tree is a preset first search range, the learning rate search space is a preset second search range, and the subsample sampling ratio search space is a preset third search range; The training set is divided into several subsets. The first number of subsets are selected sequentially for cross-validation to train the model, and the remaining second number of subsets are used to validate the model performance. Iterate through all hyperparameter combinations and calculate the cross-validation accuracy. Select the parameter combination with the highest accuracy to update the initial classification model to obtain the XGBoost classification model.
6. The credit risk prediction method based on XGBoost according to claim 1, characterized in that, Based on the feature importance ranking output by the XGBoost classification model, the core feature variables and transaction record feature variables are screened, and redundant features with a contribution value lower than a preset threshold are removed. Specifically, this includes: Based on the feature gain values output by the XGBoost model, the contribution of each feature variable to the classification result is calculated. Feature variables whose contribution is below a preset threshold are marked as redundant features and removed from the training set.
7. The credit risk prediction method based on XGBoost according to claim 1, characterized in that, The five-level credit classification model is deployed to the credit business system to receive borrower data in real time and output the five-level classification results, specifically including: The five-level credit classification model is encapsulated into a callable API interface and integrated into the credit approval system; The system receives new credit data from borrowers in real time and uses the API interface to generate five-level classification results. The classification results are mapped to risk level labels and pushed to the credit approval terminal and post-loan management terminal.
8. The credit risk prediction method based on XGBoost according to claim 1, characterized in that, The method further includes: Regularly collect new credit data and corresponding actual classification labels, and divide the new data into a validation set; The prediction accuracy and recall of the current model are calculated based on the validation set. If the recall rate is lower than a preset threshold, a model retraining process is triggered, including: The new data is merged with the historical training set, and factor analysis is re-executed to update the core feature variables. The XGBoost classification model was retrained and optimized based on the updated feature set. The updated model version will be deployed to the credit business system.
9. A credit risk prediction device based on XGBoost, characterized in that, The device includes: At least one processor; And, a memory communicatively connected to the at least one processor; The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform a method as described in any one of claims 1-8.
10. A non-volatile computer storage medium for credit risk prediction based on XGBoost, storing computer-executable instructions, characterized in that, When the computer-executable instructions are executed, they implement a method as described in any one of claims 1-8.
Citation Information
Patent Citations
XGboost-based financial credit enterprise credit prediction method
CN114492929A
Financial credit risk identification method and system
CN120047234A
