Interaction prediction model training method and device, equipment and storage medium
By optimizing the interaction prediction model of graph neural networks with time features and interval encoding, the problem of the impact of time changes on interaction relationships was not considered, which improved the accuracy and robustness of the model and made it adaptable to data with different sampling intervals.
Patent Information
- Application Number
- CN202511917194.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-18
- Publication Date
- 2026-01-13
AI Technical Summary
Existing graph neural networks fail to effectively consider the impact of time changes on interaction relationships in interaction prediction, resulting in insufficient robustness and accuracy.
Multiple training interaction pair sequences are generated by sampling the original interaction pair sequences at different sampling intervals. The interaction probability is calculated using the time feature matrix and the interval encoding matrix. The interaction prediction model is then optimized based on the loss value until the training requirements are met.
It improves the accuracy and robustness of the interactive prediction model, enhances its adaptability to heterogeneous sampling interval data, and improves its generalization ability.
Smart Images

Figure CN121328646A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of graph neural network, and particularly relate to a training method and device of an interaction prediction model, an apparatus and a storage medium. BACKGROUND
[0002] Graph Neural Networks (GNNs) learn feature representations of interaction pair sequences from a knowledge graph, and implement interaction prediction in multiple scenarios such as social networks and recommendation systems based on the learned deep representations.
[0003] In related technologies, most graph neural networks determine interaction information in a static interaction pair sequence through a simple weight mechanism. However, this approach does not consider the influence of time changes on interaction relationships, and is difficult to accurately capture the deep representations of topological association relationships between nodes in a knowledge graph and the time evolution dimension, thereby reducing the robustness and accuracy of the interaction prediction model. SUMMARY
[0004] Embodiments of the present application provide a training method, device, apparatus and storage medium of an interaction prediction model, for improving the robustness and accuracy of the interaction prediction model.
[0005] In one aspect, the present application provides a training method of an interaction prediction model, which comprises: sampling an original interaction pair sequence at different sampling intervals to obtain a plurality of training interaction pair sequences; For each training interaction pair sequence, determining a first time feature matrix based on the timestamp of the source node in each interaction pair in the training interaction pair sequence and the verification prediction time; determining a first interaction probability of the source node and any interaction node at the verification prediction time based on the first time feature matrix and an interval encoding matrix corresponding to the sampling interval of the training interaction pair sequence; determining a first loss value of the training interaction pair sequence based on the first interaction probability, the actual interaction between the source node and any interaction node at the verification prediction time; determining a comprehensive loss value of the current round of iterative training based on the first loss value of each training interaction pair sequence; optimizing the interaction prediction model according to the comprehensive loss value until the training requirements are met.
[0006] Optionally, the sampling of the original interaction pair sequence at different sampling intervals to obtain a plurality of training interaction pair sequences comprises: dividing the length of the original interaction pair sequence into a plurality of time intervals based on any sampling interval; merge same interaction pairs in the same time interval to obtain an interval interaction pair sequence, the same interaction pair being an interaction pair with same interaction nodes; obtain a training interaction pair sequence corresponding to the sampling interval based on the plurality of interval interaction pair sequences.
[0007] Optionally, the determining the first time feature matrix based on the timestamp of each interaction pair of the source node in the training interaction pair sequence and the validation prediction moment comprises: determining a first time feature of the interaction pair of the source node based on a difference between the timestamp of the interaction pair and the validation prediction moment; encoding the first time features of the plurality of interaction pairs of the source node into a first time feature matrix.
[0008] Optionally, the encoding the first time features of the plurality of interaction pairs of the source node into a first time feature matrix comprises: encoding the first time features of the plurality of interaction pairs of the source node by a sine function to obtain the first time feature matrix; the interval encoding matrix is obtained by encoding the sampling interval by a sine function.
[0009] Optionally, the different sampling intervals are generated in an exponential manner; dividing a time length of the original interaction pair sequence into a plurality of time intervals comprises: dividing the time length of the original interaction pair sequence into a plurality of time buckets in a time bucket as a time unit; mapping the timestamp of each interaction pair in the original interaction pair sequence into a time bucket to obtain the interaction pairs in each time bucket.
[0010] Optionally, the method further comprises: determining a second time feature matrix based on the timestamp of each interaction pair of the target node in the training interaction pair sequence and the validation prediction moment; determining a common interaction node from the plurality of interaction pairs of the source node and the plurality of interaction pairs of the target node; determining a second interaction probability of the source node and the target node at the validation prediction moment based on the first time feature matrix, the second time feature matrix, an interval encoding matrix corresponding to the sampling interval of the training interaction pair sequence, and the common interaction node; determining a second loss value of the training interaction pair sequence based on the second interaction probability and an actual interaction condition of the source node and the target node at the validation prediction moment; The determination of the comprehensive loss value for this round of iterative training based on the first loss value of each training interaction pair sequence includes: The comprehensive loss value for this round of iterative training is determined based on the first loss value and the second loss value of each training interaction pair sequence.
[0011] Optionally, based on the second time feature matrix and the interval encoding matrix corresponding to the sampling interval of the training interaction pair sequence, a third interaction probability between the target node and any interaction node is determined at the verification prediction time. Based on the third interaction probability and the actual interaction between the target node and any interaction node at the verification prediction time, the third loss value of the training interaction pair sequence is determined. The determination of the comprehensive loss value for this round of iterative training based on the first loss value and the second loss value of each training interaction pair sequence includes: The comprehensive loss value for this round of iterative training is determined based on the first loss value, the second loss value, and the third loss value of each training interaction pair sequence.
[0012] Optionally, after optimizing the interactive prediction model based on the comprehensive loss value until the training requirements are met, the process further includes: The sequence of interaction pairs to be predicted, the source node to be predicted and the target node to be predicted in the sequence of interaction pairs to be predicted are input into the interaction prediction model; Obtain the fourth interaction probability of the source node to be predicted and the target node to be predicted at the application prediction time.
[0013] On one hand, embodiments of this application provide a training apparatus for an interactive prediction model, the apparatus comprising: The sampling module is used to sample the original interaction pair sequence at different sampling intervals to obtain multiple training interaction pair sequences; The training module is used to determine a first temporal feature matrix for each training interaction pair sequence based on the timestamp of each interaction pair in the training interaction pair sequence and the verification prediction time of the source node; determine a first interaction probability between the source node and any interaction node at the verification prediction time based on the first temporal feature matrix and the interval encoding matrix corresponding to the sampling interval of the training interaction pair sequence; and determine a first loss value of the training interaction pair sequence based on the first interaction probability and the actual interaction between the source node and any interaction node at the verification prediction time. The optimization module is used to determine the comprehensive loss value for the current round of iterative training based on the first loss value of each training interaction pair sequence; and to optimize the interaction prediction model according to the comprehensive loss value until the training requirements are met.
[0014] Optionally, the sampling module is specifically used for: Based on any sampling interval, the duration of the original interaction pair sequence is divided into multiple time intervals; For any time interval, identical interaction pairs within the time interval are merged to obtain an interval interaction pair sequence; the identical interaction pairs are those with the same interaction nodes. Based on multiple interval interaction pair sequences, the training interaction pair sequence corresponding to the sampling interval is obtained.
[0015] Optionally, the training module is specifically used for: For any interaction pair of the source node, a first temporal feature of the interaction pair of the source node is determined based on the difference between the timestamp of the interaction pair and the verification prediction time. The first time features of each of the multiple interaction pairs of the source node are encoded into a first time feature matrix.
[0016] Optionally, the training module is specifically used for: The first-time feature matrix is obtained by encoding the first-time features of each of the multiple interactions of the source node using a sine function. The interval coding matrix is obtained by encoding the sampling interval using a sine function.
[0017] Optionally, the different sampling intervals are generated exponentially; the sampling module is specifically used for: The duration of the original interaction pair sequence is divided into multiple time buckets, using time buckets as the time unit. The timestamps of each interaction pair in the original interaction pair sequence are mapped to time buckets to obtain the interaction pairs in each time bucket.
[0018] Optionally, the training module is further configured to: A second time feature matrix is determined based on the timestamp of each interaction pair in the training interaction pair sequence of the target node and the verification prediction time. From the multiple interaction pairs of the source node and the multiple interaction pairs of the target node, determine the common interaction node; Based on the first time feature matrix, the second time feature matrix, the interval encoding matrix corresponding to the sampling interval of the training interaction pair sequence, and the common interaction node, the second interaction probability between the source node and the target node at the verification prediction time is determined; Based on the second interaction probability and the actual interaction between the source node and the target node at the verification prediction time, the second loss value of the training interaction pair sequence is determined; The determination of the comprehensive loss value for this round of iterative training based on the first loss value of each training interaction pair sequence includes: The comprehensive loss value for this round of iterative training is determined based on the first loss value and the second loss value of each training interaction pair sequence.
[0019] Optionally, the training module is further configured to: Based on the second time feature matrix and the interval encoding matrix corresponding to the sampling interval of the training interaction pair sequence, the third interaction probability between the target node and any interaction node at the verification prediction time is determined. Based on the third interaction probability and the actual interaction between the target node and any interaction node at the verification prediction time, the third loss value of the training interaction pair sequence is determined. The determination of the comprehensive loss value for this round of iterative training based on the first loss value and the second loss value of each training interaction pair sequence includes: The comprehensive loss value for this round of iterative training is determined based on the first loss value, the second loss value, and the third loss value of each training interaction pair sequence.
[0020] Optionally, the optimization module is further configured to: The sequence of interaction pairs to be predicted, the source node to be predicted and the target node to be predicted in the sequence of interaction pairs to be predicted are input into the interaction prediction model; Obtain the fourth interaction probability of the source node to be predicted and the target node to be predicted at the application prediction time.
[0021] On one hand, embodiments of this application provide a computer device, including: Memory, used to store program instructions; The processor is used to call the program instructions stored in the memory and execute the steps of the training method of the above-mentioned interactive prediction model according to the obtained program.
[0022] On one hand, embodiments of this application provide a computer-readable storage medium storing a computer program executable by a computer device, which, when run on the computer device, causes the computer to perform the steps of the training method for the above-described interactive prediction model.
[0023] On one hand, embodiments of this application provide a computer program product, including a computer program stored on a computer-readable storage medium, the computer program including program instructions, which, when executed by a computer device, cause the computer device to perform the steps of the above-described interactive prediction model training method.
[0024] In this embodiment, the original interaction pair sequence is sampled at different sampling intervals to obtain multiple training interaction pair sequences. For each training interaction pair sequence, a first temporal feature matrix is determined based on the timestamp of each interaction pair in the training interaction pair sequence and the verification prediction time of the source node. Based on the first temporal feature matrix and the interval encoding matrix corresponding to the sampling interval of the training interaction pair sequence, the first interaction probability between the source node and any interaction node at the verification prediction time is determined, overcoming the defect of relying solely on static weighting mechanisms to obtain interaction information in the prior art and improving the accuracy of the interaction prediction model. Based on the first interaction probability and the actual interaction between the source node and any interaction node at the verification prediction time, a first loss value of the training interaction pair sequence is determined. Based on the first loss value of each training interaction pair sequence, the comprehensive loss value of this round of iterative training is determined. The interaction prediction model is optimized according to the comprehensive loss value until the training requirements are met. By optimizing the training interaction pair sequences with different sampling intervals, the interaction prediction model maintains stable performance on training data with heterogeneous sampling intervals, improving the generalization ability and robustness of the interaction prediction model. Attached Figure Description
[0025] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 A schematic diagram of a system architecture provided in an embodiment of this application; Figure 2 A flowchart illustrating a training method for an interactive prediction model provided in this application embodiment. Figure 1 ; Figure 3 A flowchart illustrating a training method for an interactive prediction model provided in this application embodiment. Figure 2 ; Figure 4 A flowchart illustrating a training method for an interactive prediction model provided in this application embodiment. Figure 3 ; Figure 5 A flowchart illustrating a training method for an interactive prediction model provided in this application embodiment. Figure 4 ; Figure 6 A schematic diagram of the structure of a training device for an interactive prediction model provided in an embodiment of this application; Figure 7 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0027] To make the objectives, technical solutions, and beneficial effects of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without inventive effort are within the scope of protection of this invention.
[0028] It should be noted that the brief descriptions of terms in this application are only for the convenience of understanding the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise stated, these terms should be understood in their ordinary and common meaning.
[0029] The terms "first," "second," "third," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar or related objects or entities, and do not necessarily imply a specific order or sequence, unless otherwise specified. It should be understood that such terms are interchangeable where appropriate.
[0030] The terms “comprising” and “having”, and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device that includes a range of components is not necessarily limited to all of the components that are clearly listed, but may include other components that are not clearly listed or that are inherent to such product or device.
[0031] The term "module" refers to any known or subsequently developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code that is capable of performing the functions associated with that element.
[0032] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
[0033] The following is a brief introduction to the system architecture diagram applicable to the technical solutions of the embodiments of this application. It should be noted that the process described below is only for illustrating the embodiments of this application and is not intended to limit the scope of the application.
[0034] refer to Figure 1This is a system architecture diagram applicable to the embodiments of this application. The system architecture includes at least terminal device 101 and server 102. The number of terminal devices 101 can be one or more, and the number of servers 102 can also be one or more. This application does not specifically limit the number of terminal devices 101 and servers 102.
[0035] The terminal device 101 has a pre-installed application for model interaction or training, which can be a client application, a web application, a mini-program application, etc. The terminal device 101 can be a smartphone, tablet, laptop, desktop computer, smart home appliance, smart voice interaction device, smart vehicle device, etc., but is not limited to these.
[0036] Server 102 is the backend server of the application. Server 102 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms, but it is not limited to these.
[0037] It should be noted that the method in this embodiment can be executed by the terminal device 101 or the server 102 alone, or by the terminal device 101 and the server 102 together.
[0038] In this embodiment, the terminal device 101 and the server 102 can communicate directly or indirectly through one or more networks. The network can be a wired network or a wireless network; for example, the wireless network can be a mobile cellular network or a Wireless-Fidelity (WIFI) network, or other possible networks. This embodiment does not limit the types of networks used.
[0039] The following is based on Figure 1 The system architecture diagram shown illustrates the flowchart of a training method for an interactive prediction model provided in this application embodiment. This method can be implemented by... Figure 1 The execution can be performed by the terminal device 101 shown, or by the server 102, or by interaction between the terminal device 101 and the server 102, as shown. Figure 2 As shown, it includes the following steps: Step 201: Sample the original interaction pair sequence at different sampling intervals to obtain multiple training interaction pair sequences.
[0040] Specifically, the original interaction sequence is the time-series graph dataset. A time-series graph refers to a graph in which edges (interaction relationships) or nodes have time-dimensional information, and this time information participates in graph structure analysis as a dynamic variable. In the embodiments of this application, the original interaction sequence can be a time-series graph dataset from different domains, and the nodes can be user nodes or functional nodes of any online platform with interpersonal interaction functions in different domains. For example, if the time-series graph dataset comes from a consulting website, the interaction represents a user node answering a question from another node; if the time-series graph dataset comes from an online education platform, the interaction represents a student node subscribing to a course node, or a student node communicating with another student node; if the time-series graph dataset comes from an online music platform, the interaction represents a user node listening to a song node; if the time-series graph dataset comes from an internal enterprise system, the interaction represents an employee node sending and receiving emails with another employee node; if the time-series graph dataset comes from a forum website, the interaction represents a user node making a posting request in a sub-forum node; if the time-series graph dataset comes from a public social platform, the interaction represents a user node browsing comment nodes or post nodes.
[0041] Furthermore, the different sampling intervals are increasing numerical values, which can be arithmetic progression or exponential progression. This application does not specifically limit this. For example, if the sampling interval is exponentially increasing, the specific formula for the sampling interval is as shown in the following formula (1): (1) in, Let represent the i-th sampling interval; b is a base greater than 1; D is the number of sampling intervals.
[0042] In some embodiments, the duration of the original interaction pair sequence is divided into multiple time intervals based on any sampling interval; for any time interval, the same interaction pairs in the time interval are merged to obtain an interval interaction pair sequence; based on multiple interval interaction pair sequences, the training interaction pair sequence corresponding to the sampling interval is obtained.
[0043] In some embodiments, the duration of the original interaction pair sequence is divided into multiple time buckets, using time buckets as the time unit; the timestamps of each interaction pair in the original interaction pair sequence are mapped to time buckets to obtain the interaction pairs in each time bucket.
[0044] Specifically, identical interaction pairs are those with the same interaction nodes. For any sampling interval, the duration of the original interaction pair sequence is divided into multiple time buckets based on the sampling interval, and the duration of any time bucket is the sampling interval; if the timestamp of each interaction pair in the original interaction pair sequence is mapped to the corresponding time bucket, then the interaction pairs in each time bucket are obtained. For multiple interaction pairs in a time bucket, if the interaction nodes of multiple interaction pairs are the same, then the multiple interaction pairs are merged to obtain one interaction pair. The specific calculation formula is shown in the following formula (2): (2) in, This represents a sequence of training interaction pairs with a sampling interval of s; This represents an interaction node in an interaction pair; This represents another interaction node in the interaction pair; t represents the timestamp of the interaction pair. This represents the original interaction pair sequence.
[0045] For example, if the original interaction pair sequence consists of one interaction pair per second, totaling 1000 interaction pairs, with a sampling interval of 100 seconds, then the 1000-second duration of the original interaction pair sequence is divided into 10 time buckets: [1,100], [101,200], [201,300], ..., [901,1000]. If an interaction pair occurs at the 75th second, then 75 / 100 = 0.75, meaning the interaction pair is located in the first time bucket [1,100]. If an interaction pair occurs at the 125th second, then 125 / 100 = 1.25, meaning the interaction pair is located in the second time bucket [101,200].
[0046] If multiple interaction pairs have the same two interaction nodes within the same time bucket, the average or median timestamps of the multiple interaction pairs are calculated to merge the multiple interaction pairs into one interaction pair.
[0047] For example, if there is an interaction pair AB in a certain time bucket (such as [101,200]), there is also an interaction pair AB in the 101st second, and there is still an interaction pair AB in the 127th second, then calculate (101+127+189) / 3=139, that is, merge three interaction pairs with different timestamps but the same interaction node in the same time bucket into one interaction pair, and the timestamp of the merged interaction pair is the 139th second.
[0048] In the embodiments of this application, multiple interaction pairs in each training interaction pair time series are determined by the corresponding sampling interval to determine the time bucket. Identical interaction pairs in the same time bucket are merged. Therefore, the number of interaction pairs and the timestamps of occurrence in different training interaction pair time series are different, so that the subsequent interaction prediction model can learn the interaction information of different sampling intervals and improve the robustness of the interaction prediction model.
[0049] Step 202: For each training interaction pair sequence, determine the first temporal feature matrix based on the timestamp of each interaction pair of the source node in the training interaction pair sequence and the verification prediction time; determine the first interaction probability between the source node and any interaction node at the verification prediction time based on the first temporal feature matrix and the interval encoding matrix corresponding to the sampling interval of the training interaction pair sequence; determine the first loss value of the training interaction pair sequence based on the first interaction probability and the actual interaction between the source node and any interaction node at the verification prediction time.
[0050] Specifically, for any training interaction pair sequence, multiple interaction pairs of the source node are sampled from it, and the specific formula for sampling is shown in the following formula (3): (3) in, Indicates the source node Multiple interaction pairs in the sequence; Represents the original interaction pair sequence Any interaction pair in; This represents two nodes in an interaction pair. and One of them is the source node. u And the timestamp of the interaction pair At the moment of verification prediction activation t Before.
[0051] In some embodiments, for any interaction pair of the source node, a first temporal feature of the interaction pair of the source node is determined based on the difference between the timestamp of the interaction pair and the verification prediction time; the first temporal features of each of the multiple interaction pairs of the source node are encoded into a first temporal feature matrix.
[0052] Specifically, the verification prediction time is a series of consecutive moments, including the verification prediction start time and multiple verification prediction interaction times. The difference between the timestamp of each interaction pair and the verification prediction start time is calculated, and the difference of each interaction pair of the source node is used as the first temporal feature matrix between the source node and the interaction nodes of the interaction pair.
[0053] It should be noted that the first-time feature matrix can be a single row with multiple columns or multiple rows with a single column, representing only the interaction pairs between the source node and multiple interacting nodes. For example, the first-time feature matrix is... Where L represents the number of interaction pairs of the source nodes, and dT is adjustable. That is, the first-time feature matrix can be a matrix with one row and L columns, or a matrix with L rows and one column, and the source nodes are represented by rows or columns with dimension 1. Similarly, since the training objects (or the verification prediction objects) in this embodiment are source nodes and target nodes, any matrix is a single-row, multi-column or multi-column, single-row matrix, but the forms of multiple different matrices of the same training interaction pair sequence need to be aligned.
[0054] In some embodiments, the first time-time features of each of the multiple interactions of the source node are encoded by a sine function to obtain a first time-time feature matrix; the interval coding matrix is obtained by encoding the sampling interval by a sine function.
[0055] In the embodiments of this application, the time feature matrix, the interval coding matrix, and other matrices are all obtained by sine function coding.
[0056] Furthermore, for any training interaction pair sequence, the first 50% (i.e., the first L / 2 subsequence of the training interaction pair sequence) is used only for training according to the timestamp, and the last 50% (i.e., the last L / 2 subsequence of the training interaction pair sequence) is used as the verification and prediction phase of the training phase. That is, the verification and prediction start time is the time when the timestamps of the multiple interaction pairs of the source node are at the half position.
[0057] refer to Figure 3 The source node has 8 interaction pairs. When the sampling interval s=1, the information from interaction pair 1, interaction pair 2, interaction pair 3, and interaction pair 4 is integrated into the input feature representation. The model's self-supervised module is based on the input feature representation. Predicting the output feature representation The output feature representation is the feature representation of the prediction interaction pairs of the source node at the verification prediction start time and multiple verification prediction interaction times. When the sampling interval s=2, interaction pair 1 and interaction pair 2 are merged into a first interaction pair, and interaction pair 3 and interaction pair 4 are merged into a second interaction pair. The various information of the first interaction pair and the second interaction pair are integrated into the input feature representation. The model's self-supervised module (single predictor) is based on the input feature representation. Predicting the output feature representation The output features are represented as the feature representations of the prediction interaction pairs of the source node at the start of the verification prediction and at multiple verification prediction interaction times. The granularity of the verification prediction time varies depending on the sampling interval of the training interaction pair sequence, for example... Figure 3 When the sampling interval s=1, there are 4 verification prediction times; while when the sampling interval s=2, there are 2 verification prediction times.
[0058] The mean squared error loss of the source node is calculated using the following formula (4): (4) in, Indicates the sampling interval The training interaction affects the mean squared error loss of the source node in the sequence; Feature representation of the predicted interaction pair of the source node; The feature representation of the true interaction pair of the source node is obtained from the interaction pairs in the subsequent L / 2 subsequence. It should be noted that the first loss value can be calculated based on the feature representation of the predicted interaction pair and the feature representation of the true interaction pair at the time of verification prediction, or the mean squared error loss can be calculated based on the first interaction probability of the predicted interaction pair and the true interaction probability of the true interaction pair (the true interaction probability is 0 or 1) at the time of verification prediction.
[0059] The mean squared error loss of multiple training interaction pairs is integrated into the first loss value of the source node using the following formula (5): (5) in, This represents the first loss value of the source node; Indicates the sampling interval is The training interaction affects the mean squared error loss of the source node in the sequence.
[0060] In this embodiment, by performing a self-supervised task on the source nodes, the interaction prediction model learns the evolution of the interaction pairs of the source nodes over time under different sampling intervals. This enables the model to maintain excellent performance even when faced with multiple datasets with different sampling intervals or the same dataset with disordered sampling intervals, thereby improving the generalization ability and robustness of the interaction prediction model.
[0061] Step 203: Based on the first loss value of each training interaction pair sequence, determine the comprehensive loss value for this round of iterative training; optimize the interaction prediction model according to the comprehensive loss value until the training requirements are met.
[0062] In this embodiment, the original interaction pair sequence is sampled at different sampling intervals to obtain multiple training interaction pair sequences. For each training interaction pair sequence, a first temporal feature matrix is determined based on the timestamp of each interaction pair in the training interaction pair sequence and the verification prediction time of the source node. Based on the first temporal feature matrix and the interval encoding matrix corresponding to the sampling interval of the training interaction pair sequence, the first interaction probability between the source node and any interaction node at the verification prediction time is determined, overcoming the defect of relying solely on static weighting mechanisms to obtain interaction information in the prior art and improving the accuracy of the interaction prediction model. Based on the first interaction probability and the actual interaction between the source node and any interaction node at the verification prediction time, a first loss value of the training interaction pair sequence is determined. Based on the first loss value of each training interaction pair sequence, the comprehensive loss value of this round of iterative training is determined. The interaction prediction model is optimized according to the comprehensive loss value until the training requirements are met. By optimizing the training interaction pair sequences with different sampling intervals, the interaction prediction model maintains stable performance on training data with heterogeneous sampling intervals, improving the generalization ability and robustness of the interaction prediction model.
[0063] In some embodiments, a second temporal feature matrix is determined based on the timestamp of each interaction pair in the training interaction pair sequence and the verification prediction time of the target node; common interaction nodes are determined from multiple interaction pairs of the source node and multiple interaction pairs of the target node; a second interaction probability between the source node and the target node at the verification prediction time is determined based on the first temporal feature matrix, the second temporal feature matrix, the interval encoding matrix corresponding to the sampling interval of the training interaction pair sequence, and the common interaction nodes; a second loss value of the training interaction pair sequence is determined based on the second interaction probability and the actual interaction between the source node and the target node at the verification prediction time; and a comprehensive loss value for this round of iterative training is determined based on the first loss value and the second loss value of each training interaction pair sequence.
[0064] Specifically, for each training interaction pair sequence, the second temporal feature matrix of the target node is obtained using the same method described above. From multiple interaction pairs of the source node and multiple interaction pairs of the target node, common interaction nodes that interact with both the source and target nodes are identified. The number of times these common interaction nodes appear in multiple interaction pairs of the target node is calculated, and this number is encoded into a two-dimensional counting matrix using a sine coding function. Based on the first temporal feature matrix, the interval coding matrix of the source node in the training interaction pair sequence, the second temporal feature matrix, the interval coding matrix of the source node in the training interaction pair sequence, and the counting matrix, the interaction probabilities of the source and target nodes at the verification prediction time are learned and verified. The mean squared error loss is calculated based on the predicted second interaction probability and the true probability. The mean squared error losses of the source and target node interaction verification predictions for multiple training interaction pair sequences are summed to obtain the second loss value for each training interaction pair sequence. The interaction prediction model is then optimized based on the first and second loss values.
[0065] refer to Figure 4 Under the same training interaction pair sequence, obtain 3 interaction pairs of source node M. The timestamp of the interaction pair with interaction node 1 is t1, the timestamp of the interaction pair with interaction node 2 is t2, and the timestamp of the interaction pair with interaction node 1 is t3. Then, based on the verification prediction start time, determine the first temporal feature matrix of the source node as follows: The sampling interval is encoded as Obtain three interaction pairs of the target node N. The timestamp of the interaction pair with node 2 is t4, the timestamp of the interaction pair with node 3 is t5, and the timestamp of the interaction pair with node 4 is t6. Based on the verification prediction start time, determine the first temporal feature matrix of the source node as follows: The sampling interval is encoded as If the number of times that common interaction nodes 2 and 3 appear in multiple interaction pairs of target node N is 1, then the counting matrix is [1, 1].
[0066] In some embodiments, based on the second time feature matrix and the interval encoding matrix corresponding to the sampling interval of the training interaction pair sequence, a third interaction probability between the target node and any interaction node at the verification prediction time is determined; based on the third interaction probability and the actual interaction between the target node and any interaction node at the verification prediction time, a third loss value for the training interaction pair sequence is determined; based on the first loss value of each training interaction pair sequence, the second loss value of each training interaction pair sequence, and the third loss value of the training interaction pair sequence, a comprehensive loss value for this round of iterative training is determined.
[0067] Specifically, the source node and the target node are the target interaction pairs determined during the training phase for learning and validating predictions. For the same training interaction pair sequence, the self-supervised module verifies the third interaction probability of multiple interaction pairs of the target node at the verification prediction time based on the second temporal feature matrix and the interval encoding matrix corresponding to the sampling interval. The mean squared error loss is calculated based on the third interaction probability and the true interaction probability (0 or 1) of the target node at the verification prediction time. The mean squared error loss of the target node in multiple training interaction pair sequences is summed to obtain the third loss value of the training interaction pair sequence.
[0068] Based on the first loss value, the second loss value, and the third loss value of each training interaction pair sequence, the comprehensive loss value for this round of iterative training is determined, and the interaction prediction model is optimized based on the comprehensive loss value.
[0069] The iterative training stops when the number of iterations of the interactive prediction model reaches the number of prediction training iterations or when the comprehensive loss value meets the training requirements.
[0070] In the embodiments of this application, for any training interaction pair sequence, the interaction of the source node itself, the interaction of the target node, and the link interaction between the source node and the target node are verified and predicted respectively. By implementing cross-interval prediction tasks for different prediction objects, the limitations of existing methods in processing heterogeneous data are solved, the performance of the interaction prediction model in cross-granularity interaction prediction tasks is improved, and a more flexible and robust framework is provided for the field of time series graph learning, enabling the model to achieve effective learning and inference on data with different time resolutions, thereby significantly expanding the application scope of time series graph learning technology.
[0071] In some embodiments, the sequence of interaction pairs to be predicted, the source node to be predicted in the sequence of interaction pairs to be predicted, and the target node to be predicted are input into the interaction prediction model; and the fourth interaction probability of the source node to be predicted and the target node to be predicted at the application prediction time is obtained.
[0072] Specifically, the application prediction time includes the application prediction start time and multiple application prediction interaction times. Alternatively, the model can be directly input into the sequence of interaction pairs to be predicted, the source node to be predicted in the sequence of interaction pairs to be predicted, and the target node to be predicted, to obtain the fourth interaction probability of the source node to be predicted and the target node to be predicted at the application prediction start time and multiple application prediction interaction times. Or, multiple interaction pairs of the source node to be predicted and multiple interaction pairs of the target node to be predicted can be obtained from the sequence of interaction pairs to be predicted. The difference between the multiple interaction pairs of the source node to be predicted and the application prediction start time is encoded as the third temporal feature matrix of the source node to be predicted. The difference between the multiple interaction pairs of the target node to be predicted and the application prediction start time is encoded as the fourth temporal feature matrix of the target node to be predicted. Common interaction nodes of the source node to be predicted and the target node to be predicted are determined from the multiple interaction pairs of the source node to be predicted and the target node to be predicted. The count of the common interaction nodes is encoded into a counting matrix using a sine coding function. Then, the third temporal feature matrix, the fourth temporal feature matrix, the counting matrix, and the interval coding matrix corresponding to the sampling interval of the sequence of interaction pairs to be predicted are input into the interaction prediction model to obtain the fourth interaction probability of the application prediction start time and multiple application prediction interaction times.
[0073] refer to Figure 5 In this embodiment, the part of generating the multi-sampling interval based on the original dataset and the representation learning can be regarded as the preprocessing stage. The training stage of the model includes self-supervised tasks for the source node and the target node, as well as link prediction tasks (i.e., interaction prediction between the source node and the target node). The self-supervised task includes: verifying the prediction of the first interaction probability between the source node and any interacting node and the third interaction probability between the target node and any interacting node at the verification prediction time (i.e., individual prediction task). In the application stage, it is only necessary to apply the prediction of the link interaction between the source node and the target node to be predicted.
[0074] Based on the same technical concept, this application provides a schematic diagram of the structure of a training device for an interactive prediction model, as shown below. Figure 6 As shown, the training device 600 for the interactive prediction model includes: The sampling module 601 is used to sample the original interaction pair sequence at different sampling intervals to obtain multiple training interaction pair sequences; The training module 602 is configured to, for each training interaction pair sequence, determine a first temporal feature matrix based on the timestamp of each interaction pair in the training interaction pair sequence and the verification prediction time of the source node; determine a first interaction probability between the source node and any interaction node at the verification prediction time based on the first temporal feature matrix and the interval encoding matrix corresponding to the sampling interval of the training interaction pair sequence; and determine a first loss value of the training interaction pair sequence based on the first interaction probability and the actual interaction between the source node and any interaction node at the verification prediction time. The optimization module 603 is used to determine the comprehensive loss value of the current round of iterative training based on the first loss value of each training interaction pair sequence; and to optimize the interaction prediction model according to the comprehensive loss value until the training requirements are met.
[0075] Optionally, the sampling module 601 is specifically used for: Based on any sampling interval, the duration of the original interaction pair sequence is divided into multiple time intervals; For any time interval, identical interaction pairs within the time interval are merged to obtain an interval interaction pair sequence; the identical interaction pairs are those with the same interaction nodes. Based on multiple interval interaction pair sequences, the training interaction pair sequence corresponding to the sampling interval is obtained.
[0076] Optionally, the training module 602 is specifically used for: For any interaction pair of the source node, a first temporal feature of the interaction pair of the source node is determined based on the difference between the timestamp of the interaction pair and the verification prediction time. The first time features of each of the multiple interaction pairs of the source node are encoded into a first time feature matrix.
[0077] Optionally, the training module 602 is specifically used for: The first-time feature matrix is obtained by encoding the first-time features of each of the multiple interactions of the source node using a sine function. The interval coding matrix is obtained by encoding the sampling interval using a sine function.
[0078] Optionally, the different sampling intervals are generated exponentially; the sampling module 601 is specifically used for: The duration of the original interaction pair sequence is divided into multiple time buckets, using time buckets as the time unit. The timestamps of each interaction pair in the original interaction pair sequence are mapped to time buckets to obtain the interaction pairs in each time bucket.
[0079] Optionally, the training module 602 is further configured to: A second time feature matrix is determined based on the timestamp of each interaction pair in the training interaction pair sequence of the target node and the verification prediction time. From the multiple interaction pairs of the source node and the multiple interaction pairs of the target node, determine the common interaction node; Based on the first time feature matrix, the second time feature matrix, the interval encoding matrix corresponding to the sampling interval of the training interaction pair sequence, and the common interaction node, the second interaction probability between the source node and the target node at the verification prediction time is determined; Based on the second interaction probability and the actual interaction between the source node and the target node at the verification prediction time, the second loss value of the training interaction pair sequence is determined; The determination of the comprehensive loss value for this round of iterative training based on the first loss value of each training interaction pair sequence includes: The comprehensive loss value for this round of iterative training is determined based on the first loss value and the second loss value of each training interaction pair sequence.
[0080] Optionally, the training module 602 is further configured to: Based on the second time feature matrix and the interval encoding matrix corresponding to the sampling interval of the training interaction pair sequence, the third interaction probability between the target node and any interaction node at the verification prediction time is determined. Based on the third interaction probability and the actual interaction between the target node and any interaction node at the verification prediction time, the third loss value of the training interaction pair sequence is determined. The determination of the comprehensive loss value for this round of iterative training based on the first loss value and the second loss value of each training interaction pair sequence includes: The comprehensive loss value for this round of iterative training is determined based on the first loss value, the second loss value, and the third loss value of each training interaction pair sequence.
[0081] Optionally, the optimization module 603 is further configured to: The sequence of interaction pairs to be predicted, the source node to be predicted and the target node to be predicted in the sequence of interaction pairs to be predicted are input into the interaction prediction model; Obtain the fourth interaction probability of the source node to be predicted and the target node to be predicted at the application prediction time.
[0082] In this embodiment, the original interaction pair sequence is sampled at different sampling intervals to obtain multiple training interaction pair sequences. For each training interaction pair sequence, a first temporal feature matrix is determined based on the timestamp of each interaction pair in the training interaction pair sequence and the verification prediction time of the source node. Based on the first temporal feature matrix and the interval encoding matrix corresponding to the sampling interval of the training interaction pair sequence, the first interaction probability between the source node and any interaction node at the verification prediction time is determined, overcoming the defect of relying solely on static weighting mechanisms to obtain interaction information in the prior art and improving the accuracy of the interaction prediction model. Based on the first interaction probability and the actual interaction between the source node and any interaction node at the verification prediction time, a first loss value of the training interaction pair sequence is determined. Based on the first loss value of each training interaction pair sequence, the comprehensive loss value of this round of iterative training is determined. The interaction prediction model is optimized according to the comprehensive loss value until the training requirements are met. By optimizing the training interaction pair sequences with different sampling intervals, the interaction prediction model maintains stable performance on training data with heterogeneous sampling intervals, improving the generalization ability and robustness of the interaction prediction model.
[0083] Based on the same technical concept, embodiments of this application provide a computer device, which can be... Figure 1 The server shown is as follows: Figure 7 As shown, it includes at least one processor 701 and a memory 702 connected to at least one processor. In this embodiment, the specific linking medium between the processor 701 and the memory 702 is not limited. Figure 7 Taking the connection between the processor 701 and the memory 702 via a bus as an example, the bus can be divided into address bus, data bus, control bus, etc.
[0084] In this embodiment of the application, the memory 702 stores instructions executed by at least one processor 701. By executing the instructions stored in the memory 702, at least one processor 701 can perform the steps of the training method of the interactive prediction model described above.
[0085] The processor 701 is the control center of the computer device, capable of connecting to various parts of the computer device via various interfaces and lines. It trains the interactive predictive model by running or executing instructions stored in the memory 702 and accessing data stored in the memory 702. Optionally, the processor 701 may include one or more processing modules. The processor 701 may integrate an application processor and a modem processor. The application processor primarily handles the operating system, user interface, and applications, while the modem processor primarily handles wireless communication. It is understood that the modem processor may not be integrated into the processor 701. In some embodiments, the processor 701 and the memory 702 may be implemented on the same chip; in other embodiments, they may be implemented on separate chips.
[0086] The processor 701 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor, application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.
[0087] Memory 702, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 702 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic memory, magnetic disk, optical disk, etc. Memory 702 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer device, but is not limited thereto. In the embodiments of this application, memory 702 can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.
[0088] Based on the same inventive concept, embodiments of this application provide a computer-readable storage medium storing a computer program executable by a computer device, which, when run on the computer device, causes the computer device to perform the steps of the training method for the above-described interactive prediction model.
[0089] Based on the same inventive concept, embodiments of this application provide a computer program product, including a computer program stored on a computer-readable storage medium. The computer program includes program instructions that, when executed by a computer device, cause the computer device to perform the steps of the training method for the interactive prediction model described above.
[0090] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0091] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0092] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0093] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0094] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A training method for an interactive prediction model, characterized in that, include: The original interaction pair sequence is sampled at different sampling intervals to obtain multiple training interaction pair sequences; For each training interaction pair sequence, a first temporal feature matrix is determined based on the timestamp of each interaction pair in the training interaction pair sequence and the verification prediction time of the source node; Based on the first time feature matrix and the interval encoding matrix corresponding to the sampling interval of the training interaction pair sequence, the first interaction probability between the source node and any interaction node at the verification prediction time is determined. Based on the first interaction probability and the actual interaction between the source node and any interaction node at the verification prediction time, the first loss value of the training interaction pair sequence is determined; Based on the first loss value of each training interaction pair sequence, determine the comprehensive loss value for this round of iterative training; The interactive prediction model is optimized based on the comprehensive loss value until the training requirements are met.
2. The method as described in claim 1, characterized in that, The process of sampling the original interaction pair sequence at different sampling intervals to obtain multiple training interaction pair sequences includes: Based on any sampling interval, the duration of the original interaction pair sequence is divided into multiple time intervals; For any time interval, identical interaction pairs within the time interval are merged to obtain an interval interaction pair sequence; the identical interaction pairs are those with the same interaction nodes. Based on multiple interval interaction pair sequences, the training interaction pair sequence corresponding to the sampling interval is obtained.
3. The method as described in claim 1, characterized in that, The determination of the first temporal feature matrix based on the timestamp of each interaction pair in the training interaction pair sequence and the validation prediction time of the source node includes: For any interaction pair of the source node, a first temporal feature of the interaction pair of the source node is determined based on the difference between the timestamp of the interaction pair and the verification prediction time. The first time features of each of the multiple interaction pairs of the source node are encoded into a first time feature matrix.
4. The method as described in claim 3, characterized in that, Encoding the first temporal features of the multiple interaction pairs of the source node into a first temporal feature matrix includes: The first-time feature matrix is obtained by encoding the first-time features of each of the multiple interactions of the source node using a sine function. The interval coding matrix is obtained by encoding the sampling interval using a sine function.
5. The method as described in claim 2, characterized in that, The different sampling intervals are generated exponentially. The step of dividing the duration of the original interaction pair sequence into multiple time intervals includes: The duration of the original interaction pair sequence is divided into multiple time buckets, using time buckets as the time unit. The timestamps of each interaction pair in the original interaction pair sequence are mapped to time buckets to obtain the interaction pairs in each time bucket.
6. The method according to any one of claims 1 to 5, characterized in that, Also includes: A second time feature matrix is determined based on the timestamp of each interaction pair in the training interaction pair sequence of the target node and the verification prediction time. From the multiple interaction pairs of the source node and the multiple interaction pairs of the target node, determine the common interaction node; Based on the first time feature matrix, the second time feature matrix, the interval encoding matrix corresponding to the sampling interval of the training interaction pair sequence, and the common interaction node, the second interaction probability between the source node and the target node at the verification prediction time is determined; Based on the second interaction probability and the actual interaction between the source node and the target node at the verification prediction time, the second loss value of the training interaction pair sequence is determined; The determination of the comprehensive loss value for this round of iterative training based on the first loss value of each training interaction pair sequence includes: The comprehensive loss value for this round of iterative training is determined based on the first loss value and the second loss value of each training interaction pair sequence.
7. The method as described in claim 6, characterized in that, Also includes: Based on the second time feature matrix and the interval encoding matrix corresponding to the sampling interval of the training interaction pair sequence, the third interaction probability between the target node and any interaction node at the verification prediction time is determined. Based on the third interaction probability and the actual interaction between the target node and any interaction node at the verification prediction time, the third loss value of the training interaction pair sequence is determined. The determination of the comprehensive loss value for this round of iterative training based on the first loss value and the second loss value of each training interaction pair sequence includes: The comprehensive loss value for this round of iterative training is determined based on the first loss value, the second loss value, and the third loss value of each training interaction pair sequence.
8. The method as described in claim 6, characterized in that, After optimizing the interactive prediction model based on the comprehensive loss value until the training requirements are met, the process further includes: The sequence of interaction pairs to be predicted, the source node to be predicted and the target node to be predicted in the sequence of interaction pairs to be predicted are input into the interaction prediction model; Obtain the fourth interaction probability of the source node to be predicted and the target node to be predicted at the application prediction time.
9. A training device for an interactive prediction model, characterized in that, include: The sampling module is used to sample the original interaction pair sequence at different sampling intervals to obtain multiple training interaction pair sequences; The training module is used to determine a first temporal feature matrix for each training interaction pair sequence based on the timestamp of each interaction pair in the training interaction pair sequence and the verification prediction time of the source node. Based on the first temporal feature matrix and the interval encoding matrix corresponding to the sampling interval of the training interaction pair sequence, a first interaction probability between the source node and any interaction node at the verification prediction time is determined; based on the first interaction probability and the actual interaction between the source node and any interaction node at the verification prediction time, a first loss value of the training interaction pair sequence is determined. The optimization module is used to determine the comprehensive loss value for this round of iterative training based on the first loss value of each training interaction pair sequence; The interactive prediction model is optimized based on the comprehensive loss value until the training requirements are met.
10. A computer device, characterized in that, include: Memory, used to store program instructions; A processor is configured to invoke program instructions stored in the memory and execute the steps of the method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that, It stores a computer program executable by a computer device, which, when run on the computer device, causes the computer device to perform the steps of the method according to any one of claims 1 to 8.
12. A computer program product, characterized in that, The computer program product includes a computer program stored on a computer-readable storage medium, the computer program including program instructions that, when executed by a computer device, cause the computer device to perform the steps of the method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Graph neural network session recommendation method and device
CN116340642A
Recommendation model training method and device, recommendation method and device and electronic equipment
CN121145995A
Systems and methods for clustering algorithms for data analysis
US20250355972A1