Financial transaction risk assessment method and device and storage medium
Through the financial transaction risk assessment method based on machine learning and neural networks, the local correlation and overfitting problems of traditional methods in complex financial transaction scenarios are solved, and more accurate and stable risk assessment is achieved, which is suitable for complex financial markets.
Patent Information
- Application Number
- CN202410989911.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-12-20
AI Technical Summary
Traditional financial transaction risk assessment methods have local correlation and overfitting problems in complex financial transaction scenarios. Decision tree models are prone to overfitting, and scoring model indicator selection and weight tuning are difficult, making it difficult to adapt to complex financial transactions. demand.
Using a risk assessment method based on machine learning and neural networks, through data preprocessing, fusion of multiple machine learning models and fusion of Stacking models, combined with k-fold cross-validation, and using XGBoost and Catboost algorithms, the neural network model is used to evaluate financial transaction risk.
It realizes more accurately identifying and quantifying financial transaction risks, reduces artificial errors, improves the stability and applicability of assessments, and is suitable for complex financial market situations.
Smart Images

Figure CN119168645A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of financial transaction risk behavior assessment, and in particular to a financial transaction risk assessment method, device and storage medium based on machine learning and neural network. Background Art
[0002] In the global financial market, financial transactions involve complex risk factors. Traditional risk assessment methods are mainly aimed at domestic financial transactions and have certain limitations. The risk assessment models currently used are mainly divided into two categories. One is the decision tree model, which builds a decision tree based on the data characteristics of existing data analysis. This model is simple to use and easy to explain, but has strong local correlation and is prone to overfitting. It is essentially to classify data through a series of rules. The other is a scoring model, which formulates scoring indicators and corresponding weights according to business conditions, and then divides the risk level according to the calculated scoring results. Compared with the decision tree constructed according to rules, if the indicators of the scoring model are set reasonably enough, its coverage rate is higher and it is not easy to find loopholes. However, it is more difficult to establish a scoring model, especially the selection of indicators and the subsequent parameter tuning.
[0003] As disclosed in the Chinese patent application CN202210317777.5, there are two problems with the current traditional risk assessment methods. First, the decision tree model classifies data through a series of rules, has strong local correlation, is prone to overfitting, and is not suitable for complex financial transaction scenarios. Second, the scoring model is constructed by formulating scoring indicators and corresponding weights according to business conditions. Although the coverage rate is higher and loopholes are not easily discovered when the scoring indicators are set reasonably enough, it increases the difficulty of model construction. In particular, in complex financial transaction scenarios, the selection of scoring indicators will be particularly complex, and the corresponding weights and transaction risks will be difficult to quantify specifically. Summary of the invention
[0004] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and provide a financial transaction risk assessment method and device.
[0005] The purpose of the present invention can be achieved by the following technical solutions:
[0006] As a first aspect of the present invention, a financial transaction risk assessment method is provided, the method steps comprising:
[0007] Collect financial transaction data and pre-process the data to obtain the first feature;
[0008] The obtained first feature value is input into a fusion model of multiple machine learning, and the fusion model predicts and outputs a second feature;
[0009] The first feature is input together with the second feature into the financial transaction risk assessment model to obtain the result of the target user.
[0010] As a preferred technical solution, the preprocessing includes data cleaning, classification feature encoding and feature extraction.
[0011] As a preferred technical solution, the specific steps of data cleaning include:
[0012] For duplicate values, query and delete duplicate rows;
[0013] For missing values, use the isnull() function to query the rows where the missing values are located, use the dropna() function to delete the rows where the missing values are located, and use the fillna() function to fill the missing values;
[0014] Use the boxplot() function of DataFrame to draw a box plot and detect outliers.
[0015] As a preferred technical solution, the data cleaning also includes: using a population stability index PSI to screen the characteristic values, and eliminating characteristic values with PSI values higher than a set threshold.
[0016] As a preferred technical solution, the classification feature coding is specifically as follows: for non-numerical features contained in the acquired financial transaction data, evidence weight coding is used for feature coding.
[0017] As a preferred technical solution, the fusion model is based on multiple machine learning algorithms and uses k-fold cross validation for Stacking model fusion.
[0018] As a preferred technical solution, the machine learning algorithms include XGBoost and Catboost.
[0019] As a preferred technical solution, the financial transaction risk assessment model adopts a neural network model. The neural network model takes the first feature after preprocessing and the second feature predicted and output by the fusion model as input, and obtains the financial transaction risk assessment results of the target user through training.
[0020] As a second aspect of the present invention, there is provided a financial transaction risk assessment device, characterized in that it comprises:
[0021] one or more processors;
[0022] A memory for storing one or more programs;
[0023] When the one or more programs are executed by the one or more processors, the one or more processors implement the financial transaction risk assessment method as described above.
[0024] As a third aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the financial transaction risk assessment method described above are implemented.
[0025] Compared with the prior art, the present invention has the following beneficial effects:
[0026] The financial transaction risk assessment method based on machine learning and neural networks proposed in the present invention first integrates multiple machine learning methods to extract features from the collected data, and inputs it together with the original data into a trained neural network model to assess the financial transaction risks. This realizes automated risk assessment, can more accurately identify and quantify the risks of financial transactions, and is more suitable for complex financial market situations. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 A flowchart of the financial transaction risk assessment method of the present invention;
[0028] Figure 2 A schematic diagram of a fusion model combining multiple machine learning methods of the present invention;
[0029] Figure 3 Schematic diagram of the 3-fold cross validation process. DETAILED DESCRIPTION
[0030] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to the following embodiments.
[0031] Example 1
[0032] The present invention uses machine learning and neural network models to assess financial transaction risks. After collecting data, it performs visual analysis, then pre-processes the data and constructs features. The constructed feature values are predicted by integrating multiple machine learning models and the output result is used as a new feature value. The new feature value and the previous feature value are used as the input of the neural network model, and the result obtained by the neural network model is the final result. Figure 1 As shown, the specific steps of the present invention are as follows:
[0033] S1. Data collection and preprocessing: We first collect large-scale data related to the bank’s overseas financial transactions, perform visual analysis on the data, and perform data preprocessing, including data cleaning, classification feature encoding, and feature extraction.
[0034] Table 1 Intra-line overseas transaction data fields
[0035]
[0036]
[0037]
[0038] Data cleaning:
[0039] In the process of data entry and processing, duplicate values, missing values and outliers are inevitably generated. In the present invention, large-scale financial transaction data needs to be applied. Therefore, when the amount of data is large, the duplicated() function is used to query duplicate rows for duplicate values, and the drop_duplicates() function is used to delete duplicate rows; the isnull() function is used to query the rows where the missing values are located, the dropna() function is used to delete the rows where the missing values are located, and the fillna() function is used to fill the missing values; the boxplot() function of DataFrame is used to draw a box plot to detect outliers.
[0040] At the same time, PSI (population stability index) is introduced to screen the above feature values. The larger the PSI value, the more unstable the feature is, and the distribution of the feature in the training set and the test set may be inconsistent. After calculating the PSI of the feature value, the ones with too high PSI values are eliminated. The PSI calculation formula is as follows:
[0041]
[0042] Categorical feature encoding:
[0043] The transaction data obtained from the in-house and overseas financial transaction logs through the script contains non-numerical features. The present invention uses the Weight of Evidence Encoding classification feature encoding method to process the non-numerical features.
[0044]
[0045] S2, model selection and fusion: Figure 2 As shown, the present invention adopts multiple machine learning algorithms, including but not limited to XGBoost, Catboost and other models, and combines k-fold cross validation to perform Stacking model fusion.
[0046] The XGBoost model code is as follows:
[0047] from pandas as pd
[0048] from sklearn.model_selection import cross_val_score
[0049] from lightgbm import XGBClassifier
[0050] from sklearn.metrics import accuracy_score
[0051] #Read the dataset and extract feature variables and target variables
[0052] df = pd.read_excel('Transaction information.xlsx')
[0053] X = df.drop(columns = 'Is the transaction successful')
[0054] Y = df['Is the transaction successful']
[0055] #Model building and k-fold cross validation
[0056] model = XGBClassifier()
[0057] acc=cross_val_score(model,X,y,cv=k)
[0058] K-fold cross validation:
[0059] like Figure 3 The figure shows a 3-fold cross validation, where the data is randomly divided into 3 equal parts. Two parts of the data are randomly selected as training sets in each round, and the rest are used as test sets. After 3 rounds, 3 different test results are obtained. Combining the 3 test results can more accurately evaluate the model for parameter tuning.
[0060] S3, risk assessment and output: The prediction result output by the fusion model in step S2 is used as a new feature together with the features obtained from the previous data preprocessing as the input of the neural network model, and the neural network model is trained to obtain the financial transaction risk assessment results of the target user. The model is trained using a large-scale data set and its accuracy is improved through iterative optimization. After training, the model can accept the input data of financial transactions and generate corresponding risk assessment results.
[0061] This solution implements financial transaction risk assessment based on machine learning and neural networks, with the following beneficial effects: 1) more accurately identifying and quantifying the risks of financial transactions; 2) automated risk assessment, reducing human errors; 3) higher stability, more suitable for complex financial market situations.
[0062] Example 2
[0063] As a second aspect of the present invention, the present application also provides an electronic device, comprising: one or more processors; a memory for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the financial transaction risk assessment method based on machine learning and neural network as applied to the storage system as described above. In addition to the above-mentioned processor, memory and interface, any device with data processing capability in which the device in the embodiment is located may also include other hardware according to the actual function of the device with data processing capability, which will not be described in detail.
[0064] Example 3
[0065] As a third aspect of the present invention, the present application also provides a computer-readable storage medium on which computer instructions are stored. When the instructions are executed by a processor, the financial transaction risk assessment method based on machine learning and neural network applied to the storage system as described above is implemented. The computer-readable storage medium can be an internal storage unit of any device with data processing capabilities described in any of the aforementioned embodiments, such as a hard disk or a memory. The computer-readable storage medium can also be an external storage device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), an SD card, a flash card (Flash Card), etc. equipped on the device. Further, the computer-readable storage medium can also include both an internal storage unit of any device with data processing capabilities and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by any device with data processing capabilities, and can also be used to temporarily store data that has been output or is to be output.
[0066] The preferred specific embodiments of the present invention are described in detail above. It should be understood that a person skilled in the art can make many modifications and changes based on the concept of the present invention without creative work. Therefore, any technical solution that can be obtained by a person skilled in the art through logical analysis, reasoning or limited experiments based on the concept of the present invention on the basis of the prior art should be within the scope of protection determined by the claims.
Claims
1. A financial transaction risk assessment method, characterized in that: The method steps include: Collect financial transaction data and pre-process the data to obtain a first feature; The obtained first feature value is input into a fusion model of multiple machine learning, and the fusion model predicts and outputs a second feature; The first feature is input together with the second feature into the financial transaction risk assessment model to obtain the result of the target user.
2. A financial transaction risk assessment method according to claim 1, characterized in that: The preprocessing includes data cleaning, classification feature encoding and feature extraction.
3. A financial transaction risk assessment method according to claim 2, characterized in that: The specific steps of data cleaning include: For duplicate values, query and delete duplicate rows; For missing values, use the isnull() function to query the rows where the missing values are located, use the dropna() function to delete the rows where the missing values are located, and use the fillna() function to fill the missing values; Use the boxplot() function of DataFrame to draw a box plot and detect outliers.
4. A financial transaction risk assessment method according to claim 3, characterized in that: The data cleaning also includes: using a population stability index PSI to screen the characteristic values, and eliminating the characteristic values whose PSI values are higher than a set threshold.
5. A financial transaction risk assessment method according to claim 2, characterized in that: The classification feature coding is specifically as follows: for non-numerical features contained in the acquired financial transaction data, evidence weight coding is used for feature coding.
6. A financial transaction risk assessment method according to claim 1, characterized in that: The fusion model is based on multiple machine learning algorithms and uses k-fold cross validation for Stacking model fusion.
7. A financial transaction risk assessment method according to claim 6, characterized in that: The machine learning algorithms include XGBoost and Catboost.
8. A financial transaction risk assessment method according to claim 1, characterized in that: The financial transaction risk assessment model adopts a neural network model. The neural network model takes the first feature after preprocessing and the second feature predicted and output by the fusion model as input, and obtains the financial transaction risk assessment result of the target user through training.
9. A financial transaction risk assessment device, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the financial transaction risk assessment method as described in any one of claims 1-8.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the financial transaction risk assessment method according to any one of claims 1 to 8 are implemented.
