Training Method for Transaction Information Prediction Model and Transaction Information Prediction Method
By generating merchant association diagrams and combining graph neural networks and recurrent neural networks, the problems of low prediction accuracy and easy overfitting of merchant transaction information in the existing technology are solved, and higher prediction accuracy and model convergence effect are achieved.
Patent Information
- Application Number
- CN202210082588.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-24
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2042-01-24
AI Technical Summary
In the prior art, when using a single machine learning model to predict merchants' future transaction information, the accuracy is low and easy to overfit, and the distance and association relationship between merchants cannot be effectively considered.
By generating a merchant association diagram, using the model structure combined with graph neural network and recurrent neural network, transaction characteristics between merchants are obtained and model training is carried out to improve prediction accuracy and avoid overfitting.
It improves the accuracy of merchant transaction information prediction, improves the convergence effect of the model, and avoids the problem of overfitting.
Smart Images

Figure CN114463057B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of information processing, and particularly relates to a training method for a transaction information prediction model and a transaction information prediction method. Background Art
[0002] With the increasing number of merchants, how to predict the transaction information of merchants in the future time period has become increasingly important. For example, banks can evaluate the lending risks of a merchant by predicting the transaction information of the merchant, and merchants can also formulate sales strategies in advance by predicting the transaction information of themselves or other merchants.
[0003] In the prior art, before using a machine learning model to predict the transaction information of a merchant in the future time period, it is usually necessary to train the machine learning model. The existing training methods mainly use a single machine learning model and simply perform model training based on the historical transaction data of the merchant to be predicted itself. In this way, the accuracy of the prediction result of the model for the merchant transaction information is relatively low, and the model convergence is poor, and it is extremely easy to overfit. Summary of the Invention
[0004] The embodiments of this application provide a training method for a transaction information prediction model and a transaction information prediction method, which can improve the accuracy of the prediction result of the model for the merchant transaction information, enhance the model convergence effect, and avoid the problem of overfitting.
[0005] In a first aspect, the embodiments of this application provide a training method for a transaction information prediction model, and the method includes:
[0006] Generate a merchant association relationship graph according to the distances between N merchants within a target area range, where N is an integer and N≥2;
[0007] Obtain the first transaction features of the N merchants in the first historical time period respectively, and the actual transaction information of the N merchants in the second historical time period respectively, and generate N training samples;
[0008] Use a graph neural network based on the merchant association relationship graph to obtain second transaction features corresponding to a target training sample according to the first transaction features, where the target training sample is any sample among the N training samples;
[0009] According to the second transaction features, use a recurrent neural network to predict the transaction information of the merchant corresponding to the target training sample in the second historical time period respectively, and obtain the predicted transaction information corresponding to the target training sample;
[0010] Based on the predicted transaction information and the actual transaction information, train the graph neural network and the recurrent neural network to obtain a transaction information prediction model.
[0011] In a second aspect, an embodiment of the present application provides a transaction information prediction method, and the method includes:
[0012] Obtain the third transaction features of N merchants within the target area range in the first time period, where N is an integer and N≥2;
[0013] Using the graph neural network based on the merchant association graph in the transaction information prediction model, obtain the fourth transaction feature corresponding to the target merchant according to the third transaction feature;
[0014] According to the fourth transaction feature, use the recurrent neural network in the transaction information prediction model to predict the transaction information of the target merchant in the second time period respectively, and obtain the predicted transaction information corresponding to the target merchant;
[0015] Wherein, the target merchant is any one of the N merchants, and the transaction information prediction model is trained according to the training method of the transaction information prediction model in any embodiment of the first aspect.
[0016] In a third aspect, an embodiment of the present application provides a training device for a transaction information prediction model, and the device includes:
[0017] A relationship graph generation module, configured to generate a merchant association graph according to the distances between N merchants within the target area range, where N is an integer and N≥2;
[0018] A sample generation module, configured to obtain the first transaction features of the N merchants in the first historical time period and the actual transaction information of the N merchants in the second historical time period respectively, and generate N training samples;
[0019] A first acquisition module, configured to use the graph neural network based on the merchant association graph to obtain the second transaction features corresponding to the N training samples respectively according to the first transaction features;
[0020] A first prediction module, configured to respectively predict the transaction information of the N merchants in the second historical time period according to the second transaction features by using a recurrent neural network, and obtain the predicted transaction information corresponding to the N training samples respectively;
[0021] A network training module, configured to train the graph neural network and the recurrent neural network based on the predicted transaction information and the actual transaction information to obtain a transaction information prediction model.
[0022] Fourthly, an embodiment of the present application provides a transaction information prediction device, which includes:
[0023] A second acquisition module, configured to acquire third transaction characteristics of N merchants within a first time period respectively within a target area range, where N is an integer and N≥2;
[0024] A third acquisition module, configured to use a graph neural network based on a merchant association graph in a transaction information prediction model to obtain fourth transaction characteristics corresponding to a target merchant according to the third transaction characteristics;
[0025] An information prediction module, configured to predict transaction information of the target merchant within a second time period respectively according to the fourth transaction characteristics by using a recurrent neural network in the transaction information prediction model, so as to obtain predicted transaction information corresponding to the target merchant;
[0026] Wherein, the target merchant is any one of the N merchants, and the transaction information prediction model is trained according to the training method of the transaction information prediction model in any embodiment of the first aspect.
[0027] Fifthly, an embodiment of the present application provides an electronic device, which includes: a processor and a memory storing computer program instructions;
[0028] When the processor executes the computer program instructions, the steps of the training method of the transaction information prediction model in any embodiment of the first aspect or the transaction information prediction method in any embodiment of the second aspect are implemented.
[0029] Fourthly, an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the steps of the training method of the transaction information prediction model in any embodiment of the first aspect or the transaction information prediction method in any embodiment of the second aspect are implemented.
[0030] The training method and trading information prediction method of the trading information prediction model in the embodiments of the present application generate a merchant association relationship graph according to the distances between multiple merchants, and use a graph neural network based on the merchant association relationship graph to obtain the second trading features of the target training samples. In this way, the trading features extracted using this merchant association relationship graph can incorporate the influencing factors between merchants into the features, and then use a recurrent neural network to predict trading information. By comparing the predicted trading information with the actual trading information, the two neural networks are trained, so that the trained trading information prediction model can learn the influence of the distances between merchants on trading information, thereby improving the accuracy of the model's prediction results for merchant trading information. In addition, since the embodiments of the present application also use a model structure that combines a graph neural network and a recurrent neural network for trading information prediction, the convergence effect of the model can be improved during training, avoiding the problem of overfitting. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] To more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required to be used in the embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0032] Figure 1 is a schematic flowchart of an embodiment of the training method of the trading information prediction model provided by the present application;
[0033] Figure 2 is a schematic diagram of an example of a fully connected graph provided by the present application;
[0034] Figure 3 is a schematic diagram of an example of a merchant association relationship graph provided by the present application;
[0035] Figure 4 is a schematic diagram of another example of a fully connected graph provided by the present application;
[0036] Figure 5 is a schematic diagram of another example of a merchant association relationship graph provided by the present application;
[0037] Figure 6 is a schematic diagram of an example of the trading feature extraction process provided by the present application;
[0038] Figure 7 is a schematic diagram of an example of the adjacency matrix normalization process provided by the present application;
[0039] Figure 8 is a schematic flowchart of another embodiment of the training method of the trading information prediction model provided by the present application;
[0040] Figure 9It is a schematic structural diagram of an example of the transaction information prediction model provided by the present application;
[0041] Figure 10 It is a schematic flowchart of an embodiment of the transaction information prediction method provided by the present application;
[0042] Figure 11 It is a schematic structural diagram of an embodiment of the training device of the transaction information prediction model provided by the present application;
[0043] Figure 12 It is a schematic structural diagram of an embodiment of the transaction information prediction device provided by the present application;
[0044] Figure 13 It is a schematic structural diagram of an embodiment of the electronic device provided by the present application. Detailed Description of the Invention
[0045] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the objectives, technical solutions and advantages of the present application more clear and understandable, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without some of these specific details. The following description of the embodiments is only intended to provide a better understanding of the present application by showing examples of the present application.
[0046] It should be noted that, in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variation thereof is intended to cover a non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, elements defined by the statement "comprising..." do not preclude the existence of additional identical elements in the process, method, article or device comprising the said elements.
[0047] Currently, when predicting the transaction information of merchants, if a single machine learning model is directly introduced into the corresponding information prediction scenario, the possible defects are as follows:
[0048] (1) It is impossible to pay attention to the distance features between merchants. The distance between merchants is closely related to the sales volume of merchants. Generally, where merchants gather, there are commercial circles with a large number of consumers and higher transaction amounts compared to relatively remote merchants;
[0049] (2) Making predictions based on a single merchant cannot well consider the associations between merchants.
[0050] (3) Only using a single deep learning model for prediction has poor model convergence and is extremely prone to overfitting.
[0051] To solve the problems of the prior art, the embodiments of the present application provide a training method for a transaction information prediction model and a transaction information prediction method. The training method for the transaction information prediction model can be applied to the scenario of training a model for predicting the transaction information of merchants. First, the training method for the transaction information prediction model provided by the embodiments of the present application will be introduced below.
[0052] Figure 1 The flowchart of an embodiment of the training method for the transaction information prediction model provided by the present application is shown. As Figure 1 shown, the training method for the transaction information prediction model may specifically include the following steps:
[0053] S110. Generate a merchant association relationship graph according to the distances between N merchants within the target area range, where N is an integer and N≥2.
[0054] S120. Obtain the first transaction features of the N merchants respectively within the first historical time period, and the actual transaction information of the N merchants respectively within the second historical time period, and generate N training samples.
[0055] S130. Use a graph neural network based on the merchant association relationship graph to obtain the second transaction feature corresponding to the target training sample according to the first transaction feature, where the target training sample is any sample among the N training samples.
[0056] S140. According to the second transaction feature, use a recurrent neural network to predict the transaction information of the merchant corresponding to the target training sample within the second historical time period respectively, and obtain the predicted transaction information corresponding to the target training sample.
[0057] S150. Based on the predicted transaction information and the actual transaction information, train the graph neural network and the recurrent neural network to obtain a transaction information prediction model.
[0058] Thus, by generating a merchant association relationship graph based on the distances between multiple merchants and using a graph neural network based on the merchant association relationship graph to obtain the second transaction features of the target training samples, the transaction features extracted using this merchant association relationship graph can incorporate the influencing factors between merchants into the features. Then, a recurrent neural network is used to predict transaction information. By comparing the predicted transaction information with the actual transaction information, the two neural networks are trained, enabling the trained transaction information prediction model to learn the impact of the distances between merchants on the transaction information, thereby improving the accuracy of the model's prediction results for merchant transaction information. Additionally, since the embodiments of the present application also use a model structure that combines a graph neural network and a recurrent neural network for predicting transaction information, the convergence effect of the model can be enhanced during training, avoiding the problem of overfitting.
[0059] The following describes the specific implementation methods of the above steps.
[0060] In some embodiments, in S110, the target area range may be the administrative area range containing the target merchant to be measured, such as a city, county, town, district, etc., or the area range within a preset distance near the target merchant to be measured. This is not limited herein.
[0061] Exemplarily, for all merchants included in the district where the target merchant to be predicted is located, the distances between the longitude and latitude coordinates of each merchant can be calculated, and the association relationship between the merchants can be determined using these distances, thereby constructing a merchant association relationship graph. Among them, the merchant association relationship graph can be a graph with each merchant as a node and the association relationship between merchants as an edge, used to represent the association relationship between merchants.
[0062] In some embodiments, the above S110 may specifically include:
[0063] Construct a fully connected graph with merchants as nodes and distances as edges based on the distances between N merchants within the target area range;
[0064] Convert the fully connected graph into a merchant association relationship graph according to the preset conversion method between distance and association degree, where the distance and association degree are negatively correlated.
[0065] Here, between every two nodes corresponding to merchants in the fully connected graph, there is an edge with distance as information, and each node corresponding to a merchant itself has an edge with 0 as information.
[0066] For example, Figure 2When the distance between the first merchant and the second merchant is 0.8 km, the edge information between node 1 corresponding to the first merchant and node 2 corresponding to the second merchant is 0.8, and so on. Based on the distances between the first, second, third, fourth, and fifth merchants pairwise, the edge information between the pairwise nodes of node 1 corresponding to the first merchant, node 2 corresponding to the second merchant, node 3 corresponding to the third merchant, node 4 corresponding to the fourth merchant, and node 5 corresponding to the fifth merchant can be obtained, and a fully connected graph as shown in Figure 2 is constructed.
[0067] In addition, since the farther the distance between merchants, the smaller the correlation, therefore, a corresponding conversion method can be set through the negative correlation relationship between distance and correlation. The preset conversion methods include but are not limited to: where d max is the maximum distance value preset between each merchant, a is the correlation between the merchants corresponding to the current two nodes, and d is the distance between the merchants corresponding to the current two nodes.
[0068] Exemplarily, according to the above preset conversion method, the correlation between the nodes corresponding to each merchant can be calculated, and then the fully connected graph as shown in Figure 2 can be transformed into a merchant correlation relationship graph with merchants as nodes and the correlation between merchants as edges as shown in Figure 3 . For example, the distance between the first merchant and the second merchant is 0.8 km. If d max = 2 km, then the correlation between node 1 corresponding to the first merchant and node 2 corresponding to the second merchant is (2 km - 0.8 km) / 2 km = 0.6. Similarly, other merchant correlation relationship graphs including nodes 1, 2, 3, 4, and 5 can be obtained.
[0069] In addition, considering that as the number of merchants increases, it may lead to the merchant correlation relationship graph being too complex, resulting in a decrease in the computing performance during subsequent training of the model. Therefore, for the convenience of subsequent calculations, before converting the fully connected graph into a merchant correlation relationship graph, the fully connected graph can be cropped to retain the edge information within the preset distance threshold. In some embodiments, the step of constructing a fully connected graph with merchants as nodes and distances as edges based on the distances between N merchants within the target area range may specifically include:
[0070] Construct an initial fully connected graph with merchants as nodes and distances as edges according to the distances between each merchant within the target area range;
[0071] Delete the edges with distances less than the preset distance threshold and the nodes without edges connected in the initial fully connected graph to obtain a fully connected graph corresponding to N merchants.
[0072] Here, an initial fully connected graph can be constructed first based on the distances between all merchants within the target area. Then, the initial fully connected graph is pruned according to a preset distance threshold, retaining the edges with distances within the preset distance threshold. At the same time, nodes that are not connected to any other nodes are deleted, that is, isolated nodes are deleted. Among them, the preset distance threshold can be set according to actual scenario requirements. For example, it can be 1 km, that is, d max = 1 km.
[0073] In some specific examples, for the initial fully connected graph as shown in Figure 2 , the edges with distances less than 1 can be deleted to obtain a fully connected graph as shown in Figure 4 . Since all nodes in it are connected by edges, all nodes can be retained, obtaining a fully connected graph containing node 1 corresponding to the first merchant, node 2 corresponding to the second merchant, node 3 corresponding to the third merchant, node 4 corresponding to the fourth merchant, and node 5 corresponding to the fifth merchant.
[0074] Based on the fully connected graph as shown in Figure 4 , and d max = 1 km, the aforementioned preset conversion method can be used to convert and obtain a merchant association graph as shown in Figure 5 , containing nodes 1 to 5.
[0075] In some embodiments, in S120, the first transaction feature corresponding to each merchant can be extracted separately from the historical data of the merchant. Among them, the merchant may correspond to different transaction features in different historical time periods. The first transaction feature can be the transaction feature of the merchant in the first historical time period. This transaction feature can be a feature vector extracted from the historical data that can uniquely represent the merchant, and this feature vector can be used as the initial feature corresponding to the merchant in the training sample.
[0076] In addition, the second historical time period can be a time period after the first historical time period. For example, if the first historical time period is the 1st week, the second historical time period is the 2nd week. Of course, the second historical time period can also be a time period that is one time cycle later than the first historical time period. For example, when the time cycle is one week, if the first historical time period is the time period from the 1st to the 4th week, the second historical time period can be the time period from the 2nd to the 5th week. In this regard, the embodiments of the present application do not make any limitations. In addition, the actual transaction information corresponding to the second historical time period of the merchant can also be extracted from historical data and used as the label in the training sample. The actual transaction information can be information of the same type as the predicted transaction information. For example, when the transaction information to be predicted is the transaction amount, the actual transaction information can be the actual transaction amount of the merchant during the second historical time period; when the transaction information to be predicted is the number of transaction pens, the actual transaction information can be the actual number of transaction pens of the merchant during the second historical time period.
[0077] Exemplarily, the historical data corresponding to the inventory of the N merchants can be retrieved from the database, and these historical data can be divided according to time periods to obtain a training set and a test set. Among them, the training set can be used to train the model, and the test set can be used to predict transaction information through the trained model.
[0078] In some embodiments, obtaining the first transaction features of the N merchants in the first historical time period in S120 above may specifically include:
[0079] Obtaining the merchant information, transaction data in the first historical time period, and time information corresponding to the first historical time period respectively corresponding to the N merchants within the target area range;
[0080] Performing vectorization processing on the merchant information, transaction data, and time information to obtain the first transaction features of the N merchants in the first historical time period respectively.
[0081] Exemplarily, the merchant information, transaction data in the first historical time, and time information corresponding to the first historical time period of each merchant can be obtained from the historical data corresponding to the merchant. Among them, the merchant information can include information such as the brand name and the first-level industry label name (such as retail, hotel, catering), etc.; when the predicted transaction information is the weekly transaction amount, the transaction data in the first historical time period can include data such as the current week's transaction pen number, etc., and the time information corresponding to the first historical time period can include information such as the month to which the current week belongs, the number of weeks of the current year, and the number of weeks of the current month, etc.
[0082] In some specific examples, such as Figure 6As shown, feature screening can be performed first. Specifically, fields in historical data are screened, and character information of fields such as brand names, first-level industry label names, the number of transaction records in the current week, the month to which the current week belongs, the week number in the current year, and the week number in the current month are selected as the data input to the model. Then, Embedding feature extraction is carried out. Specifically, the existing Embedding model RoBERTa is used to process the characters of each field in the data, vectorize the characters of each field, and then splice the vectorized features of each field to form a one-dimensional feature vector E that can uniquely represent the N merchants. Among them, the feature vector of the first merchant can be expressed as E1, the feature vector of the second merchant can be expressed as E2, and so on. Here, E1 is the first transaction feature of the first merchant in the first historical time period, and the same applies to others.
[0083] In this way, through the above feature extraction process, more comprehensive transaction features that can uniquely characterize each merchant can be obtained, and then more accurate training samples can be obtained.
[0084] In some embodiments, in S130, the graph neural network based on the merchant association graph can be a graph neural network constructed according to the merchant association graph. Among them, the graph neural network can be, for example, GNN (Graph Neural Network).
[0085] Exemplarily, the first transaction features corresponding to the N merchants can be input into the GNN based on the merchant association graph together, and then the GNN is used to extract information in each dimension of the merchant association graph, and the corresponding graph features are output. The graph features contain the features corresponding to each node, that is, the second transaction features corresponding to each merchant. Then, the second transaction feature corresponding to any training sample can be obtained from them, so as to perform the next transaction information prediction process for the training sample. Among them, the second transaction feature is the feature corresponding to the target training sample that contains the association relationship between merchants. This feature contains the influencing factors of other merchants on this merchant, and thus the influencing factors between merchants can be fully considered in the model training process, improving the accuracy and reliability of model training.
[0086] In addition, in some embodiments, after the above S110 and before S130, the training method of the transaction information prediction model provided by the embodiments of the present application may further include:
[0087] Construct an adjacency matrix according to the merchant association graph;
[0088] Construct the convolution kernel of the graph neural network based on the adjacency matrix to obtain the graph neural network based on the merchant association graph.
[0089] Exemplarily, as Figure 5Taking the merchant association relationship diagram shown as an example, the edge information between the corresponding nodes of each merchant can be converted into the distance information of the corresponding elements in the adjacency matrix, and then the merchant association relationship diagram can be converted into an adjacency matrix as shown on the left, using the adjacency matrix to represent the association relationship between nodes. Figure 7 The adjacency matrix shown on the left is used to represent the association relationship between nodes.
[0090] Based on this, after constructing the adjacency matrix, according to the convolution kernel formula of this graph neural network and substituting this adjacency matrix, a graph neural network based on the merchant association relationship diagram can be obtained.
[0091] To simplify the computational complexity in model training, the adjacency matrix can also be normalized. In some embodiments, after the step of constructing the adjacency matrix according to the merchant association relationship diagram and before the step of constructing the convolution kernel of the graph neural network based on the adjacency matrix, the training method of the transaction information prediction model provided by the embodiments of the present application may further include:
[0092] Normalize the adjacency matrix to obtain a normalized adjacency matrix.
[0093] Here, according to the formula:
[0094]
[0095] Each element \(a\) in the adjacency matrix \(A\) is respectively corresponding to be converted into the corresponding element \(\hat{a}\) in the normalized adjacency matrix ij to obtain the normalized adjacency matrix Here to obtain the normalized adjacency matrix For example, as shown Figure 7 The adjacency matrix on the left can be normalized to the adjacency matrix on the right according to the above formula (1).
[0096] In some specific examples, taking GNN as an example, its convolution kernel is:
[0097]
[0098] where \(H^{(l)}\) (l) represents the output of the \(l\)-th layer, \(H^{(l + 1)}\) (l+1) represents the output of the \((l + 1)\)-th layer, \(W^{(l)}\) (l) represents the learnable parameters introduced in the \(l\)-th layer, is the normalized adjacency matrix; here, the first transaction features corresponding to the \(N\) merchants extracted in the previous steps, that is, the total feature vector \(E\), can be used as the initial semantic feature vector of the nodes, that is, \(H^{(0)} = E\). Here, the semantic features of each point can be obtained by iterating the convolution kernel twice: (0) \(H^{(l+1)}=\sigma\left(D^{-\frac{1}{2}}\widetilde{A}D^{-\frac{1}{2}}H^{(l)}W^{(l)}\right)\)
[0099]
[0100] Among them, denotes the parameter W to be trained in the entire graph convolutional neural network (0) and W (1) , G represents the merchant association relationship graph, denotes the graph feature output after the feature vector E of the merchant passes through the GNN. This graph feature contains the features of each node corresponding to the merchant.
[0101] In addition, in some embodiments, in the above S140, the recurrent neural network can be, for example, a network with a GRU (Gate Recurrent Unit) structure. The transaction information can be information such as the transaction amount or the number of transaction records.
[0102] Exemplarily, after obtaining the second transaction feature corresponding to any one of the N training samples, for example, after the second transaction feature corresponding to the target training sample, the second transaction feature corresponding to the target training sample can be input into the GRU. Then, the GRU is used to predict the transaction amount of the merchant corresponding to the target training sample in the second historical time period based on the second transaction feature, and the predicted transaction amount corresponding to the target training sample is obtained. Similarly, the prediction process for the number of transaction records can also refer to the above process and will not be elaborated here.
[0103] It should be noted that here each of the N training samples can be sequentially used as the target training sample to execute the above prediction process of the transaction information, and then the predicted transaction information corresponding to each training sample can be obtained.
[0104] In some embodiments, in the above S150, a certain sample among the N training samples can be used as the target training sample, and the predicted transaction information corresponding to the target training sample is compared with its actual transaction information to calculate the corresponding loss value. Then, the network parameters of the graph neural network and the recurrent neural network are adjusted using the loss value. It is determined whether the two neural networks converge. In the case of non-convergence, another sample among the N training samples can be used as the target training sample to continue the above process until the two neural networks converge, and a transaction information prediction model based on the graph neural network and the recurrent neural network can be obtained, such as the gGRU model based on GNN and GRU.
[0105] In addition, in some possible embodiments, the first historical time period and the second historical time period each include M time cycles, and the second historical time period is one time cycle later than the first historical time period. Among them, the merchant corresponds to different first transaction features in different time cycles of the first historical time period, and M is an integer and M≥2.
[0106] Here, a time period can be, for example, one day, one week, one month, or one year, etc., and can be specifically set according to actual needs, which is not limited here.
[0107] For example, in the case where the time period is one week, if M = 4, and the first historical time period is the time period from the 1st to the 4th week, then the second historical time period can be the time period from the 2nd to the 5th week.
[0108] Based on this, as Figure 8 shown, step S130 in the embodiment of the present application can specifically include steps: S1301 - S1303, which will be explained in detail below.
[0109] S1301, associate the first transaction features corresponding to N merchants in the same time period of the first historical time period to obtain M associated features corresponding to the M time periods of the first historical time period respectively.
[0110] Here, since the transaction features corresponding to the same merchant in different time periods are not the same. For example, the first transaction features extracted from the first merchant in the 1st to 4th weeks can be Therefore, the first transaction features corresponding to N merchants in the same time period of the first historical time period can be associated to obtain the associated feature corresponding to this time period. For example, associate the feature corresponding to the first merchant in the 1st week with the feature corresponding to the second merchant in the 1st week ……, and the feature corresponding to the Nth merchant in the 1st week to obtain the associated feature E 1 , and similarly, the associated features corresponding to N merchants in other weeks can be obtained, and finally, the associated features E 1 , E 2 , E 3 , E 4 corresponding to N merchants in the 1st to 4th weeks can be obtained.
[0111] S1302, input the M associated features into the graph neural network based on the merchant association graph, and output the graph features corresponding to the N training samples in the M time periods of the first historical time period respectively.
[0112] Here, E 1 can be input into the graph neural network based on the merchant association graph. For example, use E 1 as the initial semantic feature vector of the nodes in the GNN convolution kernel, that is, H (0) = E. In this way, the graph features corresponding to the N training samples in the 1st week can be obtained.
[0113] Similarly, E2 and E 3 and E 4 They are respectively input into the graph neural network based on the merchant association relationship graph, and then the graph features corresponding to the N training samples in the second week, the graph features corresponding to the N training samples in the third week, and the graph features corresponding to the N training samples in the fourth week can be obtained.
[0114] S1303. From the graph features, obtain the sub-features corresponding to the target training sample in M time periods of the first historical time period, and obtain the second transaction feature corresponding to the target training sample, where the second transaction feature includes M sub-features respectively corresponding to the target training sample in M time periods of the first historical time period.
[0115] Here, after obtaining the graph features corresponding to each time period in the first historical time period, the sub-features corresponding to the target training sample in this time period can also be respectively obtained from each graph feature. For example, if the target training sample is a training sample including the first merchant, the sub-feature corresponding to the first merchant in the first week can be obtained from the graph feature corresponding to the first week, the sub-feature corresponding to the first merchant in the second week can be obtained from the graph feature corresponding to the second week, the sub-feature corresponding to the first merchant in the third week can be obtained from the graph feature corresponding to the third week, and the sub-feature corresponding to the first merchant in the fourth week can be obtained from the graph feature corresponding to the fourth week. Then, the sub-features corresponding to the four weeks are used as the second transaction feature corresponding to the first merchant.
[0116] In this way, by extracting graph features for each time period, the sub-features corresponding to the target training sample in different time periods within the first historical time period can be obtained, making the features more refined, so that the model can learn more refined features during the training process and improve the training accuracy of the model.
[0117] Based on this, in some embodiments, the above S140 may specifically include:
[0118] Arrange the M sub-features in the second transaction feature corresponding to the target training sample in the order of M time periods, where the M sub-features include the k-th sub-feature, k is an integer, and 1 ≤ k ≤ M;
[0119] When k = 1, input the k-th sub-feature in the arranged second transaction feature and the preset initial prediction information into the recurrent neural network, and use the recurrent neural network to predict the transaction information in the (k + 1)-th time period, and output the k-th prediction information corresponding to the k-th sub-feature;
[0120] When 2 ≤ k ≤ M, the k-th sub-feature in the sorted second transaction feature and the (k - 1)-th prediction information are input into a recurrent neural network, and the recurrent neural network is used to predict the transaction information in the (k + 1)-th time period, and the k-th prediction information corresponding to the k-th sub-feature is output, where the (k - 1)-th prediction information is the prediction information corresponding to the (k - 1)-th sub-feature;
[0121] The M prediction information corresponding to the M sub-features respectively are determined as the predicted transaction information corresponding to the target training sample.
[0122] In some specific examples, taking the target training sample as the training sample including the first merchant as an example, as Figure 9 shown, the associated features E 1 、E 2 、E 3 、E 4 corresponding to the N training samples in 4 time periods of the first historical time period are respectively input into the GNN in sequence, and then the sub-features corresponding to the first merchant are respectively extracted from the 4 graph features output, and then input into the GRU in sequence. Among them, the first sub-feature and the preset initial prediction information h0 can be input into the GRU together, and the prediction information corresponding to the 2nd time period is output, that is, the first prediction information h1; the second sub-feature and h1 are input into the GRU together, and the prediction information corresponding to the 3rd time period can be output, that is, the second prediction information h2, and so on, and the predicted transaction information h = [h1, h2, h3, h4] corresponding to the target training sample can be obtained. Here, the preset initial prediction information h0 can be set according to actual needs, and here it can be set to 0 for example.
[0123] In this way, through the above process, cyclic iterative prediction of multiple time periods can be realized, making the model training effect better, and the results predicted by the trained model can also be more accurate.
[0124] Based on this, in some embodiments, the above S150 may specifically include:
[0125] According to the M prediction information and the M actual information corresponding to the M prediction information in the actual transaction information, determine the cumulative loss value;
[0126] According to the cumulative loss value, train the graph neural network and the recurrent neural network until the graph neural network and the recurrent neural network converge to obtain a transaction information prediction model.
[0127] Here, when the predicted transaction information includes multiple prediction information, each prediction information can be respectively compared with its corresponding actual information, and then the cumulative loss value is determined.
[0128] Exemplarily, the cumulative loss value of the model can be calculated according to the loss function and then the parameters of the graph neural network and the recurrent neural network are adjusted through the backpropagation technique. When the cumulative loss value tends to 0, it indicates that the two neural networks have converged, and the training is stopped. Otherwise, other training samples among the N training samples are selected to continue the model training.
[0129] In this way, by calculating the cumulative loss value, the training intensity of the model can be improved, thereby further enhancing the training effect of the model.
[0130] In addition, the embodiment of the present application also provides a transaction information prediction method, which can be applied to the scenario of predicting the transaction information of merchants. First, the transaction information prediction method provided by the embodiment of the present application will be introduced below.
[0131] Figure 10 The flowchart of an embodiment of the transaction information prediction method provided by the present application is shown. As Figure 10 shown, the transaction information prediction method may specifically include the following steps:
[0132] S210, obtaining the third transaction features of N merchants within the target area range in the first time period, where N is an integer and N≥2;
[0133] S220, using the graph neural network based on the merchant association graph in the transaction information prediction model to obtain the fourth transaction feature corresponding to the target merchant according to the third transaction feature;
[0134] S230, according to the fourth transaction feature, using the recurrent neural network in the transaction information prediction model to predict the transaction information of the target merchant in the second time period respectively, and obtaining the predicted transaction information corresponding to the target merchant;
[0135] Wherein, the target merchant is any one of the N merchants, and the transaction information prediction model is trained according to the training method of the transaction information prediction model provided in any embodiment of the present application.
[0136] Here, the duration of the first time period is the same as the duration of the first historical time period during model training. For example, if the duration of the first historical time period is 1 week, the duration of the first time period is 1 week; if the duration of the first historical time period is 4 weeks, the duration of the first time period is 4 weeks. The second time period is the time period after the first time period.
[0137] It should be noted that when the transaction information prediction model is used, the transaction information of the merchant corresponding to any node in the merchant association graph included in it can be predicted. Therefore, when constructing the merchant association graph during the training process, the node information of the merchant to be predicted needs to be included.
[0138] Exemplarily, when the first time period is the 5th week and the second time period is the 6th week, that is, assuming that it is necessary to predict the transaction amount of the first merchant in the 6th week, it is necessary to input the feature vectors extracted from the data of the N merchants in the 5th week, that is, the third transaction feature, into the GNN in the transaction information prediction model. After obtaining the graph feature by output, extract the feature corresponding to the first merchant from the graph feature, that is, the fourth transaction feature, and then input the fourth transaction feature into the GRU of the transaction information prediction model, and the transaction amount of the first merchant corresponding to the 6th week can be output.
[0139] In this way, by using the transaction features extracted by the graph neural network based on the merchant association graph, the influencing factors between merchants can be added to the features, and then the recurrent neural network is used to predict the transaction information, so that the influencing factors between merchants can be fully considered during model prediction, thereby making the prediction result of the transaction information more accurate.
[0140] Based on this, in some embodiments, the first time period includes M time cycles, and the second time period is the (M + 1)th time cycle, where different third transaction features correspond to the merchant in different time cycles of the first time period, M is an integer and M≥2.
[0141] Different from the model training process, when the model is used, the predicted transaction information to be obtained is the predicted transaction information corresponding to the last time cycle. For example, when the first time period is from the 2nd to the 5th week, the second time period can be the 6th week.
[0142] Based on this, the above S220 may specifically include:
[0143] Associate the third transaction features corresponding to the N merchants in the same time cycle of the first time period to obtain M association features corresponding to the M time cycles of the first time period respectively;
[0144] Input the M association features into the graph neural network based on the merchant association graph in the transaction information prediction model respectively, and output the graph features corresponding to the N merchants in the M time cycles of the first time period respectively;
[0145] From the graph features, obtain the sub-features corresponding to the target merchant in the M time cycles of the first time period respectively, and obtain the fourth transaction feature corresponding to the target merchant, where the fourth transaction feature includes M sub-features corresponding to the target merchant in the M time cycles of the first time period respectively.
[0146] Here, the extraction process of the fourth transaction feature is similar to the extraction process of the second transaction in the foregoing embodiments, and will not be elaborated here.
[0147] Based on this, the above S230 may specifically include:
[0148] Arrange the M sub - features in the fourth transaction feature in the order of M time periods. Among them, the M sub - features include the r - th sub - feature, where r is an integer and 1 ≤ r ≤ M;
[0149] When r = 1, input the r - th sub - feature in the arranged fourth transaction feature and the preset initial prediction information into the recurrent neural network in the transaction information prediction model, and use the recurrent neural network to predict the transaction information in the (r + 1) - th time period, and output the r - th prediction information corresponding to the r - th sub - feature;
[0150] When 2 ≤ r ≤ M, input the r - th sub - feature in the arranged fourth transaction feature and the (r - 1) - th prediction information into the recurrent neural network, and use the recurrent neural network to predict the transaction information in the (r + 1) - th time period, and output the r - th prediction information corresponding to the r - th sub - feature, where the (r - 1) - th prediction information is the prediction information corresponding to the (r - 1) - th sub - feature;
[0151] Determine the M - th prediction information corresponding to the M - th sub - feature as the predicted transaction information of the target merchant.
[0152] In some specific examples, assume that it is necessary to predict the transaction amount of the first merchant in the 6th week. Then, it is necessary to input the merchants corresponding to all nodes in the merchant association relationship graph into the GNN, that is, N merchants, and the association features E 2 、E 3 、E 4 、E 5 , where E 2 represents the association feature of the data of the N merchants in the 2nd week, E 3 represents the association feature of the data of the N merchants in the 3rd week, and so on. Then, obtain the sub - features corresponding to the first merchant from the four graph features obtained by output respectively, and then input each sub - feature into the GRU in turn. The input and processing process is similar to that during model training and will not be elaborated here. Then, the predicted value h5 can be obtained, and h5 is the predicted transaction amount in the 6th week.
[0153] In this way, through the above process, cyclic iteration of multiple time periods can be realized, and finally the final prediction result can be obtained, making the result predicted by the model more accurate.
[0154] It should be noted that the application scenarios described in the embodiments of the present application above are for more clearly illustrating the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those of ordinary skill in the art can know that with the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.
[0155] Based on the same inventive concept, the present application also provides a training device for a transaction information prediction model. Specifically, it will be described in detail in combination with Figure 11 this.
[0156] Figure 11 FIG. shows a schematic structural diagram of an embodiment of the training device for the transaction information prediction model provided by the present application.
[0157] As Figure 11 shown, the training device 1100 for the transaction information prediction model may include:
[0158] A relationship graph generation module 1101, configured to generate a merchant association relationship graph according to the distances between N merchants within a target area range, where N is an integer and N≥2;
[0159] A sample generation module 1102, configured to obtain first transaction features of the N merchants respectively within a first historical time period, and actual transaction information of the N merchants respectively within a second historical time period, and generate N training samples;
[0160] A first acquisition module 1103, configured to use a graph neural network based on the merchant association relationship graph to obtain second transaction features respectively corresponding to the N training samples according to the first transaction features;
[0161] A first prediction module 1104, configured to respectively predict the transaction information of the N merchants within the second historical time period according to the second transaction features by using a recurrent neural network, and obtain predicted transaction information respectively corresponding to the N training samples;
[0162] A network training module 1105, configured to train the graph neural network and the recurrent neural network based on the predicted transaction information and the actual transaction information to obtain a transaction information prediction model.
[0163] The following will describe the training device 1100 for the transaction information prediction model in detail, as follows:
[0164] In some of the embodiments, the relationship graph generation module 1101 includes:
[0165] A graph construction sub-module, configured to construct a fully connected graph with the merchants as nodes and the distances as edges according to the distances between N merchants within the target area range;
[0166] A graph transformation sub-module, configured to transform the fully connected graph into the merchant association relationship graph according to a preset conversion method between the distance and the association degree, where the distance and the association degree are negatively correlated.
[0167] In some embodiments, the above-mentioned graph construction sub-module includes:
[0168] A construction unit, configured to construct an initial fully connected graph with the merchants as nodes and the distances as edges according to the distances between each merchant within the target area range;
[0169] A pruning unit, configured to delete the edges in the initial fully connected graph with distances less than a preset distance threshold and the nodes without edge connections, so as to obtain a fully connected graph corresponding to the N merchants.
[0170] In some embodiments, the above-mentioned training device 1100 of the transaction information prediction model further includes:
[0171] A matrix construction module, configured to construct an adjacency matrix according to the merchant association relationship graph after generating the merchant association relationship graph based on the distances between N merchants within the target area range and before obtaining the second transaction feature corresponding to the target training sample by using a graph neural network based on the merchant association relationship graph;
[0172] Construct a convolution kernel of the graph neural network based on the adjacency matrix to obtain a graph neural network based on the merchant association relationship graph.
[0173] In some embodiments, the above-mentioned training device 1100 of the transaction information prediction model further includes:
[0174] A normalization processing module, configured to normalize the adjacency matrix to obtain a standardized adjacency matrix after constructing the adjacency matrix according to the merchant association relationship graph and before constructing the convolution kernel of the graph neural network based on the adjacency matrix.
[0175] In some embodiments, the sample generation module 1102 includes:
[0176] An information acquisition sub-module, configured to acquire the merchant information, transaction data within the first historical time period, and time information corresponding to the first historical time period respectively corresponding to N merchants within the target area range;
[0177] A vectorization processing sub-module, configured to perform vectorization processing on the merchant information, the transaction data, and the time information, so as to obtain the first transaction features of the N merchants in the first historical time period respectively.
[0178] In some embodiments, the first historical time period and the second historical time period each include M time cycles, and the second historical time period is one time cycle later than the first historical time period. Wherein, the merchant corresponds to different first transaction features in different time cycles of the first historical time period, and M is an integer and M≥2.
[0179] In some embodiments, the first acquisition module 1103 includes:
[0180] A first association sub-module, configured to associate the first transaction features corresponding to the N merchants in the same time cycle of the first historical time period, so as to obtain M association features respectively corresponding to the M time cycles of the first historical time period;
[0181] A first output sub-module, configured to input the M association features into the graph neural network based on the merchant association graph respectively, and output the graph features respectively corresponding to the N training samples in the M time cycles of the first historical time period;
[0182] A first acquisition sub-module, configured to obtain, from the graph features, the sub-features corresponding to the target training sample in the M time cycles of the first historical time period, so as to obtain the second transaction features corresponding to the target training sample, where the second transaction features include M sub-features respectively corresponding to the M time cycles of the target training sample in the first historical time period.
[0183] In some embodiments, the network training module 1105 includes:
[0184] A first arrangement sub-module, configured to arrange the M sub-features in the second transaction features corresponding to the target training sample in the order of the M time cycles, where the M sub-features include the k-th sub-feature, k is an integer, and 1≤k≤M;
[0185] A first processing sub-module, configured to, when k = 1, input the k-th sub-feature in the arranged second transaction features and the preset initial prediction information into the recurrent neural network, and use the recurrent neural network to predict the transaction information in the (k + 1)-th time cycle, and output the k-th prediction information corresponding to the k-th sub-feature;
[0186] A second processing sub-module, configured to, when 2 ≤ k ≤ M, input the k-th sub-feature in the arranged second transaction features and the (k - 1)-th prediction information into the recurrent neural network, and use the recurrent neural network to predict the transaction information in the (k + 1)-th time period, and output the k-th prediction information corresponding to the k-th sub-feature, where the (k - 1)-th prediction information is the prediction information corresponding to the (k - 1)-th sub-feature;
[0187] A first determination sub-module, configured to determine the M prediction information respectively corresponding to the M sub-features as the predicted transaction information corresponding to the target training sample.
[0188] In some embodiments, the network training module 1105 includes:
[0189] A loss determination sub-module, configured to determine an accumulated loss value according to the M prediction information and the M actual information respectively corresponding to the M prediction information in the actual transaction information;
[0190] A training sub-module, configured to train the graph neural network and the recurrent neural network according to the accumulated loss value until the graph neural network and the recurrent neural network converge, and obtain a transaction information prediction model.
[0191] Thus, by generating a merchant association graph according to the distances between multiple merchants, and using the graph neural network based on the merchant association graph to obtain the second transaction features of the target training sample, in this way, the transaction features extracted by using this merchant association graph can incorporate the influencing factors between merchants into the features, and then use the recurrent neural network to predict the transaction information. By comparing the predicted transaction information and the actual transaction information to train the two neural networks, the trained transaction information prediction model can learn the influence of the distances between merchants on the transaction information, thereby improving the accuracy of the prediction result of the model for the merchant transaction information. In addition, since the embodiment of the present application also uses a model structure combining a graph neural network and a recurrent neural network to predict the transaction information, the convergence effect of the model can be improved during training, and the problem of overfitting can be avoided.
[0192] Based on the same inventive concept, the present application also provides a transaction information prediction device. Specifically, it is described in detail in combination with Figure 12 for detailed description.
[0193] Figure 12 FIG. shows a schematic structural diagram of an embodiment of the transaction information prediction device provided by the present application.
[0194] As Figure 12 shown, the transaction information prediction device 1200 may include:
[0195] The second acquisition module 1201 is configured to acquire third transaction features of N merchants within the target area respectively during a first time period, where N is an integer and N≥2;
[0196] The third acquisition module 1202 is configured to use the graph neural network based on the merchant association graph in the transaction information prediction model to obtain fourth transaction features corresponding to the target merchant according to the third transaction features;
[0197] The information prediction module 1203 is configured to predict the transaction information of the target merchant during a second time period respectively according to the fourth transaction features by using the recurrent neural network in the transaction information prediction model, and obtain predicted transaction information corresponding to the target merchant;
[0198] Wherein, the target merchant is any one of the N merchants, and the transaction information prediction model is trained according to the training method of the transaction information prediction model in any of the foregoing embodiments.
[0199] The above transaction information prediction device 1200 will be described in detail below, as specifically shown below:
[0200] In some embodiments, the first time period includes M time cycles, and the second time period is the (M + 1)-th time cycle, where the merchant corresponds to different third transaction features in different time cycles of the first time period, and M is an integer and M≥2.
[0201] In some embodiments, the third acquisition module 1202 includes:
[0202] The second association sub-module is configured to associate the third transaction features corresponding to the N merchants respectively in the same time cycle of the first time period to obtain M association features respectively corresponding to the M time cycles of the first time period;
[0203] The second output sub-module is configured to input the M association features into the graph neural network based on the merchant association graph in the transaction information prediction model respectively, and output graph features respectively corresponding to the N merchants in the M time cycles of the first time period;
[0204] The second acquisition sub-module is configured to obtain sub-features corresponding to the target merchant respectively in the M time cycles of the first time period from the graph features, and obtain fourth transaction features corresponding to the target merchant, where the fourth transaction features include M sub-features corresponding to the target merchant respectively in the M time cycles of the first time period.
[0205] In some of these embodiments, the information prediction module 1203 includes:
[0206] A second permutation sub-module, configured to permute M sub-features in the fourth transaction feature in the order of the M time periods, where the M sub-features include the r-th sub-feature, r is an integer, and 1 ≤ r ≤ M;
[0207] A third processing sub-module, configured to, when r = 1, input the r-th sub-feature in the permuted fourth transaction feature and the preset initial prediction information into the recurrent neural network in the transaction information prediction model, and use the recurrent neural network to predict the transaction information in the (r + 1)-th time period, and output the r-th prediction information corresponding to the r-th sub-feature;
[0208] A fourth processing sub-module, configured to, when 2 ≤ r ≤ M, input the r-th sub-feature in the permuted fourth transaction feature and the (r - 1)-th prediction information into the recurrent neural network, and use the recurrent neural network to predict the transaction information in the (r + 1)-th time period, and output the r-th prediction information corresponding to the r-th sub-feature, where the (r - 1)-th prediction information is the prediction information corresponding to the (r - 1)-th sub-feature;
[0209] A second determination sub-module, configured to determine the M-th prediction information corresponding to the M-th sub-feature as the predicted transaction information corresponding to the target merchant.
[0210] Thus, by using the transaction features extracted by the graph neural network based on the merchant association graph, the influencing factors between merchants can be added to the features, and then the recurrent neural network is used to predict the transaction information, so that the influencing factors between merchants can be fully considered during model prediction, thereby making the prediction result of the transaction information more accurate.
[0211] Figure 13 The hardware structure diagram of an embodiment of the electronic device provided by the present application is shown.
[0212] The electronic device 1300 may include a processor 1301 and a memory 1302 storing computer program instructions.
[0213] Specifically, the above-mentioned processor 1301 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.
[0214] The memory 1302 may include a mass memory for data or instructions. By way of example and not limitation, the memory 1302 may include a hard disk drive (HDD), a floppy disk drive, flash memory, an optical disc, a magneto-optical disc, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 1302 may include removable or non-removable (or fixed) media. Where appropriate, the memory 1302 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, the memory 1302 is a non-volatile solid-state memory.
[0215] The memory may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage media device, an optical storage media device, a flash memory device, an electrical, optical, or other physical / tangible memory storage device. Thus, in general, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present application.
[0216] The processor 1301 reads and executes the computer program instructions stored in the memory 1302 to implement the training method or the trading information prediction method of any one of the trading information prediction models in the above embodiments.
[0217] In some examples, the electronic device 1300 may further include a communication interface 1303 and a bus 1310. Among them, as Figure 13 shown, the processor 1301, the memory 1302, and the communication interface 1303 are connected through the bus 1310 and complete communication with each other.
[0218] The communication interface 1303 is mainly used to implement communication between the various modules, devices, units, and / or devices in the embodiments of the present application.
[0219] Bus 1310 includes hardware, software, or both, and couples the components of the online data flow metering device to each other. By way of example and not limitation, Bus 1310 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a MicroChannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable bus or a combination of two or more of these. Where appropriate, Bus 1310 may include one or more buses. Although the embodiments of the present application describe and illustrate specific buses, the present application contemplates any suitable bus or interconnect.
[0220] Exemplarily, the electronic device 1300 may be a mobile phone, a tablet computer, a laptop computer, a handheld computer, an in-vehicle electronic device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc.
[0221] The electronic device 1300 may execute the training method or the transaction information prediction method of the transaction information prediction model in the embodiments of the present application, so as to implement the combination of Figures 1 to 12 the training method and apparatus of the transaction information prediction model, or the transaction information prediction method and apparatus described.
[0222] In addition, in combination with the training method or the transaction information prediction method of the transaction information prediction model in the above embodiments, the embodiments of the present application may provide a computer-readable storage medium to implement. Computer program instructions are stored on the computer-readable storage medium; when the computer program instructions are executed by a processor, any one of the training methods or the transaction information prediction methods in the above embodiments is implemented. Examples of computer-readable storage media include non-transitory computer-readable storage media, such as a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, etc.
[0223] It should be clear that the present application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, the detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications, and additions, or change the order between steps after understanding the spirit of the present application.
[0224] The functional blocks shown in the above-described structural block diagrams can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (ASIC), appropriate firmware, a plug-in, a functional card, and so on. When implemented in software, the elements of the present application are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium or transmitted via a data signal carried in a carrier wave on a transmission medium or a communication link. A "machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical discs, hard disks, fiber optic media, radio frequency (RF) links, and so on. The code segment can be downloaded via a computer network such as the Internet, an intranet, and so on.
[0225] It should also be noted that the exemplary embodiments mentioned in the present application describe some methods or systems based on a series of steps or devices. However, the present application is not limited to the order of the above steps, that is, the steps can be executed in the order mentioned in the embodiments, or different from the order in the embodiments, or several steps can be executed simultaneously.
[0226] The various aspects of the present application have been described above with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present application. It should be understood that each block in the flowchart and / or block diagram, and the combination of blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing devices to produce a machine such that these instructions executed by the processor of the computer or other programmable data processing devices enable the implementation of the functions / actions specified in one or more blocks of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can also be implemented by dedicated hardware that performs the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0227] As described above, this is only the specific implementation manner of the present application. Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, modules, and units described above can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein. It should be understood that the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of various equivalent modifications or substitutions, and these modifications or substitutions should all be covered within the protection scope of the present application.
Claims
1. A training method for a transaction information prediction model, characterized in that, Including: Generating a merchant association graph according to the distances between N merchants within a target area, where N is an integer and N≥2; Constructing an adjacency matrix according to the merchant association graph; Constructing a convolution kernel of a graph neural network based on the adjacency matrix to obtain a graph neural network based on the merchant association graph; Obtaining first transaction features of the N merchants respectively in a first historical period and actual transaction information of the N merchants respectively in a second historical period, and generating N training samples; Using the graph neural network based on the merchant association graph to obtain second transaction features corresponding to a target training sample according to the first transaction features, where the target training sample is any one of the N training samples; According to the second transaction features, using a recurrent neural network to predict the transaction information of the merchant corresponding to the target training sample in the second historical period respectively, and obtaining predicted transaction information corresponding to the target training sample; Training the graph neural network and the recurrent neural network based on the predicted transaction information and the actual transaction information to obtain a transaction information prediction model; Wherein, the training the graph neural network and the recurrent neural network based on the predicted transaction information and the actual transaction information to obtain a transaction information prediction model includes: Determining an accumulated loss value according to M pieces of prediction information and M pieces of actual information respectively corresponding to the M pieces of prediction information in the actual transaction information, where the M pieces of prediction information are predicted transaction information corresponding to the target training sample; Training the graph neural network and the recurrent neural network according to the accumulated loss value until the graph neural network and the recurrent neural network converge to obtain a transaction information prediction model.
2. The method according to claim 1, wherein The generating a merchant association graph according to the distances between N merchants within a target area includes: Constructing a fully connected graph with the merchants as nodes and the distances as edges according to the distances between N merchants within the target area; Converting the fully connected graph into the merchant association graph according to a preset conversion method between the distance and the association degree, where the distance and the association degree are negatively correlated.
3. The method according to claim 2, characterized in that, The constructing a fully connected graph with the merchants as nodes and the distances as edges according to the distances between N merchants within the target area includes: Constructing an initial fully connected graph with the merchants as nodes and the distances as edges according to the distances between each pair of merchants within the target area; Deleting the edges with distances less than a preset distance threshold and the nodes without edges connected in the initial fully connected graph to obtain a fully connected graph corresponding to the N merchants.
4. The method according to claim 1, wherein After constructing the adjacency matrix according to the merchant association graph and before constructing the convolution kernel of the graph neural network based on the adjacency matrix, the method further includes: Normalizing the adjacency matrix to obtain a normalized adjacency matrix.
5. The method according to claim 1, wherein The obtaining first transaction features of the N merchants respectively in a first historical period includes: Obtain the merchant information, transaction data within the first historical time period, and time information corresponding to the first historical time period respectively for N merchants within the range of the target area; Perform vectorization processing on the merchant information, the transaction data, and the time information to obtain the first transaction features of the N merchants within the first historical time period respectively.
6. The method according to claim 1, characterized in that, The first historical time period and the second historical time period each include M time cycles, and the second historical time period is one time cycle later than the first historical time period. Among them, the merchant corresponds to different first transaction features in different time cycles of the first historical time period, and M is an integer and M≥2.
7. The method according to claim 6, characterized in that, The step of using the graph neural network based on the merchant association graph to obtain the second transaction features corresponding to the target training sample according to the first transaction features includes: Associate the first transaction features corresponding to the N merchants in the same time cycle of the first historical time period respectively to obtain M associated features corresponding to the M time cycles of the first historical time period respectively; Input the M associated features into the graph neural network based on the merchant association graph respectively, and output the graph features corresponding to the N training samples in the M time cycles of the first historical time period respectively; From the graph features, obtain the sub-features corresponding to the target training sample in the M time cycles of the first historical time period to obtain the second transaction features corresponding to the target training sample, where the second transaction features include M sub-features corresponding to the target training sample in the M time cycles of the first historical time period respectively.
8. The method according to claim 7, characterized in that, The step of using the recurrent neural network to predict the transaction information of the merchant corresponding to the target training sample in the second historical time period according to the second transaction features to obtain the predicted transaction information corresponding to the target training sample includes: Arrange the M sub-features in the second transaction features corresponding to the target training sample in the order of the M time cycles, where the M sub-features include the k-th sub-feature, k is an integer, and 1≤k≤M; When k = 1, input the k-th sub-feature in the arranged second transaction features and the preset initial prediction information into the recurrent neural network, and use the recurrent neural network to predict the transaction information in the (k + 1)-th time cycle, and output the k-th prediction information corresponding to the k-th sub-feature; When 2≤k≤M, input the k-th sub-feature in the arranged second transaction features and the (k - 1)-th prediction information into the recurrent neural network, and use the recurrent neural network to predict the transaction information in the (k + 1)-th time cycle, and output the k-th prediction information corresponding to the k-th sub-feature, where the (k - 1)-th prediction information is the prediction information corresponding to the (k - 1)-th sub-feature; Determine the M pieces of prediction information corresponding to the M sub-features respectively as the predicted transaction information corresponding to the target training sample.
9. A trading information prediction method, characterized in that, Including: Obtain the third transaction features of N merchants within the target area range respectively in the first time period, where N is an integer and N≥2; Using the graph neural network based on the merchant association graph in the transaction information prediction model, obtain the fourth transaction feature corresponding to the target merchant according to the third transaction feature; According to the fourth transaction feature, use the recurrent neural network in the transaction information prediction model to predict the transaction information of the target merchant in the second time period respectively, and obtain the predicted transaction information corresponding to the target merchant; Wherein, the target merchant is any one of the N merchants, and the transaction information prediction model is trained according to the method described in any one of claims 1-8.
10. The method according to claim 9, wherein The first time period includes M time cycles, and the second time period is the (M + 1)-th time cycle, wherein the merchant corresponds to different third transaction features in different time cycles of the first time period, and M is an integer and M≥2.
11. The method according to claim 10, wherein The using the graph neural network based on the merchant association graph in the transaction information prediction model to obtain the fourth transaction feature corresponding to the target merchant according to the third transaction feature includes: Associate the third transaction features corresponding to the N merchants respectively in the same time cycle of the first time period to obtain M associated features corresponding to the M time cycles of the first time period respectively; Input the M associated features into the graph neural network based on the merchant association graph in the transaction information prediction model respectively, and output the graph features corresponding to the N merchants respectively in the M time cycles of the first time period; From the graph features, obtain the sub-features corresponding to the target merchant respectively in the M time cycles of the first time period, and obtain the fourth transaction feature corresponding to the target merchant, wherein the fourth transaction feature includes M sub-features corresponding to the target merchant respectively in the M time cycles of the first time period.
12. The method according to claim 11, wherein The using the recurrent neural network in the transaction information prediction model to predict the transaction information of the target merchant in the second time period respectively according to the fourth transaction feature and obtain the predicted transaction information corresponding to the target merchant includes: Arrange the M sub-features in the fourth transaction feature in the order of the M time cycles, wherein the M sub-features include the r-th sub-feature, r is an integer, and 1≤r≤M; When r = 1, input the r-th sub-feature in the arranged fourth transaction feature and the preset initial prediction information into the recurrent neural network in the transaction information prediction model, and use the recurrent neural network to predict the transaction information in the (r + 1)-th time cycle, and output the r-th prediction information corresponding to the r-th sub-feature; When \(2\leq r\leq M\), the \(r\)-th sub-feature in the sorted fourth transaction feature and the \((r - 1)\)-th prediction information are input into the recurrent neural network, and the recurrent neural network is used to predict the transaction information in the \((r + 1)\)-th time period, and the \(r\)-th prediction information corresponding to the \(r\)-th sub-feature is output, where the \((r - 1)\)-th prediction information is the prediction information corresponding to the \((r - 1)\)-th sub-feature; The \(M\)-th prediction information corresponding to the \(M\)-th sub-feature is determined as the predicted transaction information corresponding to the target merchant.
13. A training device for a transaction information prediction model, characterized in that The device includes: A relationship graph generation module, configured to generate a merchant association relationship graph according to the distances between \(N\) merchants within a target area range, where \(N\) is an integer and \(N\geq2\); A matrix construction module, configured to construct an adjacency matrix according to the merchant association relationship graph; construct a convolution kernel of a graph neural network based on the adjacency matrix to obtain a graph neural network based on the merchant association relationship graph; A sample generation module, configured to obtain the first transaction features of the \(N\) merchants in the first historical time period respectively, and the actual transaction information of the \(N\) merchants in the second historical time period respectively, and generate \(N\) training samples; A first acquisition module, configured to use the graph neural network based on the merchant association relationship graph to obtain the second transaction features corresponding to the \(N\) training samples respectively according to the first transaction features; A first prediction module, configured to use a recurrent neural network to predict the transaction information of the \(N\) merchants in the second historical time period respectively according to the second transaction features, and obtain the predicted transaction information corresponding to the \(N\) training samples respectively; A network training module, configured to train the graph neural network and the recurrent neural network based on the predicted transaction information and the actual transaction information to obtain a transaction information prediction model; Wherein, the network training module includes: A loss determination sub-module, configured to determine an accumulated loss value according to \(M\) prediction information and \(M\) actual information corresponding to the \(M\) prediction information in the actual transaction information, where the \(M\) prediction information is the predicted transaction information corresponding to the target training sample; A training sub-module, configured to train the graph neural network and the recurrent neural network according to the accumulated loss value until the graph neural network and the recurrent neural network converge, and obtain a transaction information prediction model.
14. A trading information prediction device, characterized in that, The device includes: A second acquisition module, configured to obtain the third transaction features of \(N\) merchants within a target area range in the first time period respectively, where \(N\) is an integer and \(N\geq2\); A third acquisition module, configured to use the graph neural network based on the merchant association relationship graph in the transaction information prediction model to obtain the fourth transaction feature corresponding to the target merchant according to the third transaction feature; An information prediction module, configured to use the recurrent neural network in the transaction information prediction model to predict the transaction information of the target merchant in the second time period respectively according to the fourth transaction feature, and obtain the predicted transaction information corresponding to the target merchant; Among them, the target merchant is any one of the N merchants, and the transaction information prediction model is trained according to the method described in any one of claims 1-8.
15. An electronic device, characterized in that, The device includes: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, it implements the steps of the training method of the transaction information prediction model described in any one of claims 1-8 or the transaction information prediction method described in any one of claims 9-12.
16. A computer-readable storage medium, characterized in that, Computer program instructions are stored on the computer-readable storage medium, and when the computer program instructions are executed by the processor, they implement the steps of the training method of the transaction information prediction model described in any one of claims 1-8 or the transaction information prediction method described in any one of claims 9-12.
Citation Information
Patent Citations
Transaction information processing method and device
CN110175850A
Transaction feature prediction method and device, server and readable storage medium
CN110246037A