VAE-SAGAN model and fraud detection model training method and system
Through the VAE-SAGAN model, the reconstruction sample that is similar to fraud samples solves the problem of imbalance of data in the fraud detection model, realizes high-quality minor sample generation, and improves the sensitivity and accuracy of the model.
Patent Information
- Application Number
- CN202411378811.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-09-30
AI Technical Summary
In the field of financial technology, fraud detection models face the problem of data imbalance, which leads to the model being more inclined to predict most class samples during training, thereby ignoring a few class fraud samples, resulting in a decrease in model accuracy.
Using the VAE-SAGAN model, fraud samples are mapped to a low-dimensional latent space through variational autoencoders and self-attention mechanisms, and reconstructed samples similar to fraud samples are generated, increasing the number of minority class samples, and forming similar samples to the majority class samples. High quality samples to match.
By generating high -quality minority samples, the effect of data balance between fraud samples and normal trading samples is achieved, and the sensitivity and accuracy of fraud detection models are improved.
Smart Images

Figure CN119357612A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data balancing processing, and in particular to a VAE-SAGAN model, a fraud detection model training method and a system. Background Art
[0002] In the field of financial technology, fraud detection often faces the challenge of data imbalance. Since fraud accounts for a very small proportion of actual transactions, fraud detection datasets usually contain a large number of normal transaction samples and very few fraud samples. This imbalance causes traditional machine learning models to be more inclined to predict majority class samples during training, thereby ignoring minority class fraud samples, resulting in a decrease in model accuracy. This misjudgment not only affects the classification ability of the fraud detection model, but may also lead to serious economic losses. Therefore, how to effectively deal with the problem of data imbalance between fraud samples and normal transaction samples, and ensure the sensitivity and accuracy of the fraud detection model to minority class fraud samples, is an important topic in current fraud detection research.
[0003] For the problem of data imbalance between fraud samples and normal transaction samples, the commonly used method is resampling. Resampling methods include undersampling and oversampling. Since the undersampling method may delete the key majority class normal transaction samples, resulting in the loss of important information, it will affect the effect of data balancing between fraud samples and normal transaction samples. Therefore, how to ensure the effect of data balancing between fraud samples and normal transaction samples through oversampling is an urgent problem to be solved.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0005] The present invention provides a VAE-SAGAN model, a fraud detection model training method and a system, which can ensure the effect of data balancing between fraud samples and normal transaction samples through an oversampling method.
[0006] In a first aspect, in order to solve the above technical problems, the present invention provides a VAE-SAGAN model training method, comprising:
[0007] Acquire a plurality of first fraud samples as a first training set; wherein the first fraud samples are data corresponding to fraudulent behaviors occurring 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, inputting 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 a corresponding latent variable and reconstruct each latent variable to obtain a first reconstructed fraud sample corresponding to each first fraud sample;
[0010] Step S122, obtaining a reconstruction loss value between each first fraudulent sample and a corresponding first reconstructed fraudulent sample, and obtaining an adversarial loss value between each first fraudulent sample and the corresponding first reconstructed fraudulent sample discriminated by a discriminator of the pre-trained VAE-SAGAN model;
[0011] Step S123, taking the sum of the reconstruction loss value and the adversarial loss value corresponding to each first fraud sample as the total loss value;
[0012] Step S124, adjusting the parameters of the pre-trained VAE-SAGAN model based on each total loss value, and repeating steps S121 to S124 until each of the total loss values converges, and / or until a preset number of iterations are performed, and then the current pre-trained VAE-SAGAN model is used as the target VAE-SAGAN model.
[0013] In a second aspect, in order to solve the above technical problem, the present invention provides a method for training a fraud detection model, comprising:
[0014] 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 normal transaction samples are balanced in the second training set; the second fraud samples are data corresponding to the fraudulent behavior occurring during the transaction, and the normal transaction samples are data corresponding to the behavior during the normal transaction;
[0015] The second training set is input into the pre-trained fraud detection model for training to obtain a trained target fraud detection model.
[0016] In a third aspect, in order to solve the above technical problems, the present invention provides a VAE-SAGAN model training system, comprising:
[0017] A first acquisition module, used to acquire a plurality of first fraud samples as a first training set; wherein the first fraud samples are data corresponding to fraudulent behaviors occurring during transactions;
[0018] A first training module, used to input the first training set into a 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 an end 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 a corresponding latent variable and reconstruct each latent variable to obtain a first reconstructed fraud sample corresponding to each first fraud sample;
[0020] The first loss value unit is used to obtain a reconstruction loss value between each first fraudulent sample and a corresponding first reconstructed fraudulent sample, and to obtain an adversarial loss value between each first fraudulent sample and the corresponding first reconstructed fraudulent sample discriminated by a discriminator of the pre-trained VAE-SAGAN model;
[0021] A second loss value unit, configured to take the sum of the reconstruction loss value and the adversarial loss value corresponding to each first fraud sample as the total loss value;
[0022] The ending 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 ending unit until each of the total loss values converges, and / or until a preset number of iterations is performed, and the current pre-trained VAE-SAGAN model is used as the target VAE-SAGAN model.
[0023] In a fourth aspect, in order to solve the above technical problems, the present invention provides a fraud detection model training system, comprising:
[0024] A 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 normal transaction samples is balanced in the second training set; the second fraud samples are data corresponding to the fraudulent behavior occurring during the transaction, and the normal transaction samples are data corresponding to the behavior during the normal transaction;
[0025] The second training module is used to input the second training set into the pre-trained fraud detection model for training to obtain a trained target fraud detection model.
[0026] The beneficial effect of the present invention is: by obtaining the data corresponding to the fraudulent behavior occurring during the transaction as the first fraud sample, the 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 the self-attention mechanism to obtain the corresponding latent variable, which characterizes the characteristic distribution of the first fraud sample. 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 a first reconstructed fraud sample similar to the first fraud sample based on the characteristic distribution of the first fraud sample. Then, the reconstruction loss value between each first fraud sample and the corresponding first reconstructed fraud sample and the adversarial loss value for discrimination by the discriminator are obtained, and 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, so as to generate a realistic first reconstructed fraud sample based on the first fraud sample, so as to increase the number of minority fraud samples and form high-quality minority fraud samples that match the majority normal transaction samples, thereby achieving the effect of ensuring data balance between fraud samples and normal transaction samples through the oversampling method. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 A schematic diagram of a flow chart of a VAE-SAGAN model training method provided by the present invention;
[0028] Figure 2 A prediction schematic diagram of a variational self-attention generative adversarial network provided by the present invention;
[0029] Figure 3 A schematic diagram of a flow chart of a fraud detection model training method provided by the present invention;
[0030] Figure 4 A schematic diagram of the structure of a VAE-SAGAN model training system provided by the present invention;
[0031] Figure 5 A schematic diagram of the structure of a fraud detection model training system provided by the present invention. DETAILED DESCRIPTION
[0032] The principles and features of the present invention are described below. The examples given are only used to explain the present invention and are not used to limit the scope of the present invention.
[0033] The following describes a VAE-SAGAN model, a fraud detection model training method and a system according to an embodiment of the present invention in conjunction with the accompanying drawings, 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, the embodiment of the present disclosure provides a VAE-SAGAN model training method, including:
[0035] Step S11, obtaining a plurality of first fraud samples as a first training set, wherein the first fraud samples are data corresponding to fraud behaviors occurring during transactions.
[0036] In some embodiments, the fraudulent behavior that occurs during the transaction includes stealing credit cards, defrauding loans, etc. For example, when the fraudulent behavior is stealing credit cards, the corresponding data includes the difference between the stolen behavior and the normal card swiping behavior. It is understandable that the time, place and amount of the card swiping during the stolen behavior will be significantly different from the normal card swiping behavior, and these difference data can be used as the first fraud sample. For another example, when the fraudulent behavior is stealing credit cards, the corresponding data includes significantly similar stealing habits. It is understandable that the stolen behavior often chooses specific commodities (such as gold jewelry that is easy to cash, luxury goods, etc.) for consumption, and in order to avoid the legitimate cardholder from promptly discovering that the credit card has been stolen, the stealer will also choose late at night or early in the morning, which is not easy to be discovered, to carry out the theft.
[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, 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 the self-attention mechanism to obtain corresponding latent variables and reconstruct each latent variable to obtain a first reconstructed fraud sample corresponding to each first fraud sample.
[0039] Specific, combined Figure 2 As shown, Figure 2A prediction diagram of a variational self-attention generative adversarial network (VAE Self-Attention GAN, VAE-SAGAN) is provided. The variational self-attention generative adversarial network includes a variational autoencoder based on a self-attention mechanism (hereinafter referred to as the variational autoencoder) and a discriminator based on a self-attention mechanism (hereinafter referred to as the discriminator). Among them, the variational autoencoder includes an encoder and a decoder. The encoder includes a multi-head self-attention layer, a convolution layer, a fully connected layer and a Lambda layer in sequence. The decoder includes a fully connected layer, a multi-head self-attention layer, a Flatten operation and another fully connected layer in sequence. The discriminator includes a self-attention layer, an activation function, and three fully connected layers in sequence. Specifically, the first fraudulent sample is input into the encoder, and the encoder can adaptively assign different weights to different positions in the input data (the first fraudulent sample) through its own multi-head self-attention layer, so that when encoding the input data, it can take into account both the local information and the entire 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 the Flatten operation and the 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 characteristics of the first fraud sample. The output of the decoder is compressed to the [0,1] interval through the Sigmoid activation function.
[0040] In some embodiments, the encoder maps each received first fraud sample to a low-dimensional latent space to obtain a corresponding latent variable, such as taking a single first fraud sample as an example. The encoder extracts the data features of the input data (i.e., the first fraud sample) through a one-dimensional convolutional layer, which uses 64 filters, a filter size of 5, and a step size of 2, thereby retaining important feature information of the first fraud sample of the input data. Subsequently, the encoder further extracts features through another convolutional layer, which has 128 filters, and each layer uses the same filter size and step size. After feature extraction, the extracted feature data is mapped to the latent space using a fully connected layer to obtain the corresponding latent variables.
[0041] Step S122, obtaining a reconstruction loss value between each first fraudulent sample and the corresponding first reconstructed fraudulent sample, and obtaining an adversarial loss value between each first fraudulent sample and the corresponding first reconstructed fraudulent sample discriminated by the discriminator of the pre-trained VAE-SAGAN model.
[0042] Among them, the reconstruction loss value is Reconstruction Loss. Reconstruction loss refers to the loss function that 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 in the variational autoencoder. It refers to the error generated in the process of the pre-trained VAE-SAGAN model compressing the input data into a low-dimensional representation as much as possible during the learning process, and then restoring it to the original data. The smaller the reconstruction loss, the stronger the reconstruction ability of the pre-trained VAE-SAGAN model, that is, it can better restore the first fraudulent sample. The adversarial loss value is Wasserstein Loss, which is mainly used to measure the difference between the distribution of the generated first reconstructed fraudulent sample and the distribution of the first fraudulent sample.
[0043] In some embodiments, refer again to Figure 2 , the discriminator includes a self-attention layer, an activation function, and three fully connected layers. Each fully connected layer contains 256 neurons. In this way, the discriminator improves the ability of the variational autoencoder to generate the first reconstructed fraud sample by judging the authenticity of the first fraud sample and the first reconstructed fraud sample, so that the variational autoencoder can generate a first reconstructed fraud sample that is as similar as possible to the first fraud sample through latent variables. Therefore, the VAE-SAGAN model of this embodiment combines the advantages of the variational autoencoder (VAE), the self-attention mechanism (Self-Attention) and the adversarial network (GAN), and can generate more authentic and diverse minority class first fraud samples. Thereby, the balance and robustness of the training set of the fraud detection model can be improved.
[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 by the following formula:
[0046] Loss totol =α·Loss recon +β·Loss WGAN , Loss total is the total loss value, Loss recon To reconstruct the loss value, Loss WGAN To counter the loss value, α and β are hyperparameters for adjusting 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 all total loss values converge, and / or until a preset number of iterations are performed, and then use the current pre-trained VAE-SAGAN model as the target VAE-SAGAN model.
[0048] A VAE-SAGAN model training method provided by an embodiment of the present disclosure is adopted, by obtaining data corresponding to the fraudulent behavior occurring during the transaction as the first fraud sample, and using multiple first fraud samples to train the 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 the self-attention mechanism to obtain the corresponding latent variable, and the latent variable characterizes the characteristic distribution of the first fraud sample. 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 a first reconstructed fraud sample similar to the first fraud sample based on the characteristic distribution of the first fraud sample. Then, the reconstruction loss value between each first fraud sample and the corresponding first reconstructed fraud sample and the adversarial loss value for discrimination by the discriminator are obtained, and 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, so as to generate a realistic first reconstructed fraud sample based on the first fraud sample, so as to increase the number of minority fraud samples and form high-quality minority fraud samples that match the majority normal transaction samples, thereby achieving the effect of ensuring data balance between fraud samples and normal transaction samples through the oversampling method.
[0049] Preferably, obtaining a plurality of first fraud samples as the first training set includes: obtaining a plurality of first original fraud samples. The first original fraud samples are data corresponding to fraudulent behaviors occurring during transactions. Using a DBSCAN (Density-Based Spatial Clustering of Applications with Noise) algorithm to remove overlapping samples and noise samples from the plurality of first original fraud samples, a plurality of first fraud samples are obtained. The plurality of first fraud samples are used as the first training set.
[0050] In this way, the DBSCAN algorithm is used to process multiple first original fraud samples. By identifying the density differences between the first original samples, it is possible to effectively remove noise samples and overlapping samples with lower density from multiple first original fraud samples, and retain core samples with higher density. This optimizes the quality of the minority first fraud samples in the first training set, laying a solid foundation for the training of the VAE-SAGAN model.
[0051] Specifically, the DBSCAN algorithm is used to remove overlapping samples and noise samples from multiple first original fraud samples to obtain multiple first fraud samples, including: preprocessing multiple first original fraud samples to remove first original fraud samples 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 preprocessed first original fraud samples are further processed using the density-based noise application spatial clustering (DBSCAN) algorithm. For example, an initial DBSCAN clustering model is constructed, the number of points in the neighborhood is calculated according to the sample density, and the core points, boundary points and noise points are determined; the noise points are deleted, and the overlapping areas are removed, so as to screen out effective first fraud samples. In this way, noise samples and overlapping samples with low density in multiple first original fraud samples can be effectively removed, and core samples with high density are retained. Thereby optimizing the quality of the minority first fraud 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 first original fraud points. The minimum number of samples min-samples is set to 10, defining the minimum number of neighborhood samples to form a cluster.
[0052] Preferably, obtaining the reconstruction loss value between each first fraud sample and the corresponding first reconstructed fraud sample includes: based on each first fraud sample and the corresponding first reconstructed fraud sample, calculating the reconstruction loss value between each first fraud sample and the corresponding first reconstructed fraud sample, the formula is as follows: Loss recon =binary-crossentropy(x input , x recon ). Among them, Loss recon is the reconstruction loss value, x input is the first fraud sample, x recon Reconstruct the fraud sample for the first time.
[0053] In this way, by determining the error between the first reconstructed fraud sample and the first fraud sample, the reconstruction loss value between the two is determined, so as to adjust the parameters of the pre-trained VAE-SAGAN model, so that the variational autoencoder in the pre-trained VAE-SAGAN model can generate a first reconstructed fraud sample that is more similar to the first fraud sample and has higher authenticity. Thus, the target VAE-SAGAN model can generate a high-quality minority class first fraud sample that matches the majority class normal transaction sample.
[0054] Preferably, obtaining the adversarial loss value between each first fraudulent sample and the corresponding first reconstructed fraudulent sample determined by the discriminator of the pre-trained VAE-SAGAN model includes: obtaining a first discrimination result of the discriminator of the pre-trained VAE-SAGAN model on the first fraudulent sample, and obtaining a second discrimination result of the discriminator on 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 determined by the discriminator and the corresponding first reconstructed fraudulent sample is calculated, and the formula is as follows: Among them, Loss WGAN To combat the loss value, D(x input ) is the first judgment result, D(x recon ) is the second discrimination result.
[0055] In this way, the adversarial loss value is obtained by obtaining the discriminator's discrimination of the first fraud sample and the first reconstructed fraud sample. In order to adjust the parameters of the pre-trained VAE-SAGAN model, the discriminator of the pre-trained VAE-SAGAN model judges the authenticity of the first fraud sample and the first reconstructed fraud sample to adjust the variational autoencoder of the pre-trained VAE-SAGAN model, thereby improving the ability of the variational autoencoder to generate a first reconstructed fraud sample that is more similar to the first fraud sample and has higher authenticity. In this way, the target VAE-SAGAN model can generate a high-quality minority class first fraud sample that matches the majority class normal transaction sample.
[0056] Preferably, adjusting the parameters of the pre-trained VAE-SAGAN model based on each total loss value includes: using an 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, the present disclosure provides a method for training a fraud detection model, including:
[0058] Step S21, obtaining 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 the fraudulent behavior that occurs during the transaction, and the normal transaction samples are data corresponding to the behavior during the normal transaction.
[0059] It is understandable that the proportion balance characterizes that in the second training set, the difference in the number of the first fraud samples and normal transactions is smaller.
[0060] It is understandable that a plurality of second fraud samples and a plurality of normal transaction samples are obtained as a data set. The data set 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. The pre-trained fraud detection model is trained based on the 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. In this way, by randomly dividing the data set into a training set, a test set and a validation set according to a preset ratio, the target fraud detection model is evaluated by using a cross-validation technique, so as to further improve the robustness of the target fraud detection model. Among them, in this embodiment, the preset ratio includes training set 6: test set 2: validation set 2.
[0061] Step S22: input the second training set into the pre-trained fraud detection model for training to obtain a trained target fraud detection model.
[0062] A fraud detection model training method of the present embodiment is adopted, by obtaining a second fraud sample with a number equivalent to that of normal transaction samples, so that the training sample data in the second training set is balanced, thereby ensuring the accuracy of the sensitivity of the fraud detection model to the second fraud sample when training the preset fraud detection model, and being able to improve 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 the fraudulent behavior that occurred during the transaction. Input each second original fraud sample into the target VAE-SAGAN model shown above to obtain a second reconstructed fraud sample corresponding to each second original fraud sample. Input each second reconstructed fraud sample into the target VAE-SAGAN model as a new second original fraud sample 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 number of normal transaction samples in the second training set. Both the second original fraud sample and the second reconstructed fraud sample are used as the second fraud sample to obtain multiple second fraud samples.
[0064] The target VAE-SAGAN model shown above can generate a second reconstructed fraud sample that is similar to the input second original fraud sample and has higher authenticity through a variational encoder and discriminator based on self-attention. In this way, the target VAE-SAGAN model generates a second reconstructed fraud sample that is similar to the second original fraud sample and has higher authenticity, so as to more reliably increase the number of more authentic and diverse minority second fraud samples, alleviate the impact of sample data imbalance on the fraud detection model, and thus improve the fraud detection 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, then each second original fraud sample is input into the target VAE-SAGAN model to obtain a second reconstructed fraud samples; the obtained a second reconstructed fraud samples are input into the target VAE-SAGAN model as new second original fraud samples to obtain a new second reconstructed fraud samples. Then the number of all second original fraud samples is the sum of the initial second original fraud samples and the new second original fraud samples, which is 2a, and the number of all second reconstructed fraud samples is the new second reconstructed fraud sample a output by the target VAE-SAGAN model for the last time. Then the sum of all second original fraud samples and all second reconstructed fraud samples is 3a, which is balanced with the number of normal transaction samples in the second training set.
[0066] Preferably, obtaining a plurality of second original fraud samples includes: obtaining a plurality of third original fraud samples. The third original fraud samples are data corresponding to fraudulent behaviors occurring during transactions. The DBSCAN algorithm is used to remove overlapping samples and noise samples from the plurality of third original fraud samples to obtain a plurality of second original fraud samples.
[0067] Since the sample data has missing values, outliers or duplicate records, the quality of model training is affected. Therefore, by obtaining the third original fraud sample, the DBSCAN algorithm is used to remove overlapping samples and noise samples in multiple third original fraud samples, thereby filtering out the sample data with poor quality in the third original fraud sample, thereby 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 data corresponding to the behavior during normal transactions. Using the DBSCAN algorithm to remove overlapping samples and noise samples from the multiple original normal transaction samples, multiple normal transaction samples are obtained.
[0069] Since the sample data has missing values, outliers or duplicate records, the quality of model training is affected. Therefore, by obtaining the original normal transaction samples, the DBSCAN algorithm is used to remove overlapping samples and noise samples from multiple original normal transaction samples, thereby filtering out the sample data with poor quality in the original normal transaction samples, thereby ensuring the quality of normal transaction samples during model training.
[0070] Preferably, the pre-trained fraud detection model includes a support vector machine, a gradient boosted tree, or a deep neural network.
[0071] For ease of understanding, the fraud detection model in this embodiment uses a gradient boosting tree (GBT). The gradient boosting tree is an integrated algorithm that improves the prediction performance of the model by gradually 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 is 0.1, and the maximum depth of each tree is 3. The pre-trained GBT model is trained using a training set. The pre-trained GBT model learns the residual (i.e., prediction error) in each iteration by gradually adding decision trees to improve the performance of the overall pre-trained GBT model. For example, each tree is trained by forward distribution to gradually reduce the error of the model. After the training is completed, the target GBT model that has been trained is preliminarily evaluated using a test set, and the generalization ability of the target GBT model is further verified by a validation set. It should be understood that the indicators used in the evaluation process include F1 (F1-score) value, G-mean, AUC, and accuracy to comprehensively measure the performance of the target GBT model on an unbalanced data set.
[0072] In this way, the Gradient Boosting Tree (GBT) is used as a pre-trained fraud detection model and trained. The pre-trained fraud detection model optimizes the overall prediction performance by gradually building multiple decision trees to learn the residuals in the training data. By reasonably setting key parameters such as the number of trees, learning rate, and maximum depth, the performance of the trained fraud detection model on unbalanced data sets has been significantly improved, and evaluation indicators such as F1 value, G-mean, AUC, and accuracy have been improved, thereby improving the generalization ability and detection accuracy of the model.
[0073] like Figure 4As shown, the embodiment of the present disclosure provides a VAE-SAGAN model training system, including a first acquisition module and a first training module. The first acquisition module is used to acquire multiple first fraud samples as a first training set. The first fraud sample is data corresponding to the fraud behavior that occurs during the transaction. 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 an end unit. The reconstruction unit is used to input 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 the self-attention mechanism to obtain the corresponding latent variables and reconstruct each latent variable respectively, and obtain the first reconstructed fraud sample corresponding to each first fraud sample. 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 obtain the adversarial loss value between each first fraud sample and the corresponding first reconstructed fraud sample discriminated by the discriminator of the pre-trained VAE-SAGAN model. The second loss value unit is used to take the sum of the reconstruction loss value and the adversarial loss value corresponding to each first fraudulent sample as the total loss value. The ending unit is used to 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 a preset number of iterations are performed, and then the current pre-trained VAE-SAGAN model is used as the target VAE-SAGAN model.
[0074] A VAE-SAGAN model training system provided by an embodiment of the present disclosure is used to obtain data corresponding to fraudulent behavior occurring during a transaction as a first fraud sample, and 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 a corresponding latent variable, and the latent variable characterizes the characteristic distribution of the first fraud sample. 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 a first reconstructed fraud sample similar to the first fraud sample based on the characteristic distribution of the first fraud sample. Then, the reconstruction loss value between each first fraud sample and the corresponding first reconstructed fraud sample and the adversarial loss value for discrimination by the discriminator are obtained, and 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, so as to generate a realistic first reconstructed fraud sample based on the first fraud sample, so as to increase the number of minority fraud samples and form high-quality minority fraud samples that match the majority normal transaction samples, thereby achieving the effect of ensuring data balance between fraud samples and normal transaction samples through the oversampling method.
[0075] Preferably, the first acquisition module is specifically used to acquire multiple first original fraud samples. The first original fraud samples are data corresponding to the fraudulent behavior that occurred during the transaction. The DBSCAN algorithm is used to remove overlapping samples and noise samples from the multiple first original fraud samples to obtain multiple first fraud samples. The multiple first fraud samples are used as the 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 the corresponding first reconstructed fraud sample based on each first fraud sample and the corresponding first reconstructed fraud sample, and the formula is as follows: Loss recon =binary_crossentropy(x input , x recon )
[0077] Among them, Loss recon is the reconstruction loss value, x input is the first fraud sample, x recon Reconstruct the fraud sample for the first time.
[0078] Preferably, the first loss value unit is specifically used to obtain a first discrimination result of the discriminator of the pre-trained VAE-SAGAN model on the first fraud sample, and obtain a second discrimination result of the discriminator on the first reconstructed fraud sample; based on each first discrimination result and the corresponding second discrimination result, calculate the adversarial loss value between each first fraud sample and the corresponding first reconstructed fraud sample discriminated by the discriminator, and the formula is as follows:
[0079] Among them, Loss WGAN To combat the loss value, D(x input ) is the first judgment result, D(x recon ) is the second discrimination result.
[0080] like Figure 5 As shown, the embodiment of the present disclosure provides a fraud detection model training system, including: a second acquisition module and a second training module. The second acquisition module is used to 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 is balanced in the second training set; the second fraud samples are data corresponding to the fraudulent behavior occurring during the transaction, and the normal transaction samples are data corresponding to the behavior during the normal transaction. The second training module is used to input the second training set into the pre-trained fraud detection model for training, and obtain a trained target fraud detection model.
[0081] A fraud detection model training system adopts the present embodiment, by obtaining a second fraud sample with a number equivalent to that of normal transaction samples, so that the training sample data in the second training set is balanced. Therefore, when training the preset fraud detection model, the accuracy of the sensitivity of the fraud detection model to the second fraud sample is guaranteed, and the fraud detection model's ability to detect fraudulent behavior can be improved.
[0082] Preferably, the second acquisition module is specifically used to obtain multiple second original fraud samples; wherein the second original fraud samples are data corresponding to the fraudulent behavior occurring during the transaction; each second original fraud sample is input into the target VAE-SAGAN model as shown above to obtain a second reconstructed fraud sample corresponding to each second original fraud sample; each second reconstructed fraud sample is input into the target VAE-SAGAN model as a new second original fraud sample 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 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 the fraudulent behavior occurring during the transaction; and 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 data corresponding to the behavior during normal transactions; and the DBSCAN algorithm is used to remove overlapping samples and noise samples in the multiple original normal transaction samples to obtain multiple normal transaction samples.
[0085] Preferably, the second training module is specifically used for pre-training the fraud detection model including a support vector machine, a gradient boosting tree or a deep neural network.
[0086] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0087] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. A VAE-SAGAN model training method, characterized in that: include: Acquire a plurality of first fraud samples as a first training set; wherein the first fraud samples are data corresponding to fraudulent behaviors occurring during transactions; The first training set is input into the pre-trained VAE-SAGAN model for training. The training process is as follows: Step S121, inputting 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 a corresponding latent variable and reconstruct each latent variable to obtain a first reconstructed fraud sample corresponding to each first fraud sample; Step S122, obtaining a reconstruction loss value between each first fraudulent sample and a corresponding first reconstructed fraudulent sample, and obtaining an adversarial loss value between each first fraudulent sample and the corresponding first reconstructed fraudulent sample discriminated by a discriminator of the pre-trained VAE-SAGAN model; Step S123, taking 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, adjusting the parameters of the pre-trained VAE-SAGAN model based on each total loss value, and repeating steps S121 to S124 until each of the total loss values converges, and / or until a preset number of iterations are performed, and then the current pre-trained VAE-SAGAN model is used as the target VAE-SAGAN model.
2. The method according to claim 1, characterized in that: The obtaining of a plurality of first fraud samples as a first training set includes: Acquire multiple first original fraud samples; wherein the first original fraud samples are data corresponding to fraudulent behaviors occurring during transactions; Using the DBSCAN algorithm to remove overlapping samples and noise samples from the plurality of first original fraud samples, to obtain a plurality of first fraud samples; A plurality of first fraud samples are used as a first training set.
3. The method according to claim 1, characterized in that The obtaining of the reconstruction loss value between each first fraud sample and the corresponding first reconstructed fraud sample includes: Based on each first fraud sample and the corresponding first reconstructed fraud sample, a reconstruction loss value between each first fraud sample and the corresponding first reconstructed fraud sample is calculated, and the formula is as follows: Loss recon =binary_crossentropy(x input ,x recon ) Among them, Loss recon is the reconstruction loss value, x input is the first fraud sample, x recon Reconstruct the fraud sample for the first time.
4. The method according to claim 1, characterized in that The obtaining of the discriminator of the pre-trained VAE-SAGAN model to discriminate the adversarial loss value between each first fraudulent sample and the corresponding first reconstructed fraudulent sample includes: Obtaining a first discrimination result of the discriminator of the pre-trained VAE-SAGAN model on the first fraudulent sample, and obtaining a second discrimination result of the discriminator on the first reconstructed fraudulent sample; Based on each first discrimination result and the corresponding second discrimination result, the adversarial loss value between each first fraud sample and the corresponding first reconstructed fraud sample discriminated by the discriminator is calculated, and the formula is as follows: Among them, Loss WGAN To combat the loss value, D(x input ) is the first judgment result, D(x recon ) is the second discrimination result.
5. A method for training a fraud detection model, characterized in that: include: 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 normal transaction samples are balanced in the second training set; the second fraud samples are data corresponding to the fraudulent behavior occurring during the transaction, and the normal transaction samples are data corresponding to the behavior during the normal transaction; The second training set is input into the pre-trained fraud detection model for training to obtain a trained target fraud detection model.
6. The method according to claim 5, characterized in that The obtaining of a plurality of second fraud samples comprises: Acquire multiple second original fraud samples; wherein the second original fraud samples are data corresponding to the fraudulent behavior occurring during the 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; 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 all second reconstructed fraud samples is balanced with the number of normal transaction samples in the second training set; The second original fraud sample and the second reconstructed fraud sample are both used as second fraud samples to obtain multiple second fraud samples.
7. The method according to claim 6, characterized in that The obtaining of a plurality of second original fraud samples comprises: Acquire multiple third original fraud samples; wherein the third original fraud samples are data corresponding to the fraudulent behavior occurring during the transaction; Using the DBSCAN algorithm to remove overlapping samples and noise samples from the plurality of third original fraud samples, to obtain a plurality of second original fraud samples; The obtaining of multiple normal transaction samples includes: Acquire multiple original normal transaction samples; wherein the original normal transaction samples are data corresponding to behaviors 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.
8. The method according to claim 5, characterized in that The pre-trained fraud detection model includes a support vector machine, a gradient boosted tree, or a deep neural network.
9. A VAE-SAGAN model training system, characterized in that: include: A first acquisition module, used to acquire a plurality of first fraud samples as a first training set; wherein the first fraud samples are data corresponding to fraudulent behaviors occurring during transactions; A first training module, used to input the first training set into a 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 an end unit; 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 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 used to obtain a reconstruction loss value between each first fraudulent sample and a corresponding first reconstructed fraudulent sample, and to obtain an adversarial loss value between each first fraudulent sample and the corresponding first reconstructed fraudulent sample discriminated by a discriminator of the pre-trained VAE-SAGAN model; A second loss value unit, configured to take the sum of the reconstruction loss value and the adversarial loss value corresponding to each first fraud sample as the total loss value; The ending 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 ending unit until each of the total loss values converges, and / or until a preset number of iterations is performed, and the current pre-trained VAE-SAGAN model is used as the target VAE-SAGAN model.
10. A fraud detection model training system, characterized in that: include: A 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 normal transaction samples is balanced in the second training set; the second fraud samples are data corresponding to the fraudulent behavior occurring during the transaction, and the normal transaction samples are data corresponding to the behavior during the normal transaction; The second training module is used to input the second training set into the pre-trained fraud detection model for training to obtain a trained target fraud detection model.
Citation Information
Patent Citations
Model training method and device, fraudulent transaction identification method and device and computer equipment
CN114140246A
Credit card fraud detection method and device based on multi-feature fusion and medium
CN115204901A
Risk prediction model training method and device, risk prediction model using method and device, equipment and medium
CN116957059A