Transaction risk detection method and device, equipment, medium and program product

Through the self-coding model, the error ratio judgment of transaction behavior is solved, and the problem of insufficient accuracy of transaction risk detection in the existing technology is achieved, and more efficient identification of fraud transactions is achieved.

CN120387888APending Publication Date: 2025-07-29TENPAY PAID TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410122881.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-29
Publication Date
2025-07-29

AI Technical Summary

Technical Problem

The existing fraudulent transaction detection methods mainly rely on policy and logistic regression models based on rule combinations, resulting in poor accuracy of transaction risk detection results and cannot meet the requirements of real-time and complex transaction behaviors.

Method used

The transaction behavior is reconstructed by the autoencoding model, and the self-encoder based on fraudulent transaction samples and non-fraud transaction samples are used to calculate the reconstruction error separately, and the transaction risk is judged by the relative reconstruction error ratio.

Benefits of technology

The accuracy of transaction risk detection is improved, risk is judged through the characteristics of the same trading behavior in different models, and the shortcomings of the existing technology are overcome.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120387888A_ABST
    Figure CN120387888A_ABST
Patent Text Reader

Abstract

The invention discloses a transaction risk detection method and device, equipment, a medium and a program product. In the application, when a transaction risk detection instruction is received, an original vector of a to-be-detected transaction is obtained, and a first self-encoding model obtained by pre-training based on fraudulent transaction sample data and a second self-encoding model obtained by training based on a non-fraudulent transaction sample are respectively utilized to reconstruct the original vector; obtaining a first reconstruction vector and a second reconstruction vector; then, obtaining a first reconstruction error of the first reconstruction vector relative to the original vector and a second reconstruction error of the second reconstruction vector relative to the original vector, and determining a relative reconstruction error of the to-be-detected transaction according to a ratio of the second reconstruction error to the first reconstruction error; and finally, detecting the transaction risk of the to-be-detected transaction based on the relative reconstruction error. According to the scheme, the accuracy of a transaction risk detection result is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and specifically to a transaction risk detection method, device, electronic device, computer storage medium, and computer program product. Background Art

[0002] With the development of internet technology, electronic payments have become a universal payment method, widely used in all areas of life. However, as electronic payment services continue to expand and deepen, illegal activities are also becoming increasingly active. Among them, the impact of social payment fraud on electronic payments is particularly serious.

[0003] Currently, fraudulent transaction detection primarily relies on rule-based strategies and simple machine learning models, such as logistic regression (LR). However, rule-based strategies suffer from poor stability and are prone to overfitting, while logistic regression models have limited fitting capabilities. Consequently, existing fraud detection methods are prone to misjudgment when assessing transaction risk, resulting in poorly accurate transaction risk detection results. Summary of the Invention

[0004] The embodiments of the present application provide a transaction risk detection method, device, electronic device, computer-readable storage medium, and computer program product, which can improve the accuracy of transaction risk detection results.

[0005] The present invention provides a method for detecting transaction risk, including:

[0006] Receiving a transaction risk detection instruction, and obtaining an original vector of the transaction to be detected according to the detection instruction;

[0007] Reconstructing the original vector based on a pre-trained first autoencoder model and a second autoencoder model, respectively, to obtain a first reconstructed vector and a second reconstructed vector, wherein the first autoencoder model is trained based on data of fraudulent transaction samples, and the second autoencoder model is trained based on data of non-fraudulent transaction samples;

[0008] Obtaining a first reconstruction error of the first reconstructed vector relative to the original vector, and a second reconstruction error of the second reconstructed vector relative to the original vector;

[0009] determining a relative reconstruction error of the transaction to be detected according to a ratio of the second reconstruction error to the first reconstruction error;

[0010] The transaction risk of the transaction to be detected is detected based on the relative reconstruction error.

[0011] Accordingly, an embodiment of the present application further provides a transaction risk detection device, comprising:

[0012] A first acquisition unit is configured to receive a transaction risk detection instruction and acquire an original vector of a transaction to be detected according to the detection instruction;

[0013] a reconstruction unit, configured to reconstruct the original vector based on a pre-trained first autoencoder model and a second autoencoder model, respectively, to obtain a first reconstructed vector and a second reconstructed vector, wherein the first autoencoder model is trained based on data of fraudulent transaction samples, and the second autoencoder model is trained based on data of non-fraudulent transaction samples;

[0014] a second obtaining unit, configured to obtain a first reconstruction error of the first reconstructed vector relative to the original vector, and a second reconstruction error of the second reconstructed vector relative to the original vector;

[0015] a first determining unit, configured to determine a relative reconstruction error of the transaction to be detected according to a ratio of the second reconstruction error to the first reconstruction error;

[0016] A detection unit is configured to detect the transaction risk of the transaction to be detected based on the relative reconstruction error.

[0017] Optionally, in some embodiments, the first determining unit is further configured to:

[0018] The relative reconstruction error is compared with a target error threshold to obtain a comparison result, wherein the target error threshold is determined based on the distribution information of the sample relative reconstruction error of the fraudulent transaction sample and the distribution information of the sample relative reconstruction error of the non-fraudulent sample; and the transaction risk of the transaction to be detected is determined based on the comparison result.

[0019] Optionally, in some embodiments, the method further comprises:

[0020] A third acquisition unit is configured to acquire a transaction sample set before acquiring the original vector of the transaction to be detected, wherein the transaction sample set includes: a plurality of fraudulent transaction samples and a plurality of non-fraudulent transaction samples;

[0021] a training unit, configured to train a basic autoencoder model based on the data of the fraudulent transaction samples to obtain the first autoencoder model, and to train the basic autoencoder model based on the data of the non-fraudulent transaction samples to obtain the second autoencoder model;

[0022] a fourth acquisition unit, configured to acquire, based on the first autoencoder model and the second autoencoder model, a sample relative reconstruction error of the fraudulent transaction sample and its distribution information, and a sample relative reconstruction error of the non-fraudulent sample and its distribution information;

[0023] The second determination unit is used to determine the target error threshold based on the distribution information of the sample relative reconstruction error of the fraudulent transaction sample and the distribution information of the sample relative reconstruction error of the non-fraudulent sample, so that in all transaction samples in which the sample relative reconstruction error is greater than or equal to the target error threshold, the ratio of the second number of the non-fraudulent samples to the first number of the fraudulent samples is less than or equal to a preset value.

[0024] Optionally, in some embodiments, the fourth acquiring unit is further configured to:

[0025] Obtain a sample vector for each transaction sample in the transaction sample set; reconstruct each sample vector based on the first autoencoding model and the second autoencoding model respectively to obtain a first sample reconstruction vector and a second sample reconstruction vector for each sample vector; for each transaction sample in the sample set, obtain a first sample reconstruction error of the first sample reconstruction vector relative to the sample vector, and a second sample reconstruction error of the second sample reconstruction vector relative to the sample vector; for each transaction sample in the sample set, obtain a ratio of the second sample reconstruction error to the first sample reconstruction error; based on the ratio corresponding to each transaction sample in the sample set, determine the sample relative reconstruction error and its distribution information of the fraudulent transaction sample, as well as the sample relative reconstruction error and its distribution information of the non-fraudulent sample.

[0026] Optionally, in some embodiments, the first determining unit is further configured to:

[0027] If the comparison result is that the relative reconstruction error is greater than or equal to the target error threshold, it is determined that the transaction to be detected has a transaction risk; if the comparison result is that the relative reconstruction error is greater than or equal to the target error threshold, it is determined that the transaction to be detected does not have a transaction risk.

[0028] Optionally, in some embodiments, the method further comprises:

[0029] a fifth acquiring unit, configured to acquire a difference between the relative reconstruction error and the target error threshold after determining that the transaction to be detected has a transaction risk;

[0030] The third determining unit is configured to determine the transaction risk level of the to-be-detected transaction according to the difference.

[0031] Optionally, in some embodiments, the second acquiring unit is further configured to:

[0032] Obtain a first squared value of the modulus of the difference between the first reconstructed vector and the original vector, and a second squared value of the modulus of the difference between the second reconstructed vector and the original vector; calculate the ratio between the first squared value and the squared value of the modulus of the original vector to obtain the first reconstruction error; calculate the ratio between the second squared value and the squared value of the modulus of the original vector to obtain the second reconstruction error.

[0033] Optionally, in some embodiments, when receiving a transaction risk detection instruction, the first obtaining unit is further configured to:

[0034] Obtain a transaction request sent by a terminal, where the transaction request instructs to transfer a specified quantity of virtual resources in a first electronic payment account to a second electronic payment account; respectively obtain the account opening information of the first electronic payment account and the second electronic payment account; if the account opening information of the first electronic payment account and the second electronic payment account is different, then trigger a transaction risk detection instruction based on the current transaction request.

[0035] Optionally, in some embodiments, further includes:

[0036] A processing unit, configured to, after detecting the transaction risk of the transaction to be detected based on the relative reconstruction error, if it is determined that the transaction to be detected has a transaction risk, then send a risk prompt message to the terminal; if it is determined that the transaction to be detected does not have a transaction risk, then respond to the transaction request and transfer the specified quantity of virtual resources in the first electronic payment account to the second electronic payment account.

[0037] Optionally, in some embodiments, further includes:

[0038] An updating unit, configured to, after responding to the transaction request and transferring the specified quantity of virtual resources in the first electronic payment account to the second electronic payment account, if receiving feedback information indicating that the transaction to be detected is a fraudulent transaction, then update the training set corresponding to the first autoencoder model based on the transaction sample to be detected, where the training set includes multiple fraudulent transaction samples;

[0039] The training unit is further configured to retrain the first autoencoder model based on the updated training set.

[0040] An embodiment of the present application further provides an electronic device, including a processor and a memory, where the memory stores an application program, and the processor is configured to run the application program in the memory to execute the steps in the above-mentioned method for detecting transaction risk.

[0041] An embodiment of the present application further provides a computer-readable storage medium, which stores multiple instructions adapted to be loaded by a processor to execute the steps in the above-described method for detecting transaction risks.

[0042] An embodiment of the present application further provides a computer program product, including a computer program or instructions, which when executed by a processor, implement the steps in the above-described method for detecting transaction risks.

[0043] In an embodiment of the present application, when a transaction risk detection instruction is received, the original vector of the transaction to be detected is obtained, and the first autoencoder model pre-trained based on fraud transaction sample data and the second autoencoder model trained based on non-fraud transaction samples are respectively used to reconstruct the original vector to obtain a first reconstructed vector and a second reconstructed vector; then, the first reconstruction error of the first reconstructed vector relative to the original vector and the second reconstruction error of the second reconstructed vector relative to the original vector are obtained, and the relative reconstruction error of the transaction to be detected is determined according to the ratio of the second reconstruction error to the first reconstruction error; finally, the transaction risk of the transaction to be detected is detected based on the relative reconstruction error. This solution uses autoencoders to respectively learn the reconstruction models of fraud transaction samples and non-fraud transaction samples, inputs the transaction to be detected into the two models for reconstruction respectively, and detects the transaction risk based on the final relative reconstruction error, and judges the transaction risk through the feature performance of the same transaction behavior in different models, rather than directly evaluating the risk score, thereby improving the accuracy of the transaction risk detection result. Description of the Drawings

[0044] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those skilled in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0045] Figure 1 It is a schematic diagram of the scenario of the method for detecting transaction risks provided by an embodiment of the present application;

[0046] Figure 2 It is a schematic flowchart of the method for detecting transaction risks provided by an embodiment of the present application;

[0047] Figure 3 It is another schematic flowchart of the method for detecting transaction risks provided by an embodiment of the present application;

[0048] Figure 4 It is a schematic structural diagram of the autoencoder model provided by an embodiment of the present application;

[0049] Figure 5 This is a schematic diagram of an application scenario of the social payment fraud transaction detection method provided in an embodiment of the present application;

[0050] Figure 6 This is a flowchart of a method for detecting fraudulent transactions in social payment provided by an embodiment of the present application;

[0051] Figure 7 Schematic diagram of the structure of a transaction risk detection device provided in an embodiment of the present application;

[0052] Figure 8 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0053] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts are within the scope of protection of this application.

[0054] In related technologies, the following detection methods are used for fraudulent transactions:

[0055] (1) The rule combination-based strategy first analyzes fraud cases to identify suspicious features, and then derives an effective feature rule combination based on business experience or a decision tree model. If a transaction satisfies the rule combination, it is considered to be at risk of fraud. However, since the features learned by the decision tree-based rule combination are relatively simple, the feature threshold is prone to overfitting the training samples, and the simple rule combination is easily attacked, broken through, and bypassed, resulting in poor stability.

[0056] (2) Logistic regression model: The logistic regression model assesses transaction risk by constructing a transaction scorecard model. If a transaction's model score is high, it indicates a high fraud risk. However, because logistic regression is essentially a simple linear model, its ability to fit complex transaction behaviors is limited.

[0057] (3) Deep learning models, such as neural networks. However, due to the high real-time requirements for fraudulent transaction detection and the high complexity of deep learning models, calculations and analysis are usually performed offline. Large-scale deep neural networks are not only difficult to train, but also have high computational complexity and time-consuming evaluation phases, which cannot meet the real-time requirements of fraudulent transaction detection.

[0058] Based on this, the embodiments of the present application provide a method, apparatus, electronic device, computer-readable storage medium, and computer program product for detecting transaction risks, which can improve the accuracy of transaction risk detection results. Among them, the transaction risk detection apparatus can be integrated in an electronic device, which can be a server or a terminal device, etc.

[0059] Among them, the server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, network acceleration services, and big data and artificial intelligence platforms. The terminal can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal and the server can be directly or indirectly connected through wired or wireless communication methods, and the present application does not make any restrictions here.

[0060] For example, referring to Figure 1 , taking the transaction risk detection apparatus integrated in an electronic device as an example, the electronic device receives a transaction risk detection instruction and obtains the original vector of the transaction to be detected according to the detection instruction; subsequently, the original vector is respectively reconstructed based on the pre-trained first autoencoder model and the second autoencoder model to obtain a first reconstructed vector and a second reconstructed vector, where the first autoencoder model is trained based on the data of fraud transaction samples, and the second autoencoder model is trained based on the data of non-fraud transaction samples; then, obtain the first reconstruction error of the first reconstructed vector relative to the original vector and the second reconstruction error of the second reconstructed vector relative to the original vector; then, determine the relative reconstruction error of the transaction to be detected according to the ratio of the second reconstruction error to the first reconstruction error; finally, detect the transaction risk of the transaction to be detected based on the relative reconstruction error

[0061] Among them, the transaction risk detection method provided by the embodiments of the present application relates to the machine learning direction in artificial intelligence. In the embodiments of the present application, autoencoders are used to respectively learn the reconstruction models of fraud transaction samples and non-fraud transaction samples, the transaction to be detected is input into the two models for reconstruction respectively, and the risk of the transaction behavior is detected based on the final relative reconstruction error. The transaction risk is judged by the feature performance of the same transaction behavior in different models, which improves the accuracy of the transaction risk detection results.

[0062] Among them, Artificial Intelligence (AI) is a theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a way similar to human intelligence. Artificial intelligence also studies the design principles and implementation methods of various intelligent machines, enabling machines to have the functions of perception, reasoning, and decision-making.

[0063] Artificial intelligence technology is an interdisciplinary subject with a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, large image processing technology, operation / interaction systems, and mechatronics. The software technologies of artificial intelligence mainly include several major directions such as computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0064] Among them, Machine Learning (ML) is an interdisciplinary subject that involves multiple disciplines such as probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize the existing knowledge structure to continuously improve their own performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent, and its applications cover all fields of artificial intelligence. Machine learning and deep learning usually include technologies such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and rote learning. Pre-trained models are the latest development results of deep learning, integrating the above technologies.

[0065] A pre-training model, also known as a cornerstone model or a large model, refers to a deep neural network (DNN) with large parameters. It is trained on massive amounts of unlabeled data. Leveraging the function approximation capabilities of large-parameter DNNs, the pretrained machine learning (PTM) extracts common features from the data. Through techniques such as fine tuning, efficient parameter fine tuning (PEFT), and prompt-tuning, it is then adapted for downstream tasks. Therefore, pre-trained models can achieve ideal results in few-shot or zero-shot scenarios. Based on the data modality processed, PTMs can be categorized into language models (ELMO, BERT, GPT), vision models (swin-transformer, ViT, V-MOE), speech models (VALL-E), and multimodal models (ViBERT, CLIP, Flamingo, Gato). Multimodal models are those that represent features from two or more data modalities. Pre-trained models are important tools for outputting artificial intelligence generated content (AIGC) and can also serve as a universal interface for connecting multiple task-specific models.

[0066] It can be understood that in the specific implementation of this application, related data such as attribute data, attribute sets and attribute subsets are involved. When the following embodiments of this application are applied to specific products or technologies, permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0067] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.

[0068] This embodiment will be described from the perspective of a transaction risk detection device. The transaction risk detection device can be specifically integrated into an electronic device, which can be a server or a terminal. The terminal can include a tablet computer, a laptop computer, a personal computer (PC), or other smart devices that can process data.

[0069] An embodiment of the present application provides a transaction risk detection method, comprising: receiving a transaction risk detection instruction, and obtaining an original vector of a transaction to be detected according to the detection instruction; reconstructing the original vector based on a pre-trained first autoencoder model and a second autoencoder model, respectively, to obtain a first reconstructed vector and a second reconstructed vector, wherein the first autoencoder model is trained based on data of fraudulent transaction samples, and the second autoencoder model is trained based on data of non-fraudulent transaction samples; obtaining a first reconstruction error of the first reconstructed vector relative to the original vector, and a second reconstruction error of the second reconstructed vector relative to the original vector; determining a relative reconstruction error of the transaction to be detected based on a ratio of the second reconstruction error to the first reconstruction error; and detecting the transaction risk of the transaction to be detected based on the relative reconstruction error.

[0070] like Figure 2 As shown, the specific process of the transaction risk detection method is as follows:

[0071] 101. Receive a transaction risk detection instruction, and obtain the original vector of the transaction to be detected according to the detection instruction.

[0072] In this embodiment, the transaction risk detection instruction instructs to perform risk detection on the transaction behavior that needs to be detected. The detection instruction can be automatically triggered by the system or triggered by a request from other devices to the system.

[0073] Specifically, in response to the detection instruction, a transaction to be detected is determined, and the relevant data of the transaction to be detected is encoded to obtain a vector representation of the transaction to be detected as the original vector. In specific implementation, a basic autoencoder can be used to encode the relevant data of the transaction to be detected, and the hidden vector of its hidden layer output after encoding is obtained as the original vector.

[0074] The relevant data of the transaction to be tested may include payer account information, payee account information, transaction pair characteristics, etc. For example, payer account information may include payer registration time, payee account complaint information, payer fund flow characteristics, etc.; payee account information may include payee account registration time, number of cancellations, account complaint information, historical payment characteristics, etc.; transaction pair characteristics may include whether the two parties to the transaction are friends in the address book, whether the two parties to the transaction are in the same city, and whether the two parties to the transaction have any historical transactions.

[0075] 102. Reconstruct the original vector based on a pre-trained first autoencoder model and a second autoencoder model to obtain a first reconstructed vector and a second reconstructed vector, wherein the first autoencoder model is trained based on data of fraudulent transaction samples, and the second autoencoder model is trained based on data of non-fraudulent transaction samples.

[0076] Among them, autoencoders are a type of neural network whose goal is to learn to encode input data into a low-dimensional latent space and then reconstruct the input from this low-dimensional representation.

[0077] In this embodiment, the first autoencoder model is a positive autoencoder model, which learns the main features and reconstruction patterns of positive samples; the second autoencoder model is a negative autoencoder model, which learns the main features and reconstruction patterns of negative samples. Specifically, fraudulent transaction samples are used as positive samples for training the first autoencoder model, and non-fraudulent samples are used as negative samples for training the second autoencoder model. This enables the first autoencoder model to effectively reconstruct positive samples, and the second autoencoder model to effectively reconstruct negative samples. In practical applications, the first autoencoder model and the second autoencoder model can be conventional autoencoder models, or more complex variational autoencoder models (Variational Autoencoders) can be used.

[0078] In specific implementation, the original vector of the sample to be detected is used as the model input of the first autoencoder model and the second autoencoder model, and the model output of the first autoencoder model is obtained to obtain the first reconstruction vector, and the model output of the second autoencoder model is obtained to obtain the second reconstruction vector. For example, for the transaction to be detected, it is input into the first autoencoder model, and the first reconstruction vector (i.e., the positive reconstruction vector) can be obtained as follows:

[0079]

[0080] Among them, x i Indicates the transaction to be detected. Represents the positive reconstruction vector of the transaction to be detected.

[0081] For the transaction to be detected, it is input into the second autoencoder model, and the second reconstruction vector (i.e., negative reconstruction vector) can be obtained as follows:

[0082]

[0083] Among them, x i Indicates the transaction to be detected. Represents the negative reconstruction vector of the transaction to be detected.

[0084] 103. Obtain a first reconstruction error of the first reconstructed vector relative to the original vector, and a second reconstruction error of the second reconstructed vector relative to the original vector.

[0085] Specifically, for the same sample to be detected, a first reconstruction error between the first reconstructed vector and the original vector, and a second reconstruction error between the second reconstructed vector and the original vector are calculated, wherein the first reconstruction error is a positive reconstruction error and the second reconstruction error is a negative reconstruction error.

[0086] In this embodiment, for the transaction to be detected, its positive reconstruction error is as follows:

[0087]

[0088] Among them, x i represents the transaction to be detected, represents the positive reconstruction vector (i.e., the first reconstruction vector) of the transaction to be detected, and e 正 represents the positive reconstruction error (i.e., the first reconstruction error) of the transaction to be detected.

[0089] For the transaction to be detected, its negative reconstruction error is as follows:

[0090]

[0091] Among them, x i represents the transaction to be detected, represents the positive reconstruction vector (i.e., the first reconstruction vector) of the transaction to be detected, and e 负 represents the positive reconstruction error (i.e., the first reconstruction error) of the transaction to be detected.

[0092] That is, in one embodiment, the step of "obtaining the first reconstruction error of the first reconstruction vector relative to the original vector and the second reconstruction error of the second reconstruction vector relative to the original vector" may include the following process:

[0093] Obtain the first squared value of the modulus of the difference between the first reconstruction vector and the original vector, and the second squared value of the modulus of the difference between the second reconstruction vector and the original vector;

[0094] Calculate the ratio between the first squared value and the squared value of the modulus of the original vector to obtain the first reconstruction error;

[0095] Calculate the ratio between the second squared value and the squared value of the modulus of the original vector to obtain the second reconstruction error.

[0096] 104. Determine the relative reconstruction error of the transaction to be detected according to the ratio of the second reconstruction error to the first reconstruction error.

[0097] Specifically, calculate the ratio between the second reconstruction error and the first reconstruction error, and determine the ratio result as the relative reconstruction error of the transaction to be detected. The specific calculation formula for the relative reconstruction error e is as follows:

[0098]

[0099] 105. Detect the transaction risk of the transaction to be detected based on the relative reconstruction error.

[0100] Specifically, based on the calculated relative reconstruction error, the transaction to be tested is subjected to risk detection. In specific implementations, the relative reconstruction error can be compared with a target error threshold, and the transaction risk of the transaction to be tested is determined based on the comparison result. That is, in some embodiments, the step of "detecting the transaction risk of the transaction to be tested based on the relative reconstruction error" may include the following process:

[0101] (11) Comparing the relative reconstruction error with the target error threshold to obtain a comparison result, wherein the target error threshold is determined based on the distribution information of the sample relative reconstruction error of the fraudulent transaction sample and the distribution information of the sample relative reconstruction error of the non-fraudulent sample.

[0102] In this implementation, the target error threshold is determined based on the distribution information of the sample relative reconstruction error of fraudulent transaction samples used to train the first autoencoder model, and the distribution information of the sample relative reconstruction error of non-fraudulent samples used to train the second autoencoder model. The relative reconstruction error distribution information is obtained by statistically analyzing the magnitude of the relative reconstruction error based on actual statistical data. It should be noted that the calculation method for the sample relative reconstruction error of fraudulent and non-fraudulent transaction samples is the same as the calculation method for the relative reconstruction error of the transaction to be detected, as described above.

[0103] (12) Determine the transaction risk of the transaction to be tested based on the comparison results.

[0104] Specifically, when determining the transaction risk of the transaction to be detected based on the comparison result between the relative reconstruction error and the target error threshold, if the comparison result is that the relative reconstruction error is greater than or equal to the target error threshold, then it is determined that the transaction to be detected has a transaction risk; if the comparison result is that the relative reconstruction error is greater than or equal to the target error threshold, then it is determined that the transaction to be detected does not have a transaction risk.

[0105] In one embodiment, after determining that a transaction to be detected has transaction risk, the difference between the relative reconstruction error and the target error threshold may be further obtained, and the transaction risk level of the transaction to be detected may be determined based on the difference. A larger difference indicates a higher risk level, and a greater likelihood that the transaction to be detected is fraudulent; a smaller difference indicates a lower risk level, and a lower likelihood that the transaction to be detected is fraudulent.

[0106] It can be seen that for the transaction risk detection method provided by the embodiments of the present application, when a transaction risk detection instruction is received, the original vector of the transaction to be detected is obtained, and the first autoencoder model pre-trained based on fraud transaction sample data and the second autoencoder model trained based on non-fraud transaction samples are respectively used to reconstruct the original vector to obtain a first reconstructed vector and a second reconstructed vector; then, the first reconstruction error of the first reconstructed vector relative to the original vector and the second reconstruction error of the second reconstructed vector relative to the original vector are obtained, and the relative reconstruction error of the transaction to be detected is determined according to the ratio of the second reconstruction error to the first reconstruction error; finally, the transaction risk of the transaction to be detected is detected based on the relative reconstruction error. In this solution, the transaction to be detected is input into the first autoencoder model and the second autoencoder model respectively for reconstruction, and the risk of the transaction behavior is detected based on the final relative reconstruction error. The transaction risk is judged by the characteristic performance of the same transaction behavior in different models, rather than directly evaluating the risk score, which improves the accuracy of the transaction risk detection result.

[0107] In practical applications, it is necessary to pre-train the first autoencoder model and the second autoencoder model. Specifically, the training samples are classified by labels, and a positive autoencoder and a negative autoencoder are respectively constructed based on positive samples (fraud transaction samples) and negative samples (non-fraud transaction samples). The positive autoencoder model learns the main features and reconstruction patterns of the positive samples, and the negative autoencoder model learns the main features and reconstruction patterns of the negative samples. That is, referring to Figure 3 , before obtaining the original vector of the transaction to be detected, the following processes may further be included:

[0108] 106. Obtain a transaction sample set, where the transaction sample set includes: a plurality of fraud transaction samples and a plurality of non-fraud transaction samples.

[0109] Specifically, a plurality of fraud transaction samples and a plurality of non-fraud samples are obtained from historical transaction samples to construct a transaction sample set. The data of each transaction sample includes at least payer account information, payee account information, transaction pair characteristics, etc. Among them, the payer account information may include information such as the payer's registration duration, the payer's account being complained about, and the payer's capital flow characteristics; the payee account information may include information such as the payee's account registration time, the number of cancellations, the account being complained about, and the historical collection characteristics; the transaction pair characteristics may include information such as whether the two parties to the transaction are address book friends, whether the two parties to the transaction are in the same city, and whether there is a historical transaction between the two parties.

[0110] 107. Train a basic autoencoder model based on the data of fraud transaction samples to obtain a first autoencoder model, and train a basic autoencoder model based on the data of non-fraud transaction samples to obtain a second autoencoder model.

[0111] Specifically, first, the network structure of the basic autoencoder model needs to be constructed. Taking this basic autoencoder model as an example of an autoencoder, it can be composed of an encoder and a decoder. Among them, the encoder is responsible for compressing the input data into the latent space, while the decoder maps the representation in the latent space back to the original data space, enabling the autoencoder to learn the low-dimensional representation of the data. In this embodiment, referring to Figure 4 , the network structure of the basic autoencoder model may include structures such as an input layer, an encoder, an intermediate layer, a decoder, and an output layer, as follows:

[0112] Input layer: The input layer of the autoencoder receives the original data as input. The number of nodes in the input layer corresponds to the feature dimension of the data;

[0113] Encoder: The encoder compresses the input data into a low-dimensional latent representation, also known as encoding or the hidden layer. The encoder usually consists of a series of hidden layers, and each layer contains multiple neurons. The number of nodes in the hidden layer gradually decreases until it reaches the dimension of the encoding. The goal of the encoder is to learn the compact representation of the data and extract the key features in the data;

[0114] Intermediate layer, which is the result data after the basic autoencoder model encodes the original data.

[0115] Decoder: The decoder maps the latent representation back to the original data space and attempts to reconstruct the original input data. The structure of the decoder is the opposite of that of the encoder, containing multiple hidden layers, and the number of nodes in each layer gradually increases.

[0116] Output layer, used to output the final result data, and the number of its nodes should be the same as that of the input layer to reconstruct the original data.

[0117] After constructing the network structure of the basic autoencoder model, the basic autoencoder model is trained based on the data of fraud transaction samples and the basic autoencoder model is trained based on the data of non-fraud transaction samples. In this embodiment, the training methods of the positive and negative autoencoders are the same. When training the autoencoder model, the goal is to minimize the reconstruction error between the input data and the reconstructed data, enabling the autoencoder model to learn the compressed representation of the data and reconstruct the input data. In this embodiment, the objective function used during model training is the mean squared error loss function, as follows:

[0118]

[0119] where N represents the number of samples used for training, x i represents the original vector of the transaction to be detected, Xi Represents the reconstructed vector of the model output.

[0120] In one embodiment, during training, the reconstruction error can be propagated from the output layer back to the network via a backpropagation algorithm, and network parameters can be adjusted using a gradient descent optimization algorithm. Through multiple iterations of training, the autoencoder gradually learns a low-dimensional representation of the data and reconstruction capabilities, thereby better capturing patterns and features in the data. In specific implementations, the number of training rounds can be pre-set. When a preset number of training rounds is reached or the loss function no longer decreases, the model is determined to have converged and training is terminated.

[0121] To prevent overfitting, regularization techniques can be used, such as adding a fully connected layer (Dropout Layer) or applying L1 / L2 regularization to limit the complexity of the model. In addition, batch normalization can be used to speed up the training process and improve the robustness of the model.

[0122] 108. Based on the first autoencoder model and the second autoencoder model, obtain the sample relative reconstruction error and distribution information of the fraudulent transaction sample and the sample relative reconstruction error and distribution information of the non-fraudulent sample.

[0123] In one embodiment, the step of “obtaining sample relative reconstruction errors and distribution information of fraudulent transaction samples and sample relative reconstruction errors and distribution information of non-fraudulent samples based on the first autoencoder model and the second autoencoder model” may include the following process:

[0124] Obtain the sample vector of each transaction sample in the transaction sample set;

[0125] Reconstructing each sample vector based on the first autoencoder model and the second autoencoder model respectively to obtain a first sample reconstructed vector and a second sample reconstructed vector for each sample vector;

[0126] For each transaction sample in the sample set, obtaining a first sample reconstruction error of a first sample reconstruction vector relative to the sample vector, and a second sample reconstruction error of a second sample reconstruction vector relative to the sample vector;

[0127] For each transaction sample in the sample set, obtaining a ratio of a second sample reconstruction error to a first sample reconstruction error;

[0128] Based on the ratio corresponding to each transaction sample in the sample set, the sample relative reconstruction error and its distribution information of the fraudulent transaction sample, as well as the sample relative reconstruction error and its distribution information of the non-fraudulent sample are determined.

[0129] Specifically, first, a basic autoencoder can be used to encode the relevant data of each transaction sample. After encoding, the latent vector output by its hidden layer is obtained, and the sample vector of each transaction sample is obtained. Subsequently, the sample vector of each transaction sample is used as the model input of the first autoencoder model and the second autoencoder model, and the model output of the first autoencoder model is obtained to get the first sample reconstruction vector, and the model output of the second autoencoder model is obtained to get the second sample reconstruction vector. Then, for each sample transaction, the first sample reconstruction error between the first sample reconstruction vector and the sample vector, and the second sample reconstruction error between the second sample reconstruction vector and the sample vector are calculated. Then, for each transaction sample, the ratio of the second sample reconstruction error to the first sample reconstruction error is obtained, and the ratio corresponding to each transaction sample is determined as its corresponding sample relative reconstruction error; finally, the magnitudes of the relative reconstruction errors of each transaction sample in the transaction set are statistically analyzed, and based on the actual statistical situation, the distribution information of the sample relative reconstruction errors of the fraudulent transaction samples and the distribution information of the sample relative reconstruction errors of the non-fraudulent samples are determined.

[0130] 109. Determine the target error threshold according to the distribution information of the sample relative reconstruction errors of the fraudulent transaction samples and the distribution information of the sample relative reconstruction errors of the non-fraudulent samples, so that among all transaction samples whose sample relative reconstruction errors are greater than or equal to the target error threshold, the ratio of the second quantity of non-fraudulent samples to the first quantity of fraudulent samples is less than or equal to the preset value.

[0131] In practical applications, for fraudulent samples (i.e., positive samples), their reconstruction errors in the first autoencoder model are relatively small, and their reconstruction errors in the second encoding model are relatively large, so a relatively large relative reconstruction error will be caused. Based on this, a threshold of the relative reconstruction error can be determined, and by comparing the relative reconstruction error with the threshold, it can be identified whether the detected transaction is a fraudulent transaction or a non-fraudulent transaction.

[0132] Specifically, the number of samples with relative reconstruction errors greater than or equal to threshold M in the positive samples can be statistically analyzed and denoted as n1; the number of samples with relative reconstruction errors greater than or equal to M in the negative samples can be statistically analyzed and denoted as n2. In this embodiment, the ratio of n2 to n1 is defined as the cost performance ratio, as follows:

[0133]

[0134] Among them, the cost-performance ratio characterization model is the ratio of the number of non-fraudulent transaction samples to the number of fraudulent transaction samples in the transaction samples characterized as fraudulent. In specific implementation, the cost-performance ratio that needs to be met can be set to 50 or 100. Therefore, the logic for determining the threshold M is: determine a value of M so that the corresponding cost-performance ratio is less than or equal to the preset cost-performance ratio, and determine the value of M as the target error threshold. For the transaction to be detected, if its final relative reconstruction error is greater than or equal to the threshold M, then the transaction to be detected is determined to be a risky transaction and may be a fraudulent transaction; if the transaction's final relative reconstruction error is less than the threshold M, then the transaction to be detected is determined to be a risk-free transaction, that is, a non-fraudulent transaction.

[0135] In practical applications, the risk detection instruction can be an online risk detection for real-time transactions. However, facing a large amount of transaction data will affect the processing speed and efficiency of the model. Therefore, in one embodiment, when receiving a transaction risk detection instruction, the following process can be included:

[0136] (21) obtaining a transaction request sent by the terminal, the transaction request instructing to transfer a specified amount of virtual resources in the first electronic payment account to the second electronic payment account;

[0137] (22) respectively obtaining account opening information of the first electronic payment account and the second electronic payment account;

[0138] (23) If the account opening information of the first electronic payment account is different from that of the second electronic payment account, a transaction risk detection instruction is triggered based on the current transaction request.

[0139] Specifically, when a user initiates a transaction request through a terminal device to conduct a transaction with another user, the transaction request can be intercepted and reported to the risk detection system in this solution. Subsequently, based on the transaction request information, the account opening information of the first and second electronic payment accounts can be obtained. By comparing the account opening information of the first and second electronic payment accounts, it is determined whether risk detection is necessary for the current transaction. For two electronic payment accounts with different account opening information, a transaction risk detection instruction will be triggered; for two electronic payment accounts with the same account opening information, a transaction risk detection instruction will not be triggered, thereby reducing the workload of subsequent models and improving the model's processing speed and efficiency.

[0140] In one embodiment, after detecting the transaction risk of the transaction to be detected based on the relative reconstruction error, if it is determined that the transaction to be detected has a transaction risk, a risk prompt message can be sent to the terminal to inform the user that the current transaction may have a transaction risk and that they need to trade carefully to avoid property losses. If it is determined that the transaction to be detected does not have a transaction risk, the specified amount of virtual resources in the first electronic payment account will be transferred to the second electronic payment account in response to the transaction request to complete the current transaction.

[0141] In one embodiment, after transferring the specified amount of virtual resources in the first electronic payment account to the second electronic payment account in response to the transaction request, if feedback information indicating that the transaction to be detected is a fraudulent transaction is received, it means that the model's previous qualitative judgment of the transaction to be detected as a non-fraudulent transaction was a misjudgment. Therefore, the training set corresponding to the first autoencoder model can be updated based on the sample to be detected, where the training set includes multiple known fraudulent transaction samples. Then, the first autoencoder model is retrained based on the updated training set to further improve the accuracy of reconstructing data by the first autoencoder model.

[0142] According to the method described in the above embodiments, the following will give an example for further detailed description. Refer to Figure 5 , Figure 5 which is a schematic diagram of the application scenario for social payment fraud transaction detection. As Figure 5 shown, taking the implementation of transaction behavior through a social payment account as an example, the transaction risks, fraudulent transactions, etc. in the social payment scenario are detected and identified.

[0143] Specifically, in this embodiment, a risk control platform is constructed, and a trained autoencoder model and supporting strategies are deployed online and linked with the payment platform. For each transaction of the social payment account in the payment platform, the risk control platform will intercept it and perform real-time transaction risk detection. When it is identified that the current transaction has a high fraud risk, the system will perform operations such as risk prompting and payment interception to reduce the fraud risk of social payment and reduce user losses.

[0144] Refer to Figure 5 Specifically, in implementation, a large amount of data and cases will be analyzed offline first to train a risk detection model (such as a positive and negative autoencoder trained based on positive and negative samples), and then the model results after training will be deployed to the storage system of the risk control platform. At the strategy layer, corresponding supporting risk control strategies will be deployed. When a user initiates a transaction through a social payment account, the risk control platform will detect the fraud risk of the transaction based on the model and risk control strategies. When it is identified that the current transaction has a fraud risk, the system will perform operations such as risk prompting and payment interception to make the user aware of the fraud risk of the current transaction and thus prevent the transaction from occurring, reducing the fraud risk and the user's property losses to a certain extent.

[0145] Refer to Figure 6 For the above application scenario of social payment fraud transaction detection, this embodiment also provides a social payment fraud transaction detection method based on a semi-supervised autoencoder. The specific process is as follows:

[0146] 201. Obtain sample data with fraudulent transactions as positive samples and sample data with non-fraudulent transactions as negative samples.

[0147] 202. Construct the model structure of positive autoencoder and negative autoencoder.

[0148] 203. Train the model based on positive samples and negative samples respectively and calculate the model parameters.

[0149] Specifically, the positive autoencoder is trained based on positive samples, and the negative encoder model is trained based on negative samples.

[0150] 204. Determine a target error threshold M based on the relative reconstruction errors of all samples and the required cost-performance ratio.

[0151] Specifically, all training samples (regardless of positive or negative) are fed into the positive and negative autoencoders, respectively, to obtain two reconstruction vectors for the training samples. Then, based on each sample vector and the two reconstruction vectors, the relative reconstruction error for all samples is calculated. Finally, based on the distribution of the relative reconstruction error across all samples, a threshold that satisfies the required cost-effectiveness criteria is determined as the target error threshold M.

[0152] 205. Develop and deploy the model to the online risk control strategy system based on the trained model parameters.

[0153] 206. Perform real-time model calculations on each social payment transaction, and build a corresponding risk control strategy for real-time risk detection based on the relative size of its relative reconstruction error and the target error threshold M.

[0154] The embodiment of the present application provides a social payment fraud transaction detection method based on a semi-supervised autoencoder. The autoencoder is used to learn the reconstruction models of fraudulent transaction samples and non-fraudulent transaction samples respectively, and the transactions to be detected are input into the two models for reconstruction respectively. The transaction behavior is subjected to risk detection based on the final relative reconstruction error. The transaction risk is judged by the characteristic performance of the same transaction behavior in different models, rather than directly evaluating the risk score, thereby improving the accuracy of the transaction risk detection results.

[0155] In order to better implement the above method, an embodiment of the present application also provides a transaction risk detection device, which can be integrated into an electronic device, such as a server or terminal, and the terminal can include a tablet computer, a laptop computer and / or a personal computer, etc.

[0156] For example, Figure 7 As shown, the transaction risk detection device may include: a first acquisition unit 301, a reconstruction unit 302, a second acquisition unit 303, a first determination unit 304, and a detection unit 305, as follows:

[0157] The first acquisition unit 301 is configured to receive a transaction risk detection instruction and acquire an original vector of a transaction to be detected according to the detection instruction;

[0158] a reconstruction unit 302 configured to reconstruct the original vector based on a pre-trained first autoencoder model and a pre-trained second autoencoder model, respectively, to obtain a first reconstructed vector and a second reconstructed vector, wherein the first autoencoder model is trained based on data of fraudulent transaction samples and the second autoencoder model is trained based on data of non-fraudulent transaction samples;

[0159] A second obtaining unit 303 is configured to obtain a first reconstruction error of the first reconstructed vector relative to the original vector, and a second reconstruction error of the second reconstructed vector relative to the original vector;

[0160] A first determining unit 304 is configured to determine a relative reconstruction error of the transaction to be detected based on a ratio of the second reconstruction error to the first reconstruction error;

[0161] The detection unit 305 is configured to detect the transaction risk of the transaction to be detected based on the relative reconstruction error.

[0162] Optionally, in some implementations, the first determining unit 304 is further configured to:

[0163] The relative reconstruction error is compared with a target error threshold to obtain a comparison result, wherein the target error threshold is determined based on the distribution information of the sample relative reconstruction error of the fraudulent transaction sample and the distribution information of the sample relative reconstruction error of the non-fraudulent sample; and the transaction risk of the transaction to be detected is determined based on the comparison result.

[0164] Optionally, in some embodiments, the method further comprises:

[0165] A third acquisition unit is configured to acquire a transaction sample set before acquiring the original vector of the transaction to be detected, the transaction sample set including: a plurality of fraudulent transaction samples and a plurality of non-fraudulent transaction samples;

[0166] a training unit, configured to train a basic autoencoder model based on the data of the fraudulent transaction sample to obtain the first autoencoder model, and to train the basic autoencoder model based on the data of the non-fraudulent transaction sample to obtain the second autoencoder model;

[0167] A fourth acquisition unit, configured to obtain the sample relative reconstruction error and its distribution information of the fraud transaction samples, and the sample relative reconstruction error and its distribution information of the non-fraud samples, based on the first autoencoder model and the second autoencoder model;

[0168] A second determination unit, configured to determine a target error threshold according to the distribution information of the sample relative reconstruction error of the fraud transaction samples and the distribution information of the sample relative reconstruction error of the non-fraud samples, such that, among all the transaction samples whose sample relative reconstruction error is greater than or equal to the target error threshold, the ratio of the second quantity of the non-fraud samples to the first quantity of the fraud samples is less than or equal to a preset value.

[0169] Optionally, in some embodiments, the fourth acquisition unit is further configured to:

[0170] Obtain the sample vectors of each transaction sample in the transaction sample set; respectively reconstruct each sample vector based on the first autoencoder model and the second autoencoder model to obtain a first sample reconstruction vector and a second sample reconstruction vector of each sample vector; for each transaction sample in the sample set, obtain a first sample reconstruction error of the first sample reconstruction vector relative to the sample vector, and a second sample reconstruction error of the second sample reconstruction vector relative to the sample vector; for each transaction sample in the sample set, obtain a ratio of the second sample reconstruction error to the first sample reconstruction error; based on the ratios corresponding to each transaction sample in the sample set, determine the sample relative reconstruction error and its distribution information of the fraud transaction samples, and the sample relative reconstruction error and its distribution information of the non-fraud samples.

[0171] Optionally, in some embodiments, the first determination unit 304 is further configured to:

[0172] If the comparison result is that the relative reconstruction error is greater than or equal to the target error threshold, determine that the transaction to be detected has a transaction risk; if the comparison result is that the relative reconstruction error is less than the target error threshold, determine that the transaction to be detected has no transaction risk.

[0173] Optionally, in some embodiments, further includes:

[0174] A fifth acquisition unit, configured to obtain a difference between the relative reconstruction error and the target error threshold after determining that the transaction to be detected has a transaction risk;

[0175] A third determination unit, configured to determine the transaction risk level of the transaction to be detected according to the difference.

[0176] Optionally, in some embodiments, the second acquisition unit 303 is further configured to:

[0177] Obtain a first square value of the modulus of the difference between the first reconstructed vector and the original vector, and a second square value of the modulus of the difference between the second reconstructed vector and the original vector; calculate the ratio of the first square value to the square value of the modulus of the original vector to obtain the first reconstruction error; calculate the ratio of the second square value to the square value of the modulus of the original vector to obtain the second reconstruction error.

[0178] Optionally, in some implementations, upon receiving the transaction risk detection instruction, the first acquiring unit 301 is further configured to:

[0179] Obtain a transaction request sent by a terminal, the transaction request instructing to transfer a specified amount of virtual resources in a first electronic payment account to a second electronic payment account; obtain account opening information of the first electronic payment account and the second electronic payment account respectively; if the account opening information of the first electronic payment account is different from that of the second electronic payment account, trigger a transaction risk detection instruction based on the current transaction request.

[0180] Optionally, in some embodiments, further comprising:

[0181] The processing unit is configured to, after detecting the transaction risk of the transaction to be detected based on the relative reconstruction error, send risk warning information to the terminal if it is determined that the transaction to be detected has a transaction risk; and transfer a specified amount of virtual resources in the first electronic payment account to the second electronic payment account in response to the transaction request if it is determined that the transaction to be detected does not have a transaction risk.

[0182] Optionally, in some embodiments, the method further comprises:

[0183] an updating unit, configured to, after transferring a specified amount of virtual resources in the first electronic payment account to the second electronic payment account in response to the transaction request, update a training set corresponding to the first autoencoder model based on the sample to be detected if feedback information indicating that the transaction to be detected is a fraudulent transaction is received, wherein the training set includes a plurality of fraudulent transaction samples;

[0184] The training unit is further configured to retrain the first autoencoder model based on the updated training set.

[0185] As can be seen from the above, when the transaction risk detection device provided by the embodiment of the present application receives a transaction risk detection instruction, it obtains the original vector of the transaction to be detected, and respectively uses the first autoencoder model pre-trained based on fraud transaction sample data and the second autoencoder model trained based on non-fraud transaction samples to reconstruct the original vector, obtaining a first reconstructed vector and a second reconstructed vector; then, it obtains the first reconstruction error of the first reconstructed vector relative to the original vector and the second reconstruction error of the second reconstructed vector relative to the original vector, and determines the relative reconstruction error of the transaction to be detected according to the ratio of the second reconstruction error to the first reconstruction error; finally, it detects the transaction risk of the transaction to be detected based on the relative reconstruction error. This solution uses autoencoders to respectively learn the reconstruction models of fraud transaction samples and non-fraud transaction samples, inputs the transaction to be detected into the two models for reconstruction respectively, and detects the risk of the transaction behavior based on the final relative reconstruction error, judging the transaction risk through the feature performance of the same transaction behavior in different models, rather than directly evaluating the risk score, thereby improving the accuracy of the transaction risk detection result. In addition, corresponding interception and risk reminder measures can be taken for transaction behaviors with transaction risks, reducing the risks and losses faced by the platform and users.

[0186] The embodiment of the present application also provides an electronic device, as Figure 8 shown, which shows the structural schematic diagram of the electronic device involved in the embodiment of the present application. Specifically:

[0187] The electronic device may include a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, an input unit 404 and other components. Those skilled in the art can understand that Figure 8 the structure of the electronic device shown in

[0188] does not constitute a limitation to the electronic device, and may include more or fewer components than shown in the figure, or combine some components, or arrange different components. Among them:

[0189] The processor 401 is the control center of the electronic device, connecting various parts of the entire electronic device through various interfaces and lines, running or executing software programs and / or modules stored in the memory 402, and calling data stored in the memory 402 to execute various functions of the electronic device and process data. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modulation and demodulation processor. Among them, the application processor mainly processes the operating system, user interface and application programs, etc., and the modulation and demodulation processor mainly processes wireless communication. It can be understood that the above modulation and demodulation processor may not be integrated into the processor 401.

[0189] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and detection of transaction risks by running the software programs and modules stored in the memory 402. The memory 402 mainly includes a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created according to the use of the electronic device. In addition, the memory 402 can include high-speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices. Correspondingly, the memory 402 can also include a memory controller to provide the processor 401 with access to the memory 402.

[0190] The electronic device further includes a power supply 403 for powering each component. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, so as to implement functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 403 can also include any components such as one or more DC or AC power supplies, a recharge system, a power failure detection circuit, a power converter or inverter, and a power status indicator.

[0191] The electronic device may further include an input unit 404, which can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0192] Although not shown, the electronic device may further include a display unit, etc., which will not be elaborated here. Specifically, in this embodiment, the processor 401 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and the processor 401 will run the application programs stored in the memory 402 to implement various functions as follows:

[0193] Receive a transaction risk detection instruction, and obtain the original vector of the transaction to be detected according to the detection instruction;

[0194] Respectively reconstruct the original vector based on the pre-trained first autoencoder model and the second autoencoder model to obtain a first reconstructed vector and a second reconstructed vector, where the first autoencoder model is trained based on the data of fraud transaction samples, and the second autoencoder model is trained based on the data of non-fraud transaction samples;

[0195] Obtain the first reconstruction error of the first reconstructed vector relative to the original vector, and the second reconstruction error of the second reconstructed vector relative to the original vector;

[0196] Determine the relative reconstruction error of the transaction to be detected according to the ratio of the second reconstruction error to the first reconstruction error;

[0197] Detect the transaction risk of the transaction to be detected based on the relative reconstruction error.

[0198] In one embodiment, when detecting the transaction risk of the transaction to be detected based on the relative reconstruction error, the processor 401 is specifically configured to: compare the relative reconstruction error with a target error threshold to obtain a comparison result, where the target error threshold is determined based on the distribution information of the sample relative reconstruction error of the fraud transaction samples and the distribution information of the sample relative reconstruction error of the non-fraud samples; determine the transaction risk of the transaction to be detected according to the comparison result.

[0199] In one embodiment, before obtaining the original vector of the transaction to be detected, the processor 401 is further configured to: obtain a transaction sample set, where the transaction sample set includes: a plurality of fraud transaction samples and a plurality of non-fraud transaction samples; train a basic autoencoder model based on the data of the fraud transaction samples to obtain the first autoencoder model, and train the basic autoencoder model based on the data of the non-fraud transaction samples to obtain the second autoencoder model; based on the first autoencoder model and the second autoencoder model, obtain the sample relative reconstruction error and its distribution information of the fraud transaction samples, and the sample relative reconstruction error and its distribution information of the non-fraud samples; determine a target error threshold according to the distribution information of the sample relative reconstruction error of the fraud transaction samples and the distribution information of the sample relative reconstruction error of the non-fraud samples, so that in all transaction samples where the sample relative reconstruction error is greater than or equal to the target error threshold, the ratio of the second quantity of the non-fraud samples to the first quantity of the fraud samples is less than or equal to a preset value.

[0200] In some embodiments, when obtaining the sample relative reconstruction error and its distribution information of the fraudulent transaction samples, and the sample relative reconstruction error and its distribution information of the non-fraudulent samples based on the first autoencoder model and the second autoencoder model, the processor 401 is specifically configured to: obtain the sample vector of each transaction sample in the transaction sample set; respectively reconstruct each sample vector based on the first autoencoder model and the second autoencoder model to obtain a first sample reconstruction vector and a second sample reconstruction vector of each sample vector; for each transaction sample in the sample set, obtain a first sample reconstruction error of the first sample reconstruction vector relative to the sample vector, and a second sample reconstruction error of the second sample reconstruction vector relative to the sample vector; for each transaction sample in the sample set, obtain a ratio of the second sample reconstruction error to the first sample reconstruction error; based on the ratios corresponding to each transaction sample in the sample set, determine the sample relative reconstruction error and its distribution information of the fraudulent transaction samples, and the sample relative reconstruction error and its distribution information of the non-fraudulent samples.

[0201] Optionally, in some embodiments, when determining the transaction risk of the transaction to be detected according to the comparison result, the processor 401 is specifically configured to: if the comparison result is that the relative reconstruction error is greater than or equal to the target error threshold, determine that the transaction to be detected has a transaction risk; if the comparison result is that the relative reconstruction error is greater than or equal to the target error threshold, determine that the transaction to be detected does not have a transaction risk.

[0202] Optionally, in some embodiments, after determining that the transaction to be detected has a transaction risk, the processor 401 is further configured to: obtain a difference between the relative reconstruction error and the target error threshold; determine the transaction risk level of the transaction to be detected according to the difference.

[0203] Optionally, in some embodiments, when obtaining the first reconstruction error of the first reconstruction vector relative to the original vector, and the second reconstruction error of the second reconstruction vector relative to the original vector, the processor 401 is specifically configured to: obtain a first squared value of the modulus of the difference between the first reconstruction vector and the original vector, and a second squared value of the modulus of the difference between the second reconstruction vector and the original vector; calculate a ratio of the first squared value to the squared value of the modulus of the original vector to obtain the first reconstruction error; calculate a ratio of the second squared value to the squared value of the modulus of the original vector to obtain the second reconstruction error.

[0204] Optionally, in some embodiments, when receiving a transaction risk detection instruction, the processor 401 is specifically used to: obtain a transaction request sent by the terminal, which transaction request indicates that a specified number of virtual resources in the first electronic payment account is transferred to the second electronic payment account; obtain the account opening information of the first electronic payment account and the second electronic payment account respectively; if the account opening information of the first electronic payment account is different from that of the second electronic payment account, triggering a transaction risk detection instruction based on the current transaction request.

[0205] Optionally, after detecting the transaction risk of the transaction to be detected based on the relative reconstruction error, the processor 401 is also used to: if it is determined that the transaction to be detected has a transaction risk, send risk warning information to the terminal; if it is determined that the transaction to be detected does not have a transaction risk, transfer the specified amount of virtual resources in the first electronic payment account to the second electronic payment account in response to the transaction request.

[0206] Optionally, in some embodiments, after transferring a specified amount of virtual resources in the first electronic payment account to the second electronic payment account in response to the transaction request, the processor 401 is further used to: if feedback information indicating that the transaction to be detected is a fraudulent transaction is received, update the training set corresponding to the first autoencoding model based on the sample to be detected, wherein the training set includes multiple fraudulent transaction samples; and retrain the first autoencoding model based on the updated training set.

[0207] The specific implementation of the above operations can be found in the previous embodiments and will not be described in detail here.

[0208] As can be seen from the above, in the embodiments of the present application, the electronic device uses an autoencoder to learn reconstruction models for fraudulent and non-fraudulent transaction samples, respectively. The transaction to be detected is then fed into the two models for reconstruction. The transaction behavior is then subjected to risk detection based on the resulting relative reconstruction error. This method uses the characteristic representation of the same transaction behavior in different models to determine transaction risk, rather than directly assessing the risk score. This improves the accuracy of transaction risk detection results. Furthermore, appropriate interception and risk warning measures can be implemented for transactions that pose a risk, reducing the risks and losses faced by the platform and its users.

[0209] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0210] To this end, an embodiment of the present application provides a computer-readable storage medium storing multiple instructions that can be loaded by a processor to execute the steps in any of the transaction risk detection methods provided by the embodiments of the present application. For example, the instructions can execute the following steps:

[0211] Receive a transaction risk detection instruction, and obtain the original vector of the transaction to be detected according to the detection instruction; respectively reconstruct the original vector based on the pre-trained first autoencoder model and the second autoencoder model to obtain a first reconstructed vector and a second reconstructed vector, where the first autoencoder model is trained based on the data of fraud transaction samples, and the second autoencoder model is trained based on the data of non-fraud transaction samples; obtain a first reconstruction error of the first reconstructed vector relative to the original vector, and a second reconstruction error of the second reconstructed vector relative to the original vector; determine the relative reconstruction error of the transaction to be detected according to the ratio of the second reconstruction error to the first reconstruction error; and detect the transaction risk of the transaction to be detected based on the relative reconstruction error.

[0212] For the specific implementation of each of the above operations, reference may be made to the previous embodiments and will not be elaborated herein.

[0213] The computer-readable storage medium may include, for example, a read-only memory (ROM, Read Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk, or an optical disc.

[0214] Since the instructions stored in the computer-readable storage medium can execute the steps in any of the transaction risk detection methods provided by the embodiments of the present application, the beneficial effects achievable by any of the transaction risk detection methods provided by the embodiments of the present application can be realized. For details, reference may be made to the previous embodiments and will not be elaborated herein.

[0215] According to an aspect of the present application, a computer program product or a computer program is provided. The computer program product or the computer program includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in various optional implementation manners of the above-mentioned transaction risk detection aspect.

[0216] The above has introduced in detail a method, apparatus, electronic device, computer-readable storage medium, and computer program product for detecting transaction risks. In this article, specific examples are used to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation on the present application.

Claims

1. A method for detecting trading risks, characterized in that, Including: Receiving a transaction risk detection instruction, and obtaining an original vector of a transaction to be detected according to the detection instruction; Respectively reconstructing the original vector based on a pre-trained first autoencoder model and a second autoencoder model to obtain a first reconstructed vector and a second reconstructed vector, wherein the first autoencoder model is trained based on data of fraud transaction samples, and the second autoencoder model is trained based on data of non-fraud transaction samples; Obtaining a first reconstruction error of the first reconstructed vector relative to the original vector, and a second reconstruction error of the second reconstructed vector relative to the original vector; Determining a relative reconstruction error of the transaction to be detected according to a ratio of the second reconstruction error to the first reconstruction error; Detecting the transaction risk of the transaction to be detected based on the relative reconstruction error.

2. The detection method of transaction risk according to claim 1, wherein The detecting the transaction risk of the transaction to be detected based on the relative reconstruction error includes: Comparing the relative reconstruction error with a target error threshold to obtain a comparison result, wherein the target error threshold is determined based on distribution information of sample relative reconstruction errors of the fraud transaction samples and distribution information of sample relative reconstruction errors of the non-fraud samples; Determining the transaction risk of the transaction to be detected according to the comparison result.

3. The detection method for transaction risks according to claim 2, wherein The determining the transaction risk of the transaction to be detected according to the comparison result includes: If the comparison result is that the relative reconstruction error is greater than or equal to the target error threshold, determining that the transaction to be detected has a transaction risk; If the comparison result is that the relative reconstruction error is greater than or equal to the target error threshold, determining that the transaction to be detected does not have a transaction risk.

4. The detection method for transaction risks according to claim 3, wherein, After determining that the transaction to be detected has a transaction risk, further including: Obtaining a difference between the relative reconstruction error and the target error threshold; Determining a transaction risk level of the transaction to be detected according to the difference.

5. The detection method of transaction risk according to claim 2, wherein Before obtaining the original vector of the transaction to be detected, further including: Obtaining a transaction sample set, where the transaction sample set includes: a plurality of fraud transaction samples and a plurality of non-fraud transaction samples; Training a basic autoencoder model based on the data of the fraud transaction samples to obtain the first autoencoder model, and training the basic autoencoder model based on the data of the non-fraud transaction samples to obtain the second autoencoder model; Based on the first autoencoder model and the second autoencoder model, obtaining the sample relative reconstruction error and its distribution information of the fraud transaction samples, and the sample relative reconstruction error and its distribution information of the non-fraud samples; Determining a target error threshold according to the distribution information of the sample relative reconstruction errors of the fraud transaction samples and the distribution information of the sample relative reconstruction errors of the non-fraud samples, so that in all transaction samples where the sample relative reconstruction error is greater than or equal to the target error threshold, the ratio of the second quantity of the non-fraud samples to the first quantity of the fraud samples is less than or equal to a preset value.

6. The detection method for transaction risks according to claim 5, wherein Based on the first autoencoder model and the second autoencoder model, obtaining the sample relative reconstruction error and its distribution information of the fraud transaction samples, and the sample relative reconstruction error and its distribution information of the non-fraud samples, includes: Obtaining the sample vector of each transaction sample in the transaction sample set; Respectively reconstructing each sample vector based on the first autoencoder model and the second autoencoder model to obtain a first sample reconstruction vector and a second sample reconstruction vector of each sample vector; For each transaction sample in the sample set, obtaining a first sample reconstruction error of the first sample reconstruction vector relative to the sample vector, and a second sample reconstruction error of the second sample reconstruction vector relative to the sample vector; For each transaction sample in the sample set, obtaining the ratio of the second sample reconstruction error to the first sample reconstruction error; Based on the ratios corresponding to each transaction sample in the sample set, determining the sample relative reconstruction error and its distribution information of the fraud transaction samples, and the sample relative reconstruction error and its distribution information of the non-fraud samples.

7. The detection method for transaction risks according to claim 1, characterized in that, The obtaining the first reconstruction error of the first reconstruction vector relative to the original vector, and the second reconstruction error of the second reconstruction vector relative to the original vector, includes: Obtaining a first squared value of the norm of the difference between the first reconstruction vector and the original vector, and a second squared value of the norm of the difference between the second reconstruction vector and the original vector; Calculating the ratio between the first squared value and the squared value of the norm of the original vector to obtain the first reconstruction error; Calculating the ratio between the second squared value and the squared value of the norm of the original vector to obtain the second reconstruction error.

8. The detection method of transaction risk according to any one of claims 1-7, characterized in that, The receiving the transaction risk detection instruction includes: Obtaining a transaction request sent by a terminal, where the transaction request indicates to transfer a specified amount of virtual resources in a first electronic payment account to a second electronic payment account; Respectively obtaining the account opening information of the first electronic payment account and the second electronic payment account; If the account opening information of the first electronic payment account and the second electronic payment account is different, triggering a transaction risk detection instruction based on the current transaction request.

9. The detection method for transaction risks according to claim 8, wherein, After detecting the transaction risk of the transaction to be detected based on the relative reconstruction error, it further includes: If it is determined that the transaction to be detected has a transaction risk, sending a risk prompt message to the terminal; If it is determined that the transaction to be detected has no transaction risk, responding to the transaction request to transfer the specified amount of virtual resources in the first electronic payment account to the second electronic payment account.

10. The detection method for transaction risks according to claim 9, wherein After responding to the transaction request to transfer the specified amount of virtual resources in the first electronic payment account to the second electronic payment account, it further includes: If feedback information indicating that the transaction to be detected is a fraud transaction is received, updating the training set corresponding to the first autoencoder model based on the sample to be detected, where the training set includes multiple fraud transaction samples; Re-training the first autoencoder model based on the updated training set.

11. A detection device for transaction risks, characterized in that, Includes: A first acquisition unit, configured to receive a transaction risk detection instruction and acquire an original vector of a transaction to be detected according to the detection instruction; A reconstruction unit, configured to reconstruct the original vector respectively based on a pre-trained first autoencoder model and a second autoencoder model to obtain a first reconstructed vector and a second reconstructed vector, wherein the first autoencoder model is trained based on data of fraud transaction samples, and the second autoencoder model is trained based on data of non-fraud transaction samples; A second acquisition unit, configured to acquire a first reconstruction error of the first reconstructed vector relative to the original vector and a second reconstruction error of the second reconstructed vector relative to the original vector; A first determination unit, configured to determine a relative reconstruction error of the transaction to be detected according to a ratio of the second reconstruction error to the first reconstruction error; A detection unit, configured to detect the transaction risk of the transaction to be detected based on the relative reconstruction error; 12. The detection device for transaction risks according to claim 11, characterized in that, The first determination unit is configured to: Compare the relative reconstruction error with a target error threshold to obtain a comparison result, wherein the target error threshold is determined based on distribution information of sample relative reconstruction errors of the fraud transaction samples and distribution information of sample relative reconstruction errors of the non-fraud samples; Determine the transaction risk of the transaction to be detected according to the comparison result; 13. An electronic device, characterized in that, Comprising a processor and a memory, the memory stores an application program, and the processor is configured to run the application program in the memory to execute the steps in the transaction risk detection method according to any one of claims 1-10; 14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the transaction risk detection method according to any one of claims 1-10; 15. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instruction is executed by a processor, the steps in the transaction risk detection method according to any one of claims 1-10 are implemented.