A Credit Card Fraud Detection Method Based on Counterfactual Graph Convolutional Neural Network
Through the method of convolutional neural network based on counterfactual graphs, a credit card transaction network is built and feature enhancement learning is carried out, and causal relationships are dynamically optimized, which solves the problem of insufficient causal relationship capture in the existing technology, and achieves more efficient credit card fraud detection.
Patent Information
- Application Number
- CN202411874300.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2044-12-19
AI Technical Summary
The existing credit card fraud detection methods are difficult to dynamically capture the causal relationships and network structure changes between transaction nodes, and cannot accurately optimize the node status and network structure, resulting in limited fraud detection performance.
The method based on counterfactual graph convolution neural network is adopted to build a credit card transaction network by designing a quantitative strategy for transaction feature difference, and a graph convolution neural network is used to perform feature enhancement learning, and a causal difference between the real world and the hypothetical world is constructed through replication gates, and circular optimization is performed to enhance the causal interaction relationship.
It improves the accuracy of credit card transaction feature extraction and the identification ability of fraud detection models, enhances the ability to capture causal relationships, and improves the accuracy and stability of fraud detection results.
Smart Images

Figure CN119338470B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of fraud detection in artificial intelligence, and particularly relates to a credit card fraud detection method based on a counterfactual graph convolutional neural network. Background Art
[0002] There are a large number of transaction features of various categories such as transaction amounts, consumption preferences, and consumption dates in credit card transaction records. There is complex transaction information among these transaction features, which is crucial for the identification of fraud behaviors and is a key to the credit card fraud detection problem. Some existing studies use machine learning methods to achieve in-depth mining of transaction features through feature engineering and can detect new and changing fraud patterns. However, these methods require constructing classifiers and consuming a large amount of resources for feature engineering, and cannot autonomously detect the interaction relationships in transaction behaviors.
[0003] Learning the behavior patterns in credit card transactions helps to improve the identification ability of the credit card fraud detection model for fraud behaviors and is another key to the credit card fraud detection problem. Some existing studies regard credit card fraud detection as a sequence prediction task and use sequence learning models such as recurrent neural networks (RNNs) and long short-term memory (LSTM) to learn the behavior patterns between transactions by capturing the sequential dependencies in transaction data, so as to capture the behavior interaction relationships in credit card transactions. However, these sequence learning models rely on the sequence order to learn historical transactions and need to assume that the impacts of all historical transactions on the current transaction are equal, and fail to consider the impact changes of different transactions on the current transaction at different interval sequence orders.
[0004] Graph convolutional neural networks (GCNs) have powerful feature extraction capabilities, can deeply mine the intrinsic features of transactions, and enhance the ability to extract transaction features and learn behavioral patterns. Unlike fraud detection models that rely on sequential sequences, fraud detection models based on graph convolutional neural networks can construct credit card transactions into topological transaction networks, effectively capture the behavioral interaction relationship in credit card transaction patterns through neighborhood aggregation, and learn the behavioral patterns of credit card transactions while effectively extracting transaction features. However, existing credit card fraud detection methods based on graph convolutional neural networks mainly use static modeling, which makes it difficult to dynamically capture the causal relationship between transaction nodes and changes in network structure. In addition, these methods usually ignore the importance of connections between transaction nodes, and cannot accurately optimize node status and network structure, thereby limiting the improvement of fraud detection performance. At the same time, there are problems such as feature deviation and noise in real credit card transactions, and graph convolutional neural networks are very sensitive to noise and abnormal structures in topological structures. These factors will cause graph convolutional neural networks to establish incorrect connections in the process of learning transaction behaviors, which in turn affects the inability of graph convolutional neural networks to accurately reflect the real interactive relationship between transaction users, reducing the classification ability of credit card fraud detection patterns. Therefore, designing a credit card fraud detection model with strong classification ability is still a challenge. Summary of the invention
[0005] In order to solve the above problems, the present invention proposes a credit card fraud detection method based on counterfactual graph convolutional neural network. First, a transaction feature difference quantification strategy is designed to extract credit card transaction features, and the discrimination between transaction features is weightedly calculated to construct a credit card transaction network. Then, a graph convolutional neural network is used for feature enhancement learning to capture the relationship between credit card transactions, and the real world is constructed through a replication gate. The node relationship enhanced by the graph convolutional neural network is passed to the real world, and a hypothetical world is generated through counterfactual assumptions. The causal difference between the two worlds is cyclically optimized to enhance the causal interaction relationship between credit card transactions. Finally, the node status of the credit card transaction is output through causal consistency judgment, thereby obtaining the best fraud detection result.
[0006] The technical solution of the present invention is as follows:
[0007] A credit card fraud detection method based on counterfactual graph convolutional neural network includes the following steps:
[0008] Step 1: Obtain the original credit card transaction data set, and use the transaction feature difference quantification strategy to preprocess and quantify the data set;
[0009] Step 2: Build a credit card transaction network;
[0010] Step 3: Construct a graph convolutional neural network to perform feature enhancement learning on the credit card transaction network;
[0011] Step 4: Construct a counterfactual hypothesis network optimization mechanism;
[0012] Step 5: Perform causal consistency determination to predict the legitimacy and fraudulence of the current credit card transaction.
[0013] Furthermore, in the said Step 1, the obtained original credit card transaction data set is , with a dimension of , representing the number of transactions, representing the number of features for each transaction; each transaction includes three types of features: non-numerical, numerical, and time. The processes of preprocessing and differential quantization for each are as follows:
[0014] Step 1.1: The differential quantization formula for non-numerical features is as follows:
[0015] ;
[0016] ;
[0017] where represents the th non-numerical feature of the th transaction; represents the th non-numerical feature of the th transaction; is the differential quantization result of the non-numerical feature; , are two different transaction serial numbers; represents the value of the th non-numerical feature; represents the value of other non-numerical features; represents the number of values of other non-numerical features; represents the conditional probability difference given the values and ; represents the conditional probability of the th non-numerical feature; and are corresponding to two different subsets of the maximum conditional probability;
[0018] Step 1.2: Divide the numerical features into equally spaced intervals. The differential quantization formula for numerical features is:
[0019] ;
[0020] where Indicates the numerical feature of the th transaction; Indicates the numerical feature of the th transaction; Is the quantization result of the difference in numerical features; , respectively indicate the th, th interval; Indicates and The quantization result of the difference, and the calculation method is the same as that of the non-numerical feature difference quantization;
[0021] Step 1.3, the difference quantization formula for time features is:
[0022] ;
[0023] Among them, Indicates the numerical feature of the th transaction; Indicates the numerical feature of the th transaction; Is the quantization result of the difference in time features; Indicates the weight of the time feature;
[0024] Step 1.4, aggregate the difference quantization results of non-numerical, numerical and time features with weights to calculate the overall feature difference between two transactions. The calculation formula is:
[0025] ;
[0026] Among them, Is the overall feature difference; Is the th transaction; Indicates the th transaction; Is the number of numerical features; Is the number of non-numerical features; Is the number of time features.
[0027] Furthermore, the specific process of step 2 is as follows:
[0028] Step 2.1, in the credit card transaction dataset, regard each transaction as a transaction node. To measure the similarity between all transaction pairs, calculate the average value of the overall feature difference. The formula is as follows:
[0029] ;
[0030] Among them, is the average value of the overall feature differences;
[0031] Step 2.2: Determine the connection relationship between transaction nodes according to the average value of the overall feature differences to form a credit card transaction network , where represents the set of nodes, and a transaction is a node. The th transaction is the th node in the credit card transaction network, represents the set of edges. An edge represents a transaction relationship, and the set of edges is in the form of an adjacency matrix. The specific construction formula is as follows:
[0032] ;
[0033] Among them, is the element in the th row and the th column of the adjacency matrix, indicating and whether they are connected; the th row corresponds to the th transaction, and the th column corresponds to the th transaction; if the difference between and is less than or equal to , it is considered that there is an association between them, that is , otherwise, it is considered that there is no association between them, that is ;
[0034] Step 2.3: In the credit card transaction network, the node degree and neighborhood set are defined as follows:
[0035] ;
[0036] ;
[0037] Among them, represents the node degree of the th transaction; represents the neighborhood set of ;
[0038] Step 2.4: In the credit card transaction network, the edge weight is expressed as follows:
[0039] ;
[0040] Among them, is for and The edge weight between; is the exponential function with base e; is a smoothing parameter.
[0041] Furthermore, in step 3, the graph convolutional neural network contains several hidden layers, and the transaction nodes perform feature enhancement learning during the propagation in the hidden layers; the specific process is as follows:
[0042] Step 3.1, Take the credit card transaction network as the input of the graph convolutional neural network, and the formula is as follows:
[0043] ;
[0044] where, represents the feature embedding generated by the graph convolutional neural network; is the mapping function of the graph convolutional neural network;
[0045] Step 3.2, Train the parameters in the credit card transaction network in the hidden layer, and continuously update the feature representation. The mapping operation formula for each hidden layer is:
[0046] ;
[0047] where, is the feature matrix of the th hidden layer; is the adjacency matrix; is the activation function; is 's degree matrix; represents the normalized form of the adjacency matrix plus the identity matrix ; represents the weight matrix of the th hidden layer;
[0048] Step 3.2.2, Introduce positive samples and design a mixed weight matrix. The formula is as follows:
[0049] ;
[0050] where, is the mixed weight matrix; represents the original weight matrix performing L2 normalization; , are respectively the feature matrices of the th transaction and the th transaction; is a hyperparameter;
[0051] Step 3.3, At the For a hidden layer, the update formula for node features is as follows:
[0052] ;
[0053] Among them, represents the th hidden layer; is a non-linear activation function; is a hyperparameter; represents the node degree of the th transaction; represents the th transaction's node features in the
[0054]
[0055] Specifically, the specific process of step 4 is as follows:Step 4.1: Create a blank network, name it the real world, design a copy gate mechanism, and transfer the parameters and node states in the graph convolutional neural network to the real world. The formula is as follows:
[0056] ;
[0057] ;
[0058] Among them, is the output of the copy gate; is the activation function; represents the weight matrix of the th iteration; represents the th iteration's hidden state; represents the bias of the th iteration; is the real world; is 's copy gate update state output;
[0059] Step 4.2: Based on the counterfactual hypothesis, disconnect the connections between nodes with low similarity in the real world to generate a hypothetical world. The disconnection operation is defined as follows:
[0060] ;
[0061] Among them, is the hypothetical world; is the assignment operation; represents disconnecting the connection between and ;
[0062] The node states in the hypothetical world are updated as:
[0063] ;
[0064] Among them, and are the states at the th and th iterations in the hypothetical world respectively; th iteration; represents the number of neighborhood nodes of; is the neighborhood set of; represents the node degree in the th iteration; represents the feature transformation function;
[0065] Step 4.3. To quantify the causal difference between the real world and the hypothetical world, calculate the causal difference between nodes. For any two credit card transaction nodes, the causal difference is defined as:
[0066] ;
[0067] Among them, is the causal difference; is the expected value; represents the expected value of when occurs; represents the expected value of when does not occur;
[0068] Step 4.4. Set a difference threshold to determine whether to remove the connection of nodes with weak causal differences. The judgment conditions are as follows:
[0069] ;
[0070] ;
[0071] Among them, is the causal effect between transaction nodes; is the removal operation; and are the th and th transaction nodes respectively;
[0072] Step 4.5. Re-enter the adjusted hypothetical world into the graph convolutional neural network for a new round of training. The node state update formula is as follows:
[0073] ;
[0074] Among them, represents the th hidden layer in the hypothetical world; represents the th hidden layer in the hypothetical world; is the optimized adjacency matrix of the hypothetical world;
[0075] Step 4.6. After a new round of training, the newly output hypothetical world is :
[0076] ;
[0077] Among them, represents the normalization of causal differences.
[0078] Furthermore, the specific process of step 5 is as follows:
[0079] Step 5.1. The causal consistency determination between the real world and the hypothetical world is determined by calculating the norm of the causal difference. Specifically, when , it is determined that the causal relationship between the real world and the hypothetical world is consistent, and step 5.2 is carried out; otherwise, return to step 4 to continue optimizing the real world and the hypothetical world;
[0080] Step 5.2. Predict the legitimacy and fraudulence of credit card transactions. The prediction formula is as follows:
[0081] ;
[0082] Among them, is the prediction result; is the ReLU non-linear activation function; , are the weight matrices of the 0th hidden layer and the 1st hidden layer respectively; represents the input feature, Through multiplication with , for linear transformation; is the softmax activation function;
[0083] Step 5.3. Preset a threshold . If , then the current credit card transaction is a fraudulent transaction; otherwise, it is a legitimate transaction.
[0084] The beneficial technical effects brought by the present invention are as follows.
[0085] Improve the accuracy of credit card transaction feature extraction: By designing a transaction feature difference quantification strategy, it is possible to effectively extract and calculate the discrimination between credit card transaction features through weighted calculation, construct a more accurate credit card transaction network, thereby improving the ability of feature expression and the quality of data.
[0086] Enhance the ability to capture credit card transaction relationships: Adopt a graph convolutional neural network for feature enhancement learning to effectively capture the complex relationships between credit card transactions, especially the interaction information between different transaction nodes, and improve the model's ability to identify fraud behavior.
[0087] Simulate and optimize causal relationships: By introducing a replication gate to construct the causal difference between the real world and the hypothetical world, use counterfactual assumptions to generate a hypothetical world and perform cyclic optimization, effectively simulating the causal interaction relationship of credit card transactions. This process can more accurately capture the key nodes in the causal chain and avoid the risk of unclear or ignored causal relationships in traditional methods.
[0088] Improve the accuracy and stability of fraud detection results: By outputting the transaction node status through a causal consistency determination mechanism, it is possible to give more robust and accurate fraud detection results on the premise of ensuring causal consistency. This not only improves the accuracy of fraud detection but also effectively reduces the probability of false positives and false negatives. Description of the Drawings
[0089] Figure 1 is a process diagram of the credit card fraud detection method based on the counterfactual graph convolutional neural network of the present invention.
[0090] Figure 2 is a bar chart comparing four evaluation indicators of the method of the present invention and the GCN method.
[0091] Figure 3 is a comparison chart of the visualization results of the method of the present invention and the GCN method; among them, (a) is the visualization result of the GCN method, and (b) is the visualization result of the method of the present invention. Detailed Embodiments
[0092] The present invention will be further described in detail below in conjunction with the drawings and specific embodiments:
[0093] As Figure 1 shown, the present invention is based on the graph convolutional neural network (GCN) technology, combines causal relationship modeling and counterfactual assumptions, and dynamically analyzes and optimizes the credit card transaction network. The specific steps include five steps: transaction feature difference quantification strategy, credit card transaction network construction, feature enhancement learning of the graph convolutional neural network, counterfactual hypothesis network optimization mechanism, and causal consistency determination. The specific implementation is as follows:
[0094] Step 1: Obtain the original credit card transaction dataset, and preprocess and quantify the differences of the dataset using the transaction feature difference quantification strategy.
[0095] The obtained original credit card transaction dataset is , which is a -dimensional dataset, where represents the number of transactions, represents the number of features for each transaction. Since the feature types in the credit card transaction dataset are diverse, and the types and importance of its numerical features, non-numerical features, and time features are different, the present invention designs a transaction feature difference quantification strategy to achieve feature preprocessing and difference quantification. The specific process is as follows:
[0096] Step 1.1: Non-numerical features (such as consumption habits, preferences, etc.) can reflect the behavior patterns of credit card users from the side. Their distribution in the feature space is complex and difficult to directly process. The present invention introduces conditional probability to normalize non-numerical features to quantify the differences between non-numerical features. The normalization formula is as follows:
[0097] ;
[0098] ;
[0099] Among them, represents the th non-numerical feature of the st transaction; represents the th non-numerical feature of the st transaction; is the difference quantification result of non-numerical features; , are two different transaction serial numbers; is the normalization factor, normalized to the range of [0,1]; represents the th value of the non-numerical feature; represents the values of other non-numerical features; represents the number of values of other non-numerical features; represents the conditional probability difference when the given values are and ; represents the conditional probability of the rd non-numerical feature; and are -corresponding two different subsets of the maximum conditional probability. Through the above formula, the differences between non-numerical features can be effectively quantified to achieve normalization processing.
[0100] Step 1.2. Numerical features (such as transaction amount, transaction merchant type, etc.) can directly reflect credit card transaction behaviors. When processing numerical features, the present invention divides them into equally-spaced intervals , being the -th interval. The difference quantization formula for numerical features is:
[0101] ;
[0102] where represents the -th numerical feature of the -th transaction; represents the -th numerical feature of the -th transaction; is the difference quantization result of the numerical feature; , respectively represent the -th and -th intervals; is the normalization factor; represents the difference quantization result between and
[0103] , and the calculation method is the same as that of the difference quantization calculation method for non-numerical features. Through discretization and normalization operations, the expression ability of numerical features in different intervals is improved.
[0103] Step 1.3. Temporal features (such as transaction time, periodicity, seasonality) can reflect the temporal patterns of credit card transactions. Based on the numerical features, feature weights are assigned to the temporal features, and the expression ability of transaction features is enhanced through time sensitivity. The processing formula for temporal features is:
[0104] ;
[0105] where represents the -th temporal feature of the -th transaction; represents the -th temporal feature of the -th transaction; is the difference quantization result of the temporal feature;
[0106] represents the weight of the temporal feature, which can be dynamically adjusted according to the importance of the temporal feature. The introduction of temporal features enhances the model's ability to capture time series.
[0106] Step 1.4. The difference quantization results of non-numerical, numerical, and temporal features are weighted and aggregated to calculate the overall feature difference between two transactions. The calculation formula is:
[0107] ;
[0108] Among them, is the overall feature difference; is the th transaction; represents the th transaction; is the number of numerical features; is the number of non-numerical features; is the number of time features.
[0109] Through the processing of the above transaction feature difference quantization strategy, the numerical, non-numerical, and time features in credit card transaction data are synchronously processed and differentially quantified. Further, different weight ratios are assigned according to the importance of the three types of features to construct a stronger credit card transaction feature representation ability.
[0110] Step 2: Construct a credit card transaction network. After completing the feature extraction and difference calculation of credit card transaction data, a credit card transaction network is constructed based on the similarity of transaction features. The credit card transaction network provides topological structure support for subsequent graph convolution training, and its specific construction process is as follows:
[0111] Step 2.1: In the credit card transaction dataset, regard each credit card transaction as a transaction node. To measure the similarity between all transaction pairs, first calculate the average value of the overall feature difference, and the formula is as follows:
[0112] ;
[0113] Among them, is the average value of the overall feature difference; is the total number of credit card transaction pairs, which is used for normalization.
[0114] Step 2.2: Based on the feature difference between credit card transactions, determine the connection relationship between transaction nodes according to the average value of the overall feature difference to form a credit card transaction network , where represents the node set, one transaction is a node, and the th transaction is the th node in the credit card transaction network, represents the edge set, the edge represents the transaction relationship, and the weight of each edge is determined by the overall feature difference; the edge set is in the form of an adjacency matrix, and the specific construction formula is as follows:
[0115] ;
[0116] Among them, It is the element at the -th row and the -th column in the adjacency matrix, indicating whether and are connected; the -th row corresponds to the -th transaction, and the -th column corresponds to the -th transaction. If the difference between and is less than or equal to , it is considered that there is an association between them, that is, , otherwise, it is considered that there is no association between them, that is, .
[0117] Step 2.3. In the credit card transaction network, the node degree and the neighborhood set are defined as follows:
[0118] ;
[0119] ;
[0120] where represents the node degree of the -th transaction, that is, the number of transaction nodes connected to ; represents the neighborhood set of , that is, the set of nodes directly connected to .
[0121] Step 2.4. In the credit card transaction network, the edge weight is represented as follows:
[0122] ;
[0123] where is the edge weight between and ; is the exponential function with base e; is a smoothing parameter used to control the attenuation rate of the weight. When , set . By assigning values to the edge weights, the association strength between transaction nodes can be captured more clearly, providing a better input for the subsequent training of the graph convolutional neural network.
[0124] Step 3. Construct a graph convolutional neural network to perform feature enhancement learning on the credit card transaction network. In order to perform deep feature enhancement learning on the credit card transaction network, the present invention designs a graph convolutional neural network with several hidden layers, and the transaction nodes perform enhancement learning during the propagation in the hidden layer. The specific process is as follows:
[0125] Step 3.1: Use the credit card transaction network as the input of the graph convolutional neural network, with the formula as follows:
[0126] ;
[0127] where, represents the feature embedding generated by the graph convolutional neural network; is the mapping function of the graph convolutional neural network. Through this process, the graph convolutional neural network can effectively generate feature embeddings suitable for fraud detection from the credit card transaction network.
[0128] Step 3.2: Train the parameters in the credit card transaction network in the hidden layer, continuously update the feature representation, and the mapping operation formula for each hidden layer is:
[0129] ;
[0130] where, is the feature matrix of the th hidden layer; is the adjacency matrix; is the activation function; is the degree matrix of; represents the normalized form of the adjacency matrix plus the identity matrix ; represents the symmetric normalization of the adjacency matrix; represents the th hidden layer weight matrix. Through this operation, the hidden layer can effectively update the node feature representation, thus better capturing the potential patterns in the credit card transaction network.
[0131] Step 3.2.2: To further improve the learning ability of the graph convolutional neural network on credit card transaction data, the present invention designs a hybrid weight matrix to introduce positive samples to contribute to the weight of feature extraction. The formula of the hybrid weight matrix is as follows:
[0132] ;
[0133] where, is the hybrid weight matrix; represents the original weight for L2 normalization; , are the feature matrices of the th transaction and the th transaction respectively; is a hyperparameter used to control the degree of weight adjustment. The weighted feature ratio of positive samples Used to distinguish positive and negative samples and improve the feature discrimination ability.
[0134] Step 3.3. At the th hidden layer, the update formula for the node features is as follows:
[0135] ;
[0136] Among them, represents the th hidden layer; is a non-linear activation function; is a hyperparameter; represents the node degree of the th transaction; represents the th transaction's node features in the
[0137] By stacking multiple layers, high-level features in the credit card transaction network are extracted to achieve optimized learning for the credit card fraud detection task.
[0138] Step 4. Build a counterfactual hypothesis network optimization mechanism. First, create a blank network, name it the real world, and transfer the node states of the enhanced transaction network to the real world. At the same time, generate a hypothesis world based on counterfactual hypotheses, and cyclically calculate the causal differences in credit card transactions between the real world and the hypothesis world. According to the causal differences, adjust the causal relationships of credit card transactions in the real world and the hypothesis world. The specific steps are as follows:
[0139] Step 4.1. Design a copy gate mechanism. By comprehensively considering the node neighborhood features and weights, transfer the parameters and node states in the graph convolutional neural network to the real world. The formula is as follows:
[0140] ;
[0141] ;
[0142] Among them, is the output of the copy gate, which controls the update degree of the transaction node; is the activation function; represents the th iteration's weight matrix; represents the th iteration's hidden state; represents the th iteration's bias; is the node state of the real world; is the copy gate update state output.
[0143] Step 4.2: Based on the counterfactual hypothesis, disconnect the connections between nodes with low similarity in the real world to generate a hypothetical world. The disconnection operation is defined as follows:
[0144] ;
[0145] where, is the hypothetical world; is an assignment operation; represents disconnection and between the connections.
[0146] The node states in the hypothetical world are updated as:
[0147] ;
[0148] where, , are the states of at the -th and -th iterations in the hypothetical world, respectively; represents the number of neighborhood nodes of; is the neighborhood set of , that is, the set of nodes directly connected to ; represents the node degree of at the -th iteration; represents the feature transformation function.
[0149] Step 4.3: To quantify the causal difference between the real world and the hypothetical world, calculate the causal difference between nodes. For any two credit card transaction nodes, the causal difference is defined as:
[0150] ;
[0151] where, is the causal difference; is the expected value; is whether the situation occurs; represents the expected value of when occurs; represents the expected value of when does not occur.
[0152] Step 4.4: According to the calculated causal difference, set a difference threshold to determine whether to remove the connection of nodes with weak causal differences. The judgment condition is as follows:
[0153] ;
[0154] ;
[0155] wherein, is the causal difference between transaction nodes; is the removal operation; , and th, th transaction nodes respectively; is the difference threshold representing the real world. In the above formula, when the determination result is 1, the connection between and is eliminated; otherwise, it is retained.
[0156] Step 4.5: Re-enter the adjusted hypothetical world into the graph convolutional neural network for a new round of training. The node state update formula is as follows:
[0157] ;
[0158] wherein, represents the th hidden layer in the hypothetical world; represents the th hidden layer in the hypothetical world; is the optimized adjacency matrix of the hypothetical world.
[0159] Step 4.6: After a new round of training, the final output of the new hypothetical world network is :
[0160] ;
[0161] wherein, represents the credit card transaction node relationship in the real world; represents the normalization of causal differences.
[0162] Step 5: Perform causal consistency determination to predict the legitimacy and fraudulence of the current credit card transaction. Judge the causal difference between the cyclically optimized hypothetical world and the real world. If the causal judgment is consistent, lock the node state of the real world and enter the output layer for classification output; the specific process is as follows:
[0163] Step 5.1: The causal consistency determination between the real world and the hypothetical world is determined by calculating the norm of the causal difference, specifically: when When the causal relationship between the real world and the hypothetical world is determined to be consistent, proceed to step 5.2; otherwise, return to step 4 and continue to optimize the real world and the hypothetical world.
[0164] Step 5.2: If the causal relationship is determined to be consistent, output the final real-world network, and use the classifier to predict the legitimacy and fraudulence of credit card transactions. The prediction formula is as follows:
[0165] ;
[0166] Where, is the prediction result; is the ReLU non-linear activation function; , are the weight matrices of the 0th hidden layer and the 1st hidden layer respectively; represents the input feature, through multiplication with , for linear transformation; is the softmax activation function, which is used to normalize the probability distribution.
[0167] Step 5.3: Preset a threshold (usually taken as 0.5). If , then the current credit card transaction is a fraudulent transaction; otherwise, it is a legitimate transaction.
[0168] The credit card fraud detection method based on the causal graph convolutional neural network provided by the present invention realizes the high-precision identification of credit card fraud transactions through steps such as designing a transaction feature difference quantification strategy, constructing a credit card transaction network, feature enhancement learning of the graph convolutional neural network, counterfactual hypothesis network optimization mechanism, and causal consistency determination. Taking the graph convolutional neural network as the baseline, the performance results are compared, and the evaluation indicators include: accuracy (ACC), recall rate, F1 score, and area under the sensitivity curve (AUC score).
[0169] The AUC score evaluates the performance of the model through the area under the ROC curve. The larger the area, the better the performance. It is created through the relationship between the true positive rate (TPR) and the false positive rate (FPR).
[0170] The performance of the present invention is evaluated on the Credit Card Fraud Detection dataset (hereinafter referred to as the CCFD dataset), which consists of credit card transaction records within two days in September 2013, including 492 fraudulent transactions, and the transaction imbalance ratio reaches 0.172%. The fraud labels are marked by professional investigators of the company, where 1 represents a fraudulent transaction and 0 represents a normal transaction. First, in data preprocessing, oversampling and undersampling are adopted to solve the problem of fraudulent transaction imbalance. Since the training of the graph convolutional neural network requires a large amount of computing resources, one hundred thousand data are randomly selected as a small dataset for mini-batch detection.
[0171] In the experiment of the present invention, the GCN method is selected as the comparative method. The comparison results of the accuracy, precision, F1 score, and AUC score between the method of the present invention (hereinafter referred to as the HC-GCN method) and the GCN method are shown in Table 1 below:
[0172] Table 1 Comparison results of different methods
[0173] 。
[0174] As shown in Table 1 and Figure 2 shown, the present invention is superior to the method of the present invention in terms of accuracy, precision, F1 score, and AUC score. The accuracy has increased by 0.99%, the precision has increased by 3.85%, the F1 score has increased by 3.12%, and the AUC score has increased by 5%, showing good classification performance for credit card transactions and improvements in all four evaluation indicators. In the dataset with added Gaussian noise, the performance of the method of the present invention is also superior to the GCN method. In addition, the GCN method and the method of the present invention are visualized, and the comparison results are as Figure 3 shown. (a) is the visualization result of the GCN method, and (b) is the visualization result of the method of the present invention. From the visualization results, it can be seen that the method of the present invention has better classification ability, more accurately identifies fraudulent and legitimate transactions, and effectively improves the detection performance of the model for credit card fraud transactions.
[0175] Of course, the above description is not a limitation of the present invention, and the present invention is not limited to the above examples. Changes, modifications, additions, or substitutions made by those skilled in the art within the scope of the essence of the present invention should also fall within the protection scope of the present invention.
Claims
1. A credit card fraud detection method based on counterfactual graph convolutional neural network, characterized in that: The steps include: Step 1: Obtain the original credit card transaction data set, and use the transaction feature difference quantification strategy to preprocess and quantify the data set; Step 2: Build a credit card transaction network; Step 3: Construct a graph convolutional neural network to perform feature enhancement learning on the credit card transaction network; Step 4: Construct a counterfactual hypothesis network optimization mechanism; Step 5: Perform causal consistency judgment to predict the legitimacy and fraud of the current credit card transaction; In step 1, the original credit card transaction dataset obtained is , the dimension is , Indicates the number of transactions, Indicates the number of features of each transaction; each transaction includes three features: non-numerical, numerical, and time. The process of preprocessing and difference quantification is as follows: Step 1.1, the non-numerical features include consumption habits and preferences; The difference quantification formula of non-numerical features is as follows: ; ; in, Indicates The first transaction non-numerical features; Indicates The first transaction non-numerical features; Quantify the differences of non-numerical features; , These are two different transaction numbers; Indicates The value of a non-numeric feature; Indicates the values of other non-numerical features; Indicates the number of values of other non-numerical features; Indicates a given value and The conditional probability difference when Indicated in The conditional probability of non-numerical features; and for two different subsets of corresponding maximum conditional probabilities; Step 1.2: The numerical features include transaction amount and transaction merchant type; the numerical features are divided into The quantitative formula for the difference of numerical features is: ; in, Indicates The first transaction Numerical features; Indicates The first transaction Numerical features; Quantify the results for differences in numerical features; , Respectively represent , intervals; express and The difference quantification result is calculated in the same way as the difference quantification calculation method of non-numerical features; Step 1.3, the time characteristics include transaction time, periodicity, and seasonality; the difference quantification formula of time characteristics is: ; in, Indicates The first transaction time characteristics; Indicates The first transaction time characteristics; Quantify the results for differences in temporal characteristics; Represents the weight of the time feature; Step 1.4: Perform weighted aggregation on the quantified results of the differences in non-numerical, numerical, and time features to calculate the overall feature difference between the two transactions. The calculation formula is: ; in, for overall characteristic differences; For the transactions; Indicates transactions; is the number of numerical features; is the number of non-numerical features; is the number of temporal features; The specific process of step 2 is: Step 2.1: In the credit card transaction dataset, each transaction is regarded as a transaction node. In order to measure the similarity between all transaction pairs, the average value of the overall feature difference is calculated. The formula is as follows: ; in, is the average value of the overall characteristic difference; Step 2.2: Determine the connection relationship between transaction nodes based on the average value of overall feature differences to form a credit card transaction network ,in Represents a node set, one transaction is one node, Transactions In the credit card transaction network nodes, Represents an edge set, an edge represents a transaction relationship, and the edge set is in the form of an adjacency matrix. The specific construction formula is as follows: ; in, is the adjacency matrix Line The elements of the column represent and Whether connected; The row corresponds to Transaction No. Column corresponds to transactions; if and The difference between , then it is believed that there is a correlation between them, that is, , otherwise, it is considered that there is no correlation between them, that is, ; Step 2.3: In the credit card transaction network, the node degree and neighborhood set are defined as follows: ; ; in, Indicates The node degree of the transaction; express The neighborhood set of ; Step 2.4: In the credit card transaction network, the edge weights are expressed as follows: ; in, for and The edge weights between is an exponential function with base e; is a smoothing parameter; In step 3, the graph convolutional neural network includes several hidden layers, and the transaction nodes perform feature enhancement learning during the propagation of the hidden layers; the specific process is as follows: Step 3.1: Use the credit card transaction network as the input of the graph convolutional neural network. The formula is as follows: ; in, Represents the feature embedding generated by the graph convolutional neural network; is the mapping function of the graph convolutional neural network; Step 3.2: Train the parameters in the credit card transaction network in the hidden layer and continuously update the feature representation. The mapping operation formula for each hidden layer is: ; in, For the The feature matrix of hidden layers; is the adjacency matrix; is the activation function; for The degree matrix of Represents the adjacency matrix Add the identity matrix The normalized form of ; Indicates The weight matrix of the hidden layers; Step 3.2.2, introduce positive samples and design the mixed weight matrix. The formula is as follows: ; in, is the mixing weight matrix; Represents the original weight matrix Perform L2 normalization; , Respectively Transaction, The feature matrix of each transaction; is a hyperparameter; Step 3.3, in There are hidden layers, and the update formula of node features is as follows: ; in, Indicates hidden layers; is a nonlinear activation function; is a hyperparameter; Indicates The node degree of the transaction; Indicates The transaction was Node features of hidden layers; The specific process of step 4 is as follows: Step 4.
1. Create a blank network, name it the real world, and design a copy gate mechanism to pass the parameters and node states in the graph convolutional neural network to the real world. The formula is as follows: ; ; in, is the output of the replication gate; is the activation function; Indicates The weight matrix of the iteration; Indicates In iteration The hidden state of Indicates The bias of the iteration; For the real world; for The replication gate updates the state output; Step 4.2: Based on the counterfactual hypothesis, disconnect the nodes with low similarity in the real world to generate a hypothetical world. The disconnection operation is defined as follows: ; in, For the hypothetical world; It is an assignment operation; Indicates disconnection and The connection between Assume that the node status in the world is updated as follows: ; in, , In the hypothetical world In the sequence The state at the iteration; express The number of neighboring nodes; for The neighborhood set of ; express In the The node degree in the iteration; represents the feature transformation function; Step 4.3: In order to quantify the causal difference between the real world and the hypothetical world, the causal difference between nodes is calculated. For any two credit card transaction nodes, the causal difference is defined as: ; in, for causal differences; is the expected value; Indicated in In case of occurrence Expected value; Indicated in If it does not happen Expected value; Step 4.4: Set a difference threshold to determine whether to remove node connections with weak causal differences. The judgment conditions are as follows: ; ; in, is the causal effect between transaction nodes; To remove the operation; , Respectively , transaction nodes; Step 4.5: Re-input the adjusted hypothetical world into the graph convolutional neural network for a new round of training. The node state update formula is as follows: ; in, In the hypothetical world hidden layers; In the hypothetical world hidden layers; is the optimized hypothetical world adjacency matrix; Step 4.6: After a new round of training, the final output of the new hypothetical world is : ; in, represents the normalization of causal differences; The specific process of step 5 is as follows: Step 5.1: The causal consistency between the real world and the hypothetical world is determined by calculating the norm of the causal difference, specifically: When , it is determined that the causal relationship between the real world and the hypothetical world is consistent, and step 5.2 is performed; otherwise, return to step 4 and continue to optimize the real world and the hypothetical world; Step 5.2: Predict the legitimacy and fraud of credit card transactions. The prediction formula is as follows: ; in, To predict the results; is the ReLU nonlinear activation function; , are the weight matrices of the 0th hidden layer and the 1st hidden layer respectively; represents the input features, Through , Multiply to perform linear transformation; is the softmax activation function; Step 5.3: Pre-set a threshold ,like , then the current credit card transaction is a fraudulent transaction, otherwise, it is a legal transaction.
Citation Information
Patent Citations
Dynamic graph fraud detection method based on Transform causal chain
CN116579848A
Transformer fault diagnosis model construction method and device based on anti-fact analysis
CN118797477A