Vae-sagan model, fraud detection model training method and system
By leveraging the self-attention mechanism and adversarial loss adjustment of the VAE-SAGAN model, reconstructed samples similar to fraudulent samples are generated, addressing the data imbalance problem in fraud detection and improving the model's sensitivity and fraud detection capabilities.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2026-03-17
AI Technical Summary
In fraud detection, because fraudulent behavior accounts for a very small percentage, the data is imbalanced. Traditional models tend to predict the majority class of samples while ignoring the minority of fraudulent samples, which affects the accuracy of the model and causes economic losses.
The VAE-SAGAN model is adopted, which maps fraudulent samples to a low-dimensional latent space through a self-attention mechanism, generates reconstructed samples similar to the fraudulent samples, and uses the adversarial loss value of the discriminator to adjust the model parameters, increase the number of minority class samples, and achieve data balance.
By generating high-quality minority class fraud samples, the sensitivity and accuracy of fraud detection models can be improved, the problem of data imbalance can be alleviated, and fraud detection capabilities can be enhanced.
Smart Images

Figure CN119357612B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data balancing technology, specifically to a VAE-SAGAN model, a fraud detection model training method and system. Background Technology
[0002] In the fintech field, fraud detection often faces the challenge of data imbalance. Because fraudulent activity represents a very small percentage of actual transactions, fraud detection datasets typically contain a large number of legitimate transaction samples and a very small number of fraudulent samples. This imbalance causes traditional machine learning models to tend to predict the majority class during training, thus ignoring the minority class of fraudulent samples and leading to decreased model accuracy. Such misjudgments not only affect the classification ability of fraud detection models but can also potentially result in significant economic losses. Therefore, effectively addressing the data imbalance between fraudulent and legitimate transaction samples, and ensuring the sensitivity and accuracy of fraud detection models for the minority class of fraudulent samples, is a crucial issue in current fraud detection research.
[0003] To address the data imbalance between fraudulent and legitimate transaction samples, resampling is a common approach. Resampling methods include undersampling and oversampling. However, undersampling may remove crucial majority class legitimate transaction samples, leading to the loss of important information and affecting the effectiveness of data balancing between fraudulent and legitimate samples. Therefore, how to ensure effective data balancing between fraudulent and legitimate transaction samples through oversampling is a pressing issue that needs to be addressed.
[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this application, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0005] This invention provides a VAE-SAGAN model, a fraud detection model training method and system, which can ensure the data balance between fraud samples and normal transaction samples through oversampling.
[0006] Firstly, in order to solve the above-mentioned technical problems, the present invention provides a VAE-SAGAN model training method, comprising:
[0007] Multiple first fraud samples are obtained as the first training set; wherein, the first fraud samples are the data corresponding to fraudulent behaviors that occur during transactions;
[0008] The first training set is input into the pre-trained VAE-SAGAN model for training. The training process is as follows:
[0009] Step S121: Input each first fraud sample into the pre-trained VAE-SAGAN model, trigger the variational autoencoder of the pre-trained VAE-SAGAN model to map each received first fraud sample to a low-dimensional latent space based on the self-attention mechanism to obtain the corresponding latent variables, and reconstruct each latent variable to obtain the first reconstructed fraud sample corresponding to each first fraud sample.
[0010] Step S122: Obtain the reconstruction loss value between each first fraud sample and the corresponding first reconstructed fraud sample, and obtain the adversarial loss value between each first fraud sample and the corresponding first reconstructed fraud sample determined by the discriminator of the pre-trained VAE-SAGAN model.
[0011] Step S123: The sum of the reconstruction loss value and the adversarial loss value corresponding to each first fraud sample is taken as the total loss value;
[0012] Step S124: Adjust the parameters of the pre-trained VAE-SAGAN model based on each total loss value, and repeat steps S121 to S124 until each total loss value converges, and / or until the preset number of iterations, then use the current pre-trained VAE-SAGAN model as the target VAE-SAGAN model.
[0013] Secondly, in order to solve the above-mentioned technical problems, the present invention provides a method for training a fraud detection model, comprising:
[0014] Multiple second fraud samples and multiple normal transaction samples are obtained as a second training set; wherein the number of the second fraud samples and the number of the normal transaction samples are balanced in the second training set; the second fraud samples are data corresponding to fraudulent behavior that occurs during a transaction, and the normal transaction samples are data corresponding to behavior during a normal transaction;
[0015] The second training set is input into the pre-trained fraud detection model for training, and the trained target fraud detection model is obtained.
[0016] Thirdly, in order to solve the above-mentioned technical problems, the present invention provides a VAE-SAGAN model training system, comprising:
[0017] The first acquisition module is used to acquire multiple first fraud samples as a first training set; wherein, the first fraud samples are data corresponding to fraudulent behaviors that occur during transactions;
[0018] The first training module is used to input the first training set into the pre-trained VAE-SAGAN model for training; the first training module includes a reconstruction unit, a first loss value unit, a second loss value unit, and a termination unit;
[0019] The reconstruction unit is used to input each first fraud sample into the pre-trained VAE-SAGAN model, trigger the variational autoencoder of the pre-trained VAE-SAGAN model to map each received first fraud sample to a low-dimensional latent space based on a self-attention mechanism to obtain the corresponding latent variables, and reconstruct each latent variable to obtain the first reconstructed fraud sample corresponding to each first fraud sample.
[0020] The first loss value unit is used to obtain the reconstruction loss value between each first fraud sample and the corresponding first reconstructed fraud sample, and to obtain the adversarial loss value between each first fraud sample and the corresponding first reconstructed fraud sample as determined by the discriminator of the pre-trained VAE-SAGAN model;
[0021] The second loss value unit is used to sum the reconstruction loss value and the adversarial loss value corresponding to each first fraud sample as the total loss value;
[0022] The termination unit is used to adjust the parameters of the pre-trained VAE-SAGAN model based on each total loss value, and repeatedly execute the steps corresponding to the reconstruction unit, the first loss value unit, the second loss value unit and the termination unit until each total loss value converges, and / or until the preset number of iterations, then the current pre-trained VAE-SAGAN model is used as the target VAE-SAGAN model.
[0023] Fourthly, in order to solve the above-mentioned technical problems, the present invention provides a training system for a fraud detection model, comprising:
[0024] The second acquisition module is used to acquire multiple second fraud samples and multiple normal transaction samples as a second training set; wherein the number of the second fraud samples and the number of the normal transaction samples are balanced in the second training set; the second fraud samples are data corresponding to fraudulent behavior that occurs during a transaction, and the normal transaction samples are data corresponding to behavior during a normal transaction;
[0025] The second training module is used to input the second training set into the pre-trained fraud detection model for training, so as to obtain the trained target fraud detection model.
[0026] The beneficial effects of this invention are as follows: By acquiring data corresponding to fraudulent activities occurring during transactions as first fraud samples, a pre-trained VAE-SAGAN model is trained using multiple first fraud samples. The variational autoencoder in the pre-trained VAE-SAGAN model can map each received first fraud sample to a low-dimensional latent space based on a self-attention mechanism to obtain corresponding latent variables, which characterize the feature distribution of the first fraud samples. Therefore, when the variational autoencoder in the pre-trained VAE-SAGAN model reconstructs each latent variable based on the self-attention mechanism, it can generate first reconstructed fraud samples similar to the first fraud samples based on the feature distribution of the first fraud samples. Next, the reconstruction loss value and the adversarial loss value of the discriminator are obtained between each first fraud sample and the corresponding first reconstructed fraud sample. The parameters of the pre-trained VAE-SAGAN model are adjusted according to the reconstruction loss value and the adversarial loss value, so that the first reconstructed fraud sample output by the trained target VAE-SAGAN model is more realistic. This allows for the generation of real first reconstructed fraud samples based on the first fraud samples, thereby increasing the number of minority class fraud samples and forming high-quality minority class fraud samples that match the majority class normal transaction samples. This achieves the effect of ensuring data balance between fraud samples and normal transaction samples through oversampling. Attached Figure Description
[0027] Figure 1 A flowchart illustrating a VAE-SAGAN model training method provided by this invention;
[0028] Figure 2 A schematic diagram of prediction using a variational self-attention generative adversarial network provided by the present invention;
[0029] Figure 3 A flowchart illustrating a training method for a fraud detection model provided by the present invention;
[0030] Figure 4 This is a schematic diagram of the structure of a VAE-SAGAN model training system provided by the present invention;
[0031] Figure 5 This is a schematic diagram of the structure of a training system for a fraud detection model provided by the present invention. Detailed Implementation
[0032] The principles and features of the present invention are described below. The examples given are only for explaining the present invention and are not intended to limit the scope of the present invention.
[0033] The following describes, with reference to the accompanying drawings, an embodiment of the present invention, a VAE-SAGAN model, a fraud detection model training method and system, specifically including a VAE-SAGAN model training method, a fraud detection model training method, a VAE-SAGAN model training system and a fraud detection model training system.
[0034] like Figure 1 As shown, this disclosure provides a VAE-SAGAN model training method, including:
[0035] Step S11: Obtain multiple first fraud samples as the first training set. The first fraud samples are the data corresponding to fraudulent activities that occur during the transaction.
[0036] In some embodiments, fraudulent activities occurring during a transaction include credit card fraud and loan fraud. For example, when the fraud involves credit card fraud, the corresponding data includes the differences between fraudulent and legitimate card transactions. It is understood that the time, location, and amount of fraudulent transactions will differ significantly from legitimate card transactions, and these differences can serve as the first fraud sample. Similarly, when the fraud involves credit card fraud, the corresponding data includes significantly similar fraudulent spending habits. It is understood that fraudulent transactions often involve specific goods (such as easily convertible gold jewelry, luxury goods, etc.), and to avoid the legitimate cardholder discovering the fraud immediately, the perpetrator will choose to commit the fraud at night or in the early morning, times when it is less likely to be detected.
[0037] Step S12: Input the first training set into the pre-trained VAE-SAGAN model for training. The training process is as follows:
[0038] Step S121: Input each first fraud sample into the pre-trained VAE-SAGAN model, trigger the variational autoencoder of the pre-trained VAE-SAGAN model to map each received first fraud sample to a low-dimensional latent space based on the self-attention mechanism to obtain the corresponding latent variables, and reconstruct each latent variable to obtain the first reconstructed fraud sample corresponding to each first fraud sample.
[0039] Specifically, in combination Figure 2 As shown, Figure 2A prediction diagram of a Variational Self-Attention Generative Adversarial Network (VAE-SAGAN) is provided. The VAE-SAGAN includes a variational autoencoder (hereinafter referred to as the variational autoencoder) based on a self-attention mechanism and a discriminator (hereinafter referred to as the discriminator) based on a self-attention mechanism. The variational autoencoder comprises an encoder and a decoder. The encoder sequentially includes a multi-head self-attention layer, a convolutional layer, a fully connected layer, and a lambda layer. The decoder sequentially includes a fully connected layer, a multi-head self-attention layer, a Flatten operation, and another fully connected layer. The discriminator sequentially includes a self-attention layer, an activation function, and three fully connected layers. Specifically, a first fraudulent sample is input into the encoder. The encoder, through its multi-head self-attention layer, adaptively assigns different weights to different positions in the input data (the first fraudulent sample), so that when encoding the input data, it can take into account both local and total information of the input data, and finally output the encoded latent variables to the decoder. The decoder captures global information from the latent variables output by the encoder through its own multi-head self-attention layer, and reconstructs the latent variables through a Flatten operation and a fully connected layer to obtain the first reconstructed fraud sample. In this embodiment, the dimension of the input layer is set to 158 (input_dim = 158), which represents the transaction data features of the first fraud sample. The decoder output is compressed to the [0,1] interval by the Sigmoid activation function.
[0040] In some embodiments, the encoder maps each received first fraudulent sample to a low-dimensional latent space to obtain corresponding latent variables. For example, taking a single first fraudulent sample as an example, the encoder extracts the data features of the input data (i.e., the first fraudulent sample) through a one-dimensional convolutional layer. This layer uses 64 filters, a filter size of 5, and a stride of 2, thereby preserving the important feature information of the first fraudulent sample input data. Subsequently, the encoder further extracts features through another convolutional layer with 128 filters, each layer using the same filter size and stride. After feature extraction, a fully connected layer is used to map the extracted feature data to the latent space to obtain the corresponding latent variables.
[0041] Step S122: Obtain the reconstruction loss value between each first fraud sample and the corresponding first reconstructed fraud sample, and obtain the adversarial loss value between each first fraud sample and the corresponding first reconstructed fraud sample determined by the discriminator of the pre-trained VAE-SAGAN model.
[0042] The reconstruction loss is defined as follows: In variational autoencoders, the reconstruction loss measures the performance of the pre-trained VAE-SAGAN model by comparing the difference between the first fraudulent sample of the original input and the first reconstructed fraudulent sample of the reconstructed output. It represents the error incurred by the pre-trained VAE-SAGAN model during the learning process, as it attempts to compress the input data into a low-dimensional representation and then restore it to the original data. A smaller reconstruction loss indicates a stronger reconstruction capability of the pre-trained VAE-SAGAN model, meaning it can better reconstruct the first fraudulent sample. The adversarial loss is defined as the Wasserstein loss, which primarily measures the difference between the distribution of the generated first reconstructed fraudulent sample and the distribution of the first fraudulent sample.
[0043] In some embodiments, see again Figure 2 The discriminator comprises a self-attention layer, an activation function, and three fully connected layers. Each fully connected layer contains 256 neurons. Thus, the discriminator improves the variational autoencoder's ability to generate first reconstructed fraudulent samples by judging the authenticity of the first fraudulent sample and the first reconstructed fraudulent sample. This allows the variational autoencoder to generate first reconstructed fraudulent samples that are as similar as possible to the first fraudulent sample using latent variables. Therefore, the VAE-SAGAN model in this embodiment combines the advantages of variational autoencoders (VAE), self-attention mechanisms, and adversarial networks (GANs), enabling the generation of more realistic and diverse minority class first fraudulent samples. This improves the balance and robustness of the training set of the fraud detection model.
[0044] Step S123: The sum of the reconstruction loss value and the adversarial loss value corresponding to each first fraud sample is taken as the total loss value.
[0045] In some embodiments, the total loss value is determined using the following formula:
[0046] Loss totol =α·Loss recon +β·Loss WGAN Loss total Loss is the total loss value. recon To reconstruct the loss value, Loss WGAN To counteract the loss value, α and β are hyperparameters that adjust the weights of each loss term.
[0047] Step S124: Adjust the parameters of the pre-trained VAE-SAGAN model based on each total loss value, and repeat steps S121 to S124 until each total loss value converges, and / or until the preset number of iterations, then use the current pre-trained VAE-SAGAN model as the target VAE-SAGAN model.
[0048] The VAE-SAGAN model training method provided in this disclosure uses data corresponding to fraudulent activities occurring during transactions as first fraud samples. Multiple first fraud samples are then used to train a pre-trained VAE-SAGAN model. The variational autoencoder in the pre-trained VAE-SAGAN model can map each received first fraud sample to a low-dimensional latent space based on a self-attention mechanism to obtain corresponding latent variables. These latent variables characterize the feature distribution of the first fraud samples. Therefore, when the variational autoencoder in the pre-trained VAE-SAGAN model reconstructs each latent variable based on the self-attention mechanism, it can generate first reconstructed fraud samples similar to the first fraud samples based on the feature distribution of the first fraud samples. Next, the reconstruction loss value and the adversarial loss value of the discriminator are obtained between each first fraud sample and the corresponding first reconstructed fraud sample. The parameters of the pre-trained VAE-SAGAN model are adjusted according to the reconstruction loss value and the adversarial loss value, so that the first reconstructed fraud sample output by the trained target VAE-SAGAN model is more realistic. This allows for the generation of real first reconstructed fraud samples based on the first fraud samples, thereby increasing the number of minority class fraud samples and forming high-quality minority class fraud samples that match the majority class normal transaction samples. This achieves the effect of ensuring data balance between fraud samples and normal transaction samples through oversampling.
[0049] Preferably, obtaining multiple first fraud samples as a first training set includes: obtaining multiple first original fraud samples. The first original fraud samples are the data corresponding to fraudulent activities that occurred during the transaction. The DBSCAN (Density-Based Spatial Clustering of Applications with Noise) algorithm is used to remove overlapping and noisy samples from the multiple first original fraud samples, resulting in multiple first fraud samples. These multiple first fraud samples are then used as the first training set.
[0050] In this way, by using the DBSCAN algorithm to process multiple initial fraudulent samples and identifying the density differences between them, low-density noise and overlapping samples can be effectively removed, while retaining high-density core samples. This optimizes the quality of minority class fraudulent samples in the first training set, laying a solid foundation for training the VAE-SAGAN model.
[0051] Specifically, the DBSCAN algorithm is used to remove overlapping and noisy samples from multiple initial fraudulent samples to obtain multiple initial fraudulent samples. This includes preprocessing the multiple initial fraudulent samples to remove those containing missing values, outliers, or duplicate records. This process ensures the integrity and quality of the input data used to train the VAE-SAGAN model. The density-based noise applied spatial clustering (DBSCAN) algorithm is then used to further process each preprocessed initial fraudulent sample. For example, an initial DBSCAN clustering model is constructed, the number of points in the neighborhood is calculated based on the sample density, and core points, boundary points, and noise points are determined. Noise points are deleted, and overlapping regions are removed, thereby selecting valid initial fraudulent samples. This effectively removes low-density noise and overlapping samples from multiple initial fraudulent samples, retaining high-density core samples. This optimizes the quality of minority class initial fraudulent samples in the first training set. In this embodiment, the DBSCAN algorithm sets the radius parameter eps to 1, defining the maximum distance between two initial fraudulent points. The minimum number of samples min-samples is set to 10, defining the minimum number of neighborhood samples required to form a cluster.
[0052] Preferably, obtaining the reconstruction loss value between each first fraud sample and its corresponding first reconstructed fraud sample includes: calculating the reconstruction loss value between each first fraud sample and its corresponding first reconstructed fraud sample based on each first fraud sample and its corresponding first reconstructed fraud sample, using the following formula: Loss recon =binary-crossentropy(x input x recon ). Among them, Loss recon To reconstruct the loss value, x input As the first fraud sample, x recon This is the first reconstructed fraud sample.
[0053] In this way, by determining the error between the first reconstructed fraudulent sample and the first fraudulent sample, the reconstruction loss value between the two can be determined. This allows the parameters of the pre-trained VAE-SAGAN model to be adjusted, enabling the variational autoencoder in the pre-trained VAE-SAGAN model to generate a first reconstructed fraudulent sample that is more similar to and more realistic than the first fraudulent sample. This, in turn, allows the target VAE-SAGAN model to generate high-quality minority class first fraudulent samples that match the majority class of normal transaction samples.
[0054] Preferably, obtaining the adversarial loss value between the discriminator of the pre-trained VAE-SAGAN model and the corresponding first reconstructed fraud sample for each first fraudulent sample includes: obtaining the first discrimination result of the discriminator of the pre-trained VAE-SAGAN model for the first fraudulent sample, and obtaining the second discrimination result of the discriminator for the first reconstructed fraudulent sample. Based on each first discrimination result and the corresponding second discrimination result, the adversarial loss value between the discriminator and the corresponding first reconstructed fraudulent sample for each first fraudulent sample is calculated, as follows: Among them, Loss WGAN To counteract the loss value, D(x) input D(x) is the first discrimination result. recon () is the second discrimination result.
[0055] In this way, adversarial loss values are obtained by acquiring the discriminator's judgments on the first fraudulent sample and the first reconstructed fraudulent sample. This allows for the adjustment of the parameters of the pre-trained VAE-SAGAN model. The discriminator's judgment of the authenticity of the first fraudulent sample and the first reconstructed fraudulent sample in the pre-trained VAE-SAGAN model is then used to adjust the variational autoencoder of the pre-trained VAE-SAGAN model, thereby improving the variational autoencoder's ability to generate first reconstructed fraudulent samples that are more similar to and more realistic than the first fraudulent sample. This enables the target VAE-SAGAN model to generate high-quality minority class first fraudulent samples that match the majority class of normal transaction samples.
[0056] Preferably, adjusting the parameters of the pre-trained VAE-SAGAN model based on each total loss value includes: using the Adam optimizer to adjust the parameters of the pre-trained VAE-SAGAN model based on each total loss value. In this embodiment, the learning rate is 0.001, and the momentum parameters are set to 0.5 and 0.9.
[0057] like Figure 3 As shown in the embodiments of this disclosure, a method for training a fraud detection model is provided, including:
[0058] Step S21: Obtain multiple second fraud samples and multiple normal transaction samples as a second training set. The number of second fraud samples and normal transaction samples in the second training set is balanced; the second fraud samples are data corresponding to fraudulent activities that occur during transactions, and the normal transaction samples are data corresponding to behaviors that occur during normal transactions.
[0059] Understandably, the proportion balance in the second training set indicates that the number of fraudulent samples and normal transactions is relatively close.
[0060] Understandably, multiple second fraud samples and multiple normal transaction samples are obtained as a dataset. This dataset is randomly divided into a training set, a test set, and a validation set according to a preset ratio, and the training set divided according to the preset ratio is used as the second training set. A pre-trained fraud detection model is trained based on this second training set, the hyperparameters of the pre-trained fraud detection model are adjusted based on the validation set, and the performance of the trained target fraud detection model is evaluated based on the test set. Thus, by randomly dividing the dataset into training, test, and validation sets according to a preset ratio, the target fraud detection model can be evaluated using cross-validation technology, thereby further improving the robustness of the target fraud detection model. In this embodiment, the preset ratio includes a 6:2:2 ratio of training set to test set to validation set.
[0061] Step S22: Input the second training set into the pre-trained fraud detection model for training to obtain the trained target fraud detection model.
[0062] The training method of the fraud detection model in this embodiment obtains a second fraud sample with a number equivalent to that of normal transaction samples, thereby balancing the training sample data in the second training set. This ensures the accuracy of the fraud detection model's sensitivity to the second fraud sample when training the preset fraud detection model, and improves the fraud detection model's ability to detect fraudulent behavior.
[0063] Preferably, obtaining multiple second fraud samples includes: obtaining multiple second original fraud samples. The second original fraud samples are data corresponding to fraudulent activities that occurred during the transaction. Each second original fraud sample is input into the target VAE-SAGAN model shown above to obtain a second reconstructed fraud sample corresponding to each second original fraud sample. Each second reconstructed fraud sample is used as a new second original fraud sample and input into the target VAE-SAGAN model to obtain a new second reconstructed fraud sample, until the sum of the number of all second original fraud samples and all second reconstructed fraud samples is balanced with the proportion of the number of normal transaction samples in the second training set. Both the second original fraud samples and the second reconstructed fraud samples are used as second fraud samples to obtain multiple second fraud samples.
[0064] The target VAE-SAGAN model described above, through a self-attention-based variational encoder and discriminator, can generate a second reconstructed fraud sample that is similar to and highly realistic based on the second original fraud sample. In this way, by generating a second reconstructed fraud sample with high similarity and realism to the second original fraud sample through the target VAE-SAGAN model, the number of more realistic and diverse minority class second fraud samples can be reliably increased. This mitigates the impact of data imbalance on the fraud detection model, thereby improving the model's ability to detect fraudulent behavior.
[0065] In some embodiments, the number of normal transaction samples is 3a. The number of second original fraud samples is a. Each second original fraud sample is input into the target VAE-SAGAN model to obtain a second reconstructed fraud samples. These a reconstructed fraud samples are then used as new second original fraud samples and input into the target VAE-SAGAN model to obtain a new second reconstructed fraud samples. Therefore, the total number of second original fraud samples is the sum of the initial and new second original fraud samples, which is 2a. The total number of second reconstructed fraud samples is the new second reconstructed fraud sample a output by the target VAE-SAGAN model at its last iteration. Thus, the sum of the total number of second original fraud samples and the total number of second reconstructed fraud samples is 3a, which is balanced with the proportion of normal transaction samples in the second training set.
[0066] Preferably, obtaining multiple second original fraud samples includes obtaining multiple third original fraud samples. The third original fraud samples are data corresponding to fraudulent activities that occurred during the transaction. The DBSCAN algorithm is used to remove overlapping and noisy samples from the multiple third original fraud samples to obtain multiple second original fraud samples.
[0067] Because the sample data contains missing values, outliers, or duplicate records, the quality of model training is affected. Therefore, by obtaining a third original fraud sample, the DBSCAN algorithm is used to remove overlapping and noisy samples from multiple third original fraud samples, thereby filtering out the poor-quality sample data in the third original fraud sample and ensuring the quality of the second original fraud sample during model training.
[0068] Preferably, obtaining multiple normal transaction samples includes: obtaining multiple original normal transaction samples; wherein, the original normal transaction samples are the data corresponding to the behavior during normal transactions. The DBSCAN algorithm is used to remove overlapping and noisy samples from the multiple original normal transaction samples to obtain multiple normal transaction samples.
[0069] Because sample data may contain missing values, outliers, or duplicate records, the quality of model training can be affected. Therefore, by obtaining original normal transaction samples, the DBSCAN algorithm is used to remove overlapping and noisy samples from multiple original normal transaction samples, thereby filtering out the poor-quality sample data in the original normal transaction samples and ensuring the quality of normal transaction samples during model training.
[0070] Preferably, the pre-trained fraud detection model includes support vector machines, gradient boosting trees, or deep neural networks.
[0071] For ease of understanding, the fraud detection model in this embodiment employs Gradient Boosting Tree (GBT). GBT is an ensemble algorithm that improves the predictive performance of a model by progressively building multiple decision trees. The training process includes: the construction of the pre-trained GBT model depends on key parameters such as the number of trees, the learning rate, and the maximum depth of each tree. In this embodiment, the number of trees is set to 100, the learning rate to 0.1, and the maximum depth of each tree to 3. The pre-trained GBT model is trained using a training set. The pre-trained GBT model learns the residuals (i.e., prediction errors) in each iteration by progressively adding decision trees, thereby improving the overall performance of the pre-trained GBT model. For example, each tree is trained using a forward distribution to progressively reduce the model's error. After training, the target GBT model is initially evaluated using a test set, and its generalization ability is further verified using a validation set. It should be understood that the metrics used in the evaluation process include F1 (F1-score), G-mean, AUC, and accuracy to comprehensively measure the performance of the target GBT model on imbalanced datasets.
[0072] Thus, a Gradient Boosting Tree (GBT) was used as a pre-trained fraud detection model and trained accordingly. The pre-trained fraud detection model learns from the residuals in the training data by progressively building multiple decision trees, thus optimizing the overall prediction performance. By appropriately setting key parameters such as the number of trees, learning rate, and maximum depth, the trained fraud detection model showed significant improvement in performance on imbalanced datasets. Evaluation metrics such as F1 score, G-mean, AUC, and accuracy were all improved, thereby enhancing the model's generalization ability and detection accuracy.
[0073] like Figure 4As shown, this disclosure provides a VAE-SAGAN model training system, including a first acquisition module and a first training module. The first acquisition module acquires multiple first fraud samples as a first training set. The first fraud samples are data corresponding to fraudulent activities occurring during transactions. The first training module inputs the first training set into a pre-trained VAE-SAGAN model for training. This first training module includes a reconstruction unit, a first loss value unit, a second loss value unit, and a termination unit. The reconstruction unit inputs each first fraud sample into the pre-trained VAE-SAGAN model, triggering the variational autoencoder of the pre-trained VAE-SAGAN model to map each received first fraud sample to a low-dimensional latent space based on a self-attention mechanism to obtain corresponding latent variables, and then reconstructs each latent variable to obtain a first reconstructed fraud sample corresponding to each first fraud sample. The first loss value unit acquires the reconstruction loss value between each first fraud sample and its corresponding first reconstructed fraud sample, and acquires the adversarial loss value determined by the discriminator of the pre-trained VAE-SAGAN model between each first fraud sample and its corresponding first reconstructed fraud sample. The second loss value unit is used to sum the reconstruction loss value and the adversarial loss value corresponding to each first fraudulent sample as the total loss value. The termination unit is used to adjust the parameters of the pre-trained VAE-SAGAN model based on each total loss value, and repeat steps S121 to S124 until each total loss value converges, and / or until the preset number of iterations, then the current pre-trained VAE-SAGAN model is used as the target VAE-SAGAN model.
[0074] The VAE-SAGAN model training system provided in this disclosure uses data corresponding to fraudulent activities occurring during transactions as first fraud samples. Multiple first fraud samples are then used to train a pre-trained VAE-SAGAN model. The variational autoencoder in the pre-trained VAE-SAGAN model can map each received first fraud sample to a low-dimensional latent space based on a self-attention mechanism to obtain corresponding latent variables. These latent variables characterize the feature distribution of the first fraud samples. Therefore, when the variational autoencoder in the pre-trained VAE-SAGAN model reconstructs each latent variable based on the self-attention mechanism, it can generate first reconstructed fraud samples similar to the first fraud samples based on the feature distribution of the first fraud samples. Next, the reconstruction loss value and the adversarial loss value of the discriminator are obtained between each first fraud sample and the corresponding first reconstructed fraud sample. The parameters of the pre-trained VAE-SAGAN model are adjusted according to the reconstruction loss value and the adversarial loss value, so that the first reconstructed fraud sample output by the trained target VAE-SAGAN model is more realistic. This allows for the generation of real first reconstructed fraud samples based on the first fraud samples, thereby increasing the number of minority class fraud samples and forming high-quality minority class fraud samples that match the majority class normal transaction samples. This achieves the effect of ensuring data balance between fraud samples and normal transaction samples through oversampling.
[0075] Preferably, the first acquisition module is specifically used to acquire multiple first original fraud samples. These first original fraud samples are data corresponding to fraudulent activities that occur during a transaction. The DBSCAN algorithm is used to remove overlapping and noisy samples from the multiple first original fraud samples to obtain multiple first fraud samples. These multiple first fraud samples are used as a first training set.
[0076] Preferably, the first loss value unit is specifically used to calculate the reconstruction loss value between each first fraud sample and its corresponding first reconstructed fraud sample based on each first fraud sample and its corresponding first reconstructed fraud sample, as shown in the following formula: Loss recon = binary_crossentropy(x input x recon )
[0077] Among them, Loss recon To reconstruct the loss value, x input As the first fraud sample, x recon This is the first reconstructed fraud sample.
[0078] Preferably, the first loss value unit is specifically used to obtain the first discrimination result of the discriminator of the pre-trained VAE-SAGAN model for the first fraudulent sample, and to obtain the second discrimination result of the discriminator for the first reconstructed fraudulent sample; based on each first discrimination result and the corresponding second discrimination result, the adversarial loss value between each first fraudulent sample and the corresponding first reconstructed fraudulent sample is calculated, as follows:
[0079] Among them, Loss WGAN To counteract the loss value, D(x) input D(x) is the first discrimination result. recon () is the second discrimination result.
[0080] like Figure 5 As shown in the illustration, this disclosure provides a training system for a fraud detection model, including a second acquisition module and a second training module. The second acquisition module is used to acquire multiple second fraud samples and multiple normal transaction samples as a second training set; wherein the number of second fraud samples and normal transaction samples is balanced in the second training set; the second fraud samples are data corresponding to fraudulent behaviors occurring during transactions, and the normal transaction samples are data corresponding to behaviors occurring during normal transactions. The second training module is used to input the second training set into a pre-trained fraud detection model for training, thereby obtaining a trained target fraud detection model.
[0081] The training system for a fraud detection model in this embodiment obtains a second fraud sample with a number equivalent to that of normal transaction samples, thereby balancing the training sample data in the second training set. This ensures the accuracy of the fraud detection model's sensitivity to the second fraud sample when training the preset fraud detection model, and improves the model's ability to detect fraudulent behavior.
[0082] Preferably, the second acquisition module is specifically used to acquire multiple second original fraud samples; wherein, the second original fraud samples are data corresponding to fraudulent behaviors that occur during transactions; each second original fraud sample is input into the target VAE-SAGAN model as described above to obtain a second reconstructed fraud sample corresponding to each second original fraud sample; each second reconstructed fraud sample is used as a new second original fraud sample and input into the target VAE-SAGAN model to obtain a new second reconstructed fraud sample, until the sum of the number of all second original fraud samples and all second reconstructed fraud samples is balanced with the proportion of the number of normal transaction samples in the second training set; both the second original fraud samples and the second reconstructed fraud samples are used as second fraud samples to obtain multiple second fraud samples.
[0083] Preferably, the second acquisition module is specifically used to acquire multiple third original fraud samples; wherein, the third original fraud samples are data corresponding to fraudulent behavior that occurs during the transaction; the DBSCAN algorithm is used to remove overlapping samples and noise samples from the multiple third original fraud samples to obtain multiple second original fraud samples.
[0084] Preferably, the second acquisition module is specifically used to acquire multiple original normal transaction samples; wherein, the original normal transaction samples are the data corresponding to the behavior during normal transactions; the DBSCAN algorithm is used to remove overlapping samples and noise samples from the multiple original normal transaction samples to obtain multiple normal transaction samples.
[0085] Preferably, the second training module is used to pre-train fraud detection models, including support vector machines, gradient boosting trees, or deep neural networks.
[0086] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0087] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A method for training a VAE-SAGAN model, characterized in that, Comprise: Obtain a plurality of first fraud samples as a first training set; wherein the first fraud sample is the data corresponding to the fraud behavior occurred during transaction; Input the first training set into the pre-trained VAE-SAGAN model for training, and the training process is as follows: Step S121, input each first fraud sample into the pre-trained VAE-SAGAN model, trigger the variational autoencoder of the pre-trained VAE-SAGAN model to map each received first fraud sample to a low-dimensional latent space based on the self-attention mechanism to obtain the corresponding latent variable, and respectively reconstruct each latent variable to obtain the first reconstructed fraud sample corresponding to each first fraud sample; Step S122, obtain the reconstruction loss value between each first fraud sample and the corresponding first reconstructed fraud sample, and obtain the adversarial loss value of the discriminator of the pre-trained VAE-SAGAN model to distinguish between each first fraud sample and the corresponding first reconstructed fraud sample; Step S123, take the sum of the reconstruction loss value and the adversarial loss value corresponding to each first fraud sample as the total loss value; Step S124, adjust the parameters of the pre-trained VAE-SAGAN model based on each total loss value, and repeatedly execute steps S121 to S124 until each total loss value converges, and / or until the iteration reaches a preset number of times, then the current pre-trained VAE-SAGAN model is taken as the target VAE-SAGAN model.
2. The method of claim 1, wherein, The obtaining a plurality of first fraud samples as a first training set comprises: Obtain a plurality of first original fraud samples; wherein the first original fraud sample is the data corresponding to the fraud behavior occurred during transaction; Remove overlapping samples and noise samples in the plurality of first original fraud samples using the DBSCAN algorithm to obtain a plurality of first fraud samples; Take the plurality of first fraud samples as the first training set.
3. The method of claim 1, wherein, The obtaining the reconstruction loss value between each first fraud sample and the corresponding first reconstructed fraud sample comprises: Based on each first fraud sample and the corresponding first reconstructed fraud sample, calculate the reconstruction loss value between each first fraud sample and the corresponding first reconstructed fraud sample, the formula is as follows: wherein, is a reconstruction loss value, is a first fraudulent sample, is a first reconstructed fraudulent sample.
4. The method of claim 1, wherein, The obtaining the adversarial loss value of the discriminator of the pre-trained VAE-SAGAN model to distinguish between each first fraud sample and the corresponding first reconstructed fraud sample comprises: Obtain the first discrimination result of the discriminator of the pre-trained VAE-SAGAN model to the first fraud sample, and obtain the second discrimination result of the discriminator to the first reconstructed fraud sample; Based on each first discrimination result and the corresponding second discrimination result, calculate the adversarial loss value of the discriminator to distinguish between each first fraud sample and the corresponding first reconstructed fraud sample, the formula is as follows: wherein, is an adversarial loss value, is a first discrimination result, is a second discrimination result. 5.A method for training a fraud detection model, the method comprising: Comprise: Obtain a plurality of second fraud samples and a plurality of normal transaction samples as a second training set; wherein the number of the second fraud sample and the normal transaction sample is balanced in the second training set; the second fraud sample is the data corresponding to the fraud behavior occurred during transaction, and the normal transaction sample is the data corresponding to the behavior during normal transaction; inputting the second training set into a pre-trained fraud detection model for training to obtain a trained target fraud detection model; the obtaining of the plurality of second fraud samples comprises: obtaining a plurality of second original fraud samples; wherein the second original fraud sample is data corresponding to a fraudulent behavior occurring during a transaction; inputting each second original fraud sample into the target VAE-SAGAN model as claimed in claim 1 to obtain a second reconstructed fraud sample corresponding to each second original fraud sample; inputting each second reconstructed fraud sample as a new second original fraud sample into the target VAE-SAGAN model to obtain a new second reconstructed fraud sample until the sum of the number of all second original fraud samples and all second reconstructed fraud samples and the number of normal transaction samples in the second training set are balanced in terms of proportion; the second original fraud sample and the second reconstructed fraud sample are both used as a second fraud sample to obtain a plurality of second fraud samples.
6. The method of claim 5, wherein, the obtaining of the plurality of second original fraud samples comprises: obtaining a plurality of third original fraud samples; wherein the third original fraud sample is data corresponding to a fraudulent behavior occurring during a transaction; removing overlapping samples and noise samples in the plurality of third original fraud samples by using a DBSCAN algorithm to obtain a plurality of second original fraud samples; the obtaining of the plurality of normal transaction samples comprises: obtaining a plurality of original normal transaction samples; wherein the original normal transaction sample is data corresponding to a behavior during a normal transaction; removing overlapping samples and noise samples in the plurality of original normal transaction samples by using a DBSCAN algorithm to obtain a plurality of normal transaction samples.
7. The method of claim 5, wherein, the pre-trained fraud detection model comprises a support vector machine, a gradient boosting tree or a deep neural network. 8.A VAE-SAGAN model training system, characterized in that, comprises: a first obtaining module configured to obtain a plurality of first fraud samples as a first training set; wherein the first fraud sample is data corresponding to a fraudulent behavior occurring during a transaction; a first training module configured to input the first training set into a pre-trained VAE-SAGAN model for training; the first training module comprises a reconstruction unit, a first loss value unit, a second loss value unit and an ending unit; the reconstruction unit is configured to input each first fraud sample into the pre-trained VAE-SAGAN model, trigger a variational autoencoder of the pre-trained VAE-SAGAN model to map each received first fraud sample to a low-dimensional latent space based on a self-attention mechanism to obtain a corresponding latent variable, and reconstruct each latent variable to obtain a first reconstructed fraud sample corresponding to each first fraud sample; the first loss value unit is configured to obtain a reconstruction loss value between each first fraud sample and the corresponding first reconstructed fraud sample, and obtain an adversarial loss value between each first fraud sample and the corresponding first reconstructed fraud sample discriminated by a discriminator of the pre-trained VAE-SAGAN model; the second loss value unit is configured to take the sum of the reconstruction loss value and the adversarial loss value corresponding to each first fraud sample as a total loss value; and the ending unit is configured to determine whether the total loss value is less than a preset threshold value, and if so, end the training of the pre-trained VAE-SAGAN model. The ending unit is configured to adjust parameters of the pre-trained VAE-SAGAN model based on each total loss value, and repeatedly perform steps corresponding to the reconstruction unit, the first loss value unit, the second loss value unit, and the ending unit until each total loss value converges and / or until a preset number of iterations is reached, and then take the current pre-trained VAE-SAGAN model as a target VAE-SAGAN model. 9.A system for training a fraud detection model, the system comprising: Comprise: The second acquisition module is configured to acquire a plurality of second fraud samples and a plurality of normal transaction samples as a second training set; wherein the number of the second fraud samples and the normal transaction samples is balanced in the second training set; the second fraud sample is data corresponding to a fraudulent behavior occurring during a transaction, and the normal transaction sample is data corresponding to a behavior during a normal transaction; The second training module is configured to input the second training set into a pre-trained fraud detection model for training to obtain a target fraud detection model after training; The second acquisition module acquires a plurality of second fraud samples, comprising: Acquire a plurality of second original fraud samples; wherein the second original fraud sample is data corresponding to a fraudulent behavior occurring during a transaction; Input each second original fraud sample into the target VAE-SAGAN model as claimed in claim 1 to obtain a second reconstructed fraud sample corresponding to each second original fraud sample; Input each second reconstructed fraud sample as a new second original fraud sample into the target VAE-SAGAN model to obtain a new second reconstructed fraud sample until the sum of the number of all second original fraud samples and the number of all second reconstructed fraud samples is balanced with the number of normal transaction samples in the second training set; Take the second original fraud sample and the second reconstructed fraud sample as a second fraud sample to obtain a plurality of second fraud samples.
Citation Information
Patent Citations
Model training method and device, fraudulent transaction identification method and device and computer equipment
CN114140246A