Social software dynamic relation prediction method and system based on time sequence knowledge graph
By using a temporal knowledge graph-based approach, combined with a multi-relation temporal graph attention network and a GRU network, the problem of modeling the temporal dependencies of user interaction behaviors in social software is solved. This enables rapid adaptation to changes in user interests and anomaly detection, improving the accuracy and efficiency of the recommendation system. It is suitable for social software with hundreds of millions of users.
Patent Information
- Application Number
- CN202511291480.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-10
- Publication Date
- 2026-01-02
AI Technical Summary
Existing social software recommendation systems struggle to effectively capture the temporal dependencies of user interactions, fail to effectively integrate users' static semantic features and dynamic interaction features, and lack sufficient modeling capabilities in heterogeneous social networks with multiple relationships. They also suffer from high computational complexity, making it difficult to meet the efficiency requirements of real-time recommendations. Furthermore, they lack robustness, especially in situations involving user privacy protection and data sparsity, making it difficult to guarantee the accuracy and diversity of recommendations.
We adopt a temporal knowledge graph-based approach, combining a multi-relation temporal graph attention network (HyT-GATv2) and a GRU network to construct a fine-grained spatiotemporal feature model. We extract static semantic embeddings using the RotatE model, design a gating enhancement fusion mechanism to achieve adaptive fusion of dynamic features and static semantics, and perform relation prediction through a two-layer feedforward neural network to support deployment on edge devices.
It enables rapid adaptation to changes in user interests, improves the accuracy and efficiency of recommendations, can identify abnormal interaction patterns, reduces computational complexity, supports millisecond-level response for hundreds of millions of users, reduces dependence on large-scale labeled data, and enhances the robustness and real-time performance of the recommendation system.
Smart Images

Figure CN121256152A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer science and information technology, and more particularly to a method and system for predicting dynamic relationships in social software based on time-series knowledge graphs. Background Technology
[0002] With the rapid development of mobile internet and social networking technologies, social software has become a core platform for users to establish social relationships, obtain information, and engage in interactive entertainment. In social scenarios, users' social relationship networks and interest preferences exhibit significant dynamic evolutionary characteristics: user interactions (such as adding friends, message interaction, and content sharing) change frequently over time, and interest tags are updated in real time due to exposure to new content. Traditional static recommendation models struggle to capture these temporal dynamic characteristics, resulting in insufficient recommendation accuracy.
[0003] Current social software recommendation systems face the following technical challenges: While existing methods based on Graph Neural Networks (GNNs) or Recurrent Neural Networks (RNNs) can handle some structural or temporal information, they often decouple structural modeling from temporal modeling, failing to effectively capture the temporal dependencies of user interactions. For example, traditional GNNs do not consider the impact of timestamps when aggregating neighbor information, resulting in equal treatment of neighbors interacting at different times and the loss of dynamic temporal features. Static semantic features of users (such as long-term interest tags and social attributes) and dynamic interaction features (such as recent interaction frequency and changes in content preferences) are not effectively integrated. Most methods use simple weighting or concatenation, lacking an adaptive information source balancing mechanism, making it difficult to dynamically adjust feature weights when user behavior changes drastically. Social networks contain diverse interaction relationships (such as "friends," "colleagues," and "shared interests"), and existing models lack the ability to model the heterogeneity of multiple relationships. For example, traditional Graph Attention Networks (GATs) do not distinguish the semantic differences between different relationship types, leading to low accuracy in cross-relationship feature aggregation. Social media apps have a huge user base and their interaction data is growing explosively. While existing complex models (such as dynamic graph models based on Transformers) can improve prediction accuracy, they are computationally complex and cannot meet the efficiency requirements of real-time recommendations. Furthermore, they are difficult to deploy on edge computing devices.
[0004] Furthermore, social scenarios place extremely high demands on the robustness of recommendation systems: they must ensure both the accuracy and diversity of recommendations while simultaneously addressing constraints such as user privacy protection and data sparsity (e.g., cold start for new users). This poses a severe challenge to the generalization ability and interpretability of dynamic relationship prediction models.
[0005] Current mainstream temporal knowledge graph (TKG) reasoning methods have significant shortcomings in social recommendation: 1. Separation of structural and temporal modeling; for example, RE-GCN only uses RNN combined with graph convolution, without explicitly modeling the interaction between time and structure, resulting in insufficient capture of long-term dependencies; 2. Lack of semantic stability; for example, Know-Evolve models temporal information in dependency point processes, ignoring static semantic features of entities, leading to weak generalization ability of the model during periods of stable user interest; 3. Coarse fusion of multiple information; for example, although DySAT can jointly learn temporal and structural features, it does not integrate static semantics, making it difficult to handle the semantic drift problem in user social behavior. Summary of the Invention
[0006] In view of this, the purpose of this invention is to propose a method and system for predicting dynamic relationships in social software based on time-series knowledge graphs, so as to solve the existing technical problems.
[0007] The technical means employed in this invention are as follows: A method for predicting dynamic relationships in social software based on temporal knowledge graphs includes the following steps: S1. Real-time data collection: Real-time data of user interaction behavior is collected through the interaction interface of social software. The real-time data of interaction behavior includes user basic information, interaction object, interaction type and interaction timestamp. The real-time data of interaction behavior is transmitted to the server to build a dynamically updated time-series knowledge graph dataset. S2. Spatiotemporal Feature Extraction: The temporal knowledge graph data in the temporal knowledge graph dataset is processed using a multi-relation temporal graph attention network. By introducing time encoding, relational semantic fusion and decay mechanisms, a fine-grained model of user structure features under multiple relations and multiple time scales is established. S3. Dynamic Feature Evolution: The fine-grained model is combined with the GRU network to construct a time evolution path. The user structure features at different timestamps are used as input sequences. The dynamic representation evolution of users in the time dimension is obtained through recursive GRU updates, and the dynamic representation of users is output. S4. Static semantic extraction: Aggregate triples of all timestamps in the temporal knowledge graph, construct a time-independent user-relationship set, pre-train based on the RotatE model, map each user to a complex space embedding vector, model the interaction between users and interaction relationships through complex plane rotation operations, and obtain the static semantic embedding of each user as the semantic core representation of the user across the entire time span. S5. Feature Fusion: Design a gated enhancement fusion mechanism to adaptively fuse user dynamic features with static semantic embeddings, calculate gate weights, and perform weighted fusion to obtain the final user representation that includes spatiotemporal semantic co-optimization. S6. Relationship Prediction: Based on the fused user final representation and interaction relationship embedding, input features are constructed, and the output scores of candidate interaction objects are calculated through a two-layer feedforward neural network MLP. The output scores are converted into a probability distribution through a softmax function, and whether it is an abnormal relationship is determined by a preset abnormal threshold to obtain the prediction result. S7. Output Results: The prediction results are structured and output in tabular or JSON format, including key information such as user pairs, interaction relationship types, timestamps, prediction probabilities, and anomaly scores.
[0008] Furthermore, S1 specifically includes the following steps: S11. At the current timestamp t, periodically collect user interaction data through the API interface of social software to form a raw dataset containing user interaction information. ; S12, For the original dataset Preprocessing is performed to filter out invalid interaction data. Invalid interaction data is defined to include situations such as abnormal interaction timestamps and non-existent interaction objects, thus obtaining a valid dataset. ; S13. Based on the valid dataset Constructing a subgraph ,in It is the set of users and interaction objects that participated in the interaction at the current timestamp. This is the set of interaction edges between the user and the interactive object.
[0009] Furthermore, S2 specifically includes the following steps: S21. For each timestamp t, construct a subgraph with triples as edges. ,in For entity sets, For relational edge sets; triples include user, interaction relationship, and interaction object; S22. Extract local features of entities in the subgraph through multi-layer convolution and attention mechanisms, and calculate the structural embedding of the entities, as shown in the following formula:
[0010] in, For entities In relation The set of adjacent nodes below, A linear transformation matrix specific to the relation; For nodes In timestamp right The attention weights are calculated using the following formula:
[0011] in, For timestamps t Fourier feature vector encoding.
[0012] Furthermore, S5 specifically includes the following steps: S51. The user dynamic representation output by the spatiotemporal feature extraction module User static semantic embedding generated by the static semantic extraction module As input; S52. A fully connected layer is used to perform a linear transformation on the dynamic representation and static semantic embedding of the input to obtain the transformed feature vector. S53. Concatenate the transformed feature vectors and calculate the gating weights using the Sigmoid activation function. The formula is as follows:
[0013] Where [;] represents the vector concatenation operation. , For learnable parameters, Use the Sigmoid activation function; S54. Based on gating weights The dynamic features and static semantics are weighted and fused to obtain the user's final representation. This enables adaptive fusion of dynamic features and static semantics, resulting in the user's final representation. The formula is as follows:
[0014] in, Represents timestamp The final representation vector of the user has a dimension of ;vector For timestamps Corresponding gating weights; symbols This indicates that element-wise multiplication is used to perform weighted selection of features; For timestamps Dynamic representation below; This is a static semantic embedding.
[0015] Furthermore, S6 specifically includes the following steps: S61, Merge the user representation Embedding with interaction relationships Concatenate the data to construct the input features. .
[0016] S62, Input Features The input is fed into a two-layer feedforward neural network (MLP). The first layer of the neural network performs a nonlinear transformation on the input features through the ReLU activation function to extract high-level semantic features.
[0017] S63. The second layer of the neural network maps the high-level semantic features to the score space of the candidate interaction objects, obtaining the score y of each candidate interaction object, as shown in the following formula:
[0018] in, This represents the original score vector of the candidate interaction object. The size of the entity set; The input feature vector is represented by the user. With relational embedding It is pieced together. and These are the weight matrix and bias term of the first layer; the activation function is ReLU. Introducing nonlinear transformations; and The parameters for the second layer map the high-level features to the candidate entity score space; S64. Convert the score y into a probability distribution using the softmax function. ,in This represents the probability that candidate interaction object o will interact with the user at time t; S65, Probability Distribution Compared with the preset abnormal threshold θ, if If the value is greater than θ, it is considered an abnormal relationship; otherwise, it is considered a normal relationship.
[0019] Furthermore, the time encoding φ(t) employs a periodic time embedding method based on sine and cosine functions to convert the timestamp t into a high-dimensional vector in order to capture the periodic patterns and contextual relationships in the time series.
[0020] Furthermore, the HyT-GATv2 multi-relational temporal graph attention network employs a multi-head attention mechanism with four attention heads. Each attention head independently calculates features before concatenation, thereby enhancing the model's ability to represent multi-relational heterogeneous graphs.
[0021] Furthermore, the hidden layer dimension of the GRU network is consistent with the entity embedding dimension, set to 200 dimensions, and the maximum historical time window is set to 10 time steps to balance the model's ability to capture long-term dependencies with computational complexity.
[0022] This invention also provides a social software dynamic relationship prediction system based on temporal knowledge graphs, used to implement any of the above-mentioned social software dynamic relationship prediction methods based on temporal knowledge graphs, comprising: The data acquisition module is used to collect user interaction data in real time, parse it into a four-tuple format and store it in the time-series knowledge graph database; The spatiotemporal feature extraction module includes the HyT-GATv2 multi-relational temporal graph attention network, which is used to perform fine-grained modeling of spatiotemporal features. The dynamic feature evolution module, which includes a GRU network, is used to capture the temporal evolution features of user interaction behavior. The static semantic extraction module is used to generate static semantic embeddings of users based on the RotatE model; The feature fusion module is used to implement gated weighted fusion of user dynamic features and static semantics; The relationship prediction module is used to calculate the scores of candidate interaction objects and generate probability distributions to achieve relationship prediction and anomaly detection. The results output module is used to structure the prediction results into a specified format and provide them to the social software recommendation system.
[0023] Furthermore, the spatiotemporal feature extraction module, dynamic feature evolution module, static semantic extraction module, feature fusion module, and relationship prediction module adopt a modular design, and the modules interact through standardized data interfaces.
[0024] Compared with the prior art, the present invention has the following advantages: This invention addresses the problem of insufficient adaptability of traditional recommendation systems to sudden changes in user behavior (such as rapid shifts in interests or rapid expansion of social relationships) by jointly modeling spatiotemporal features and static semantics. For example, when a user suddenly focuses on a new area (such as shifting from "music" to "technology"), the system can quickly capture changes in interest and adjust its recommendation strategy by dynamically increasing feature weights, resulting in improved recommendation accuracy compared to traditional static models.
[0025] HyT-GATv2 achieves semantic differentiation of different relationship types such as "colleagues," "friends," and "followers" in social networks, avoiding the shortcomings of traditional models that treat all relationships equally. In enterprise social scenarios, it can accurately identify the interaction priority of work relationships and personal relationships, optimize the efficiency of contact recommendation in scenarios such as meeting invitations and project collaboration, and reduce interference from invalid information.
[0026] This invention combines temporal dynamic features with a gating fusion mechanism to effectively identify abnormal interaction patterns in social networks: Malicious account detection: Analyze the behavior of frequently adding strangers as friends and sending advertising links within a short period of time through dynamic feature evolution analysis; Early warning of sudden interest changes: For unnatural behavior such as bloggers suddenly posting a large amount of content unrelated to their field (e.g., health bloggers turning to financial advertisements), real-time warnings can be issued earlier than manual review by analyzing the discrepancy between static semantics and dynamic features.
[0027] The lightweight graph attention architecture and distributed computing optimizations of this invention enable the system to maintain millisecond-level response times even with hundreds of millions of users on social media platforms. Real-time recommendation scenario: In live streaming interaction, the interest network can be quickly updated and recommended to users with similar interests based on users' real-time likes and comments; Edge device adaptation: Through model compression and quantization technology, it supports the direct deployment of lightweight inference modules on mobile devices of social software, reducing the computing pressure on the cloud and improving the stability of recommendations in weak network environments.
[0028] The co-learning of static semantic embedding and dynamic features in this invention reduces the reliance on large-scale labeled data. In the scenario of new user cold start, potential user interests (such as occupation and educational background based on registration information) can be inferred through static semantic embedding, and personalized recommendations can be quickly completed by combining a small amount of recent interaction data. Attached Figure Description
[0029] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0030] Figure 1 This is a schematic diagram of the system architecture of the present invention.
[0031] Figure 2 This is a flowchart of the workflow of the HyT-GATv2 multi-relationship temporal graph attention network of the present invention. Detailed Implementation
[0032] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0033] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0034] The implementation environment of this invention includes: Hardware environment: a server equipped with an NVIDIA GPU (such as an NVIDIA 4090) to support large-scale graph neural network computation; and a social software backend server cluster for real-time data acquisition and storage. Software environment: developed based on the PyTorch 2.0 and DGL 1.10 frameworks, with Linux as the operating system (such as Ubuntu 22.04), and Neo4j database used to store time-series knowledge graph data.
[0035] like Figure 1 and 2 As shown, this invention provides a method for predicting dynamic relationships in social software based on temporal knowledge graphs, comprising the following steps: S1. Real-time data acquisition and preprocessing; S11. Periodically collect user interaction data via social software API interfaces (such as WeChat and Weibo open platforms), including: interaction quadruple: (user ID, interaction type, target ID, timestamp), where the interaction type includes "send message," "add friend," "like content," etc.; additional attributes: message text, content tags, user's current online status, etc. The data is transmitted to the server via a Kafka message queue to form the raw dataset. The throughput can reach 100,000 messages per second.
[0036] S12. Data Cleaning and Validity Filtering: Define invalid data as: timestamp error exceeding 5 minutes, target ID not existing in the user table, and abnormal interaction type (such as invalid enumeration value); after filtering, the valid dataset is obtained. The data validity rate is ≥98%.
[0037] S2, Multi-Relationship Sequence Graph Attention Network (HyT-GATv2); S21. Subgraph Construction and Feature Extraction: Construct subgraphs from the interaction data for each time window (e.g., 1 hour). ,in A collection of active users and interactive objects. The interaction relationship edges are represented by 4 layers of Conv2d+LeakyReLU downsampling to extract local features of nodes. The output dimensions are [B, 128, H / 32, W / 32], where B is the batch size and H / W is the feature map size.
[0038] S22. Implementation of the attention weight formula for multi-relation spatiotemporal attention calculation:
[0039] Among them, time coding A 128-dimensional vector is generated using sine and cosine functions, where a is a 64-dimensional learnable attention vector defined using PyTorch's nn.Parameter.
[0040] S3, Time Evolution Modeling (GRU). S31. Dynamic Feature Update: The GRU hidden layer dimension is set to 200, consistent with the entity embedding dimension, and the maximum historical time window is set to 10 time steps; State update formula:
[0041] initial state Initialization is performed using Xavier, implemented through the nn.GRU module.
[0042] S4, Static Semantic Embedding (RotatE); S41. De-timed graph construction aggregates the full interactive data, removes timestamps to generate a set of triples (h, r, t), and imports them into the RotatE model for training.
[0043] S42. Complex space embedding generates entity and relation embeddings mapped to a 200-dimensional complex space. The relation embedding is constrained to the unit norm and optimized using the following loss function:
[0044] in, This is the marginal parameter (set to 1.0). For the Sigmoid function, negative samples are generated by randomly replacing the head or tail entity.
[0045] S5, gated enhanced fusion mechanism; S51. Gated weight calculation: Gated network structure: Input is dynamic features. With static embedding The concatenation (400-dimensional) is processed through a single fully connected layer (200-dimensional) + Sigmoid activation to output gated weights. .
[0046] S52, Feature Fusion; The final statement is: This is achieved through element-wise multiplication in PyTorch. in, Represents timestamp The final representation vector of the user has a dimension of (taken in the experiment) As the result of fusing dynamic and static features, it provides the core input for subsequent relationship prediction. Vector For timestamps The corresponding gating weights are used to control the fusion ratio of dynamic features and static semantics, and their values are adaptively calculated from the learnable parameters of the gating mechanism. The symbol © indicates that element-wise multiplication is used to implement weighted selection of features. Regarding feature sources, For timestamps The dynamic representation below is generated by a temporal modeling module (such as GRU) and is used to capture the temporal evolution patterns of short-term user interaction behavior; This is a static semantic embedding, extracted by a semantic persistence module (such as RotatE), characterizing stable semantic information about the user across the entire time span (such as long-term interests and social attributes). Furthermore, and They are complementary at the element level to ensure that the model can achieve an adaptive balance between dynamic change and long-term stability.
[0047] S6, Time Series Relationship Score; S61, Scoring Network Architecture Two-layer MLP structure: First layer: Input dimension 400 ( and (Concatenation), hidden layer dimension 512, activation function ReLU; second layer: output dimension is the total number of entities |E|, implemented using `nn.Linear`. S62. Abnormal threshold determination; threshold A dynamic adjustment strategy is adopted: based on the 95th percentile of the scores of normal samples in the training set, the score is adjusted during real-time inference. This is determined to be an abnormal relationship.
[0048] S7. Structured result output; S71, Result format: JSON; The table output is generated using PandasDataFrame and supports export in CSV format.
[0049] Module integration: Each component is deployed via Docker containers and the cluster is managed by Kubernetes, supporting horizontal scaling to 100+ nodes to meet the millisecond-level response requirements of hundreds of millions of users.
[0050] Practical application scenarios of this invention: Scenario 1: Optimization of Friend Recommendation In a certain social media app, the system analyzes users' chat content, shared group chats, like history, and other time-series interaction data over the past 30 days, combined with static interest tags generated by RotatE (such as "tech enthusiast" and "photography expert"), which improves the accuracy of new user friend recommendations by 22% and increases the 7-day retention rate of users after adding them as friends by 15%.
[0051] Scenario 2, Abnormal Interaction Detection To address the issue of malicious accounts adding friends in bulk, the system uses GRU to capture dynamic features of high-frequency interactions within a short period of time (such as sending 50+ friend requests within 1 hour). Combined with a gating mechanism, the system enhances the weight of dynamic features, resulting in an anomaly detection recall rate of 96%, which is 40% lower than the false positive rate of traditional rule engines.
[0052] Performance metrics: Single-node inference latency: ≤50ms (batchsize=1024); Memory footprint: Approximately 8KB per user, storage cost for hundreds of millions of users ≤500GB.
[0053] Scalability optimization: The time series graph is divided into multiple nodes using distributed graph partitioning technology (such as Metis), reducing communication overhead by 30%; model quantization technology (such as INT8 quantization) is introduced, reducing inference computing power requirements by 50% and supporting deployment on edge devices.
[0054] Example verification: Through a limited rollout test on a domestic social media platform, the system's effectiveness was verified in the following dimensions: Recommendation accuracy: Target user click-through rate increased by 28%, and average interaction depth (such as the number of messages sent) increased by 1.7 times; Anomaly detection: Successfully blocked 92% of malicious registration accounts, improving the efficiency of blocking the spread of fraudulent information by 60%; Resource consumption: Compared with traditional GNN models, GPU memory usage is reduced by 45% and cluster deployment costs are reduced by 30%.
[0055] The above implementation details the entire process of the system from data collection and feature extraction to relationship prediction. Through modular design and algorithm optimization, it achieves accurate prediction and anomaly detection of dynamic relationships in social software, meeting the efficiency and accuracy requirements of actual business scenarios.
[0056] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them. Although the present invention 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 the present invention.
Claims
1. A method for predicting dynamic relationships in social software based on temporal knowledge graphs, characterized in that, Includes the following steps: S1. Real-time data collection: Real-time data of user interaction behavior is collected through the interaction interface of social software. The real-time data of interaction behavior includes user basic information, interaction object, interaction type and interaction timestamp. The real-time data of interaction behavior is transmitted to the server to build a dynamically updated time-series knowledge graph dataset. S2. Spatiotemporal feature extraction; We use a multi-relation temporal graph attention network to process temporal knowledge graph data in a temporal knowledge graph dataset. By introducing time encoding, relational semantic fusion and decay mechanisms, we establish a fine-grained model of user structure features under multiple relations and multiple time scales. S3. Dynamic Feature Evolution: The fine-grained model is combined with the GRU network to construct a time evolution path. The user structure features at different timestamps are used as input sequences. The dynamic representation evolution of users in the time dimension is obtained through recursive GRU updates, and the dynamic representation of users is output. S4. Static semantic extraction: Aggregate triples of all timestamps in the temporal knowledge graph, construct a time-independent user-relationship set, pre-train based on the RotatE model, map each user to a complex space embedding vector, model the interaction between users and interaction relationships through complex plane rotation operations, and obtain the static semantic embedding of each user as the semantic core representation of the user across the entire time span. S5, Feature Fusion; The gating enhancement fusion mechanism is designed to adaptively fuse user dynamic features with static semantic embeddings, calculate gating weights, and perform weighted fusion to obtain the final user representation that includes spatiotemporal semantic co-optimization. S6. Relationship prediction; Based on the fused user final representation and interaction relationship embedding, input features are constructed, and the output scores of candidate interaction objects are calculated through a two-layer feedforward neural network MLP. The output scores are converted into a probability distribution through a softmax function, and whether it is an abnormal relationship is determined by a preset abnormal threshold to obtain the prediction result. S7. Output Results: The prediction results are structured and output in tabular or JSON format, including key information such as user pairs, interaction relationship types, timestamps, prediction probabilities, and anomaly scores.
2. The method for predicting dynamic relationships in social software based on time-series knowledge graphs according to claim 1, characterized in that, S1 specifically includes the following steps: S11. At the current timestamp t, periodically collect user interaction data through the API interface of social software to form a raw dataset containing user interaction information. ; S12, For the original dataset Preprocessing is performed to filter out invalid interaction data. Invalid interaction data is defined to include situations such as abnormal interaction timestamps and non-existent interaction objects, thus obtaining a valid dataset. ; S13. Based on the valid dataset Constructing a subgraph ,in It is the set of users and interaction objects that participated in the interaction at the current timestamp. This is the set of interaction edges between the user and the interactive object.
3. The method for predicting dynamic relationships in social software based on time-series knowledge graphs according to claim 1, characterized in that, S2 specifically includes the following steps: S21. For each timestamp t, construct a subgraph with triples as edges. ,in For entity sets, For relational edge sets; triples include user, interaction relationship, and interaction object; S22. Extract local features of entities in the subgraph through multi-layer convolution and attention mechanisms, and calculate the structural embedding of the entities, as shown in the following formula: in, For entities In relationship The set of adjacent nodes below, A linear transformation matrix specific to the relation; For nodes In timestamp right The attention weights are calculated using the following formula: in, For timestamps t Fourier feature vector encoding.
4. The method for predicting dynamic relationships in social software based on time-series knowledge graphs according to claim 1, characterized in that, S5 specifically includes the following steps: S51. The user dynamic representation output by the spatiotemporal feature extraction module User static semantic embedding generated by the static semantic extraction module As input; S52. A fully connected layer is used to perform a linear transformation on the dynamic representation and static semantic embedding of the input to obtain the transformed feature vector. S53. Concatenate the transformed feature vectors and calculate the gating weights using the Sigmoid activation function. The formula is as follows: Where [;] represents the vector concatenation operation. , For learnable parameters, Use the Sigmoid activation function; S54. Based on gating weights The dynamic features and static semantics are weighted and fused to obtain the user's final representation. This enables adaptive fusion of dynamic features and static semantics, resulting in the user's final representation. The formula is as follows: in, Represents timestamp The final representation vector of the user has a dimension of ;vector For timestamps Corresponding gating weights; symbols This indicates that element-wise multiplication is used to perform weighted selection of features; For timestamps Dynamic representation below; This is a static semantic embedding.
5. The method for predicting dynamic relationships in social software based on time-series knowledge graphs according to claim 1, characterized in that, S6 specifically includes the following steps: S61, Merge the user representation Embedding with interaction relationships Concatenate the data to construct the input features. ; S62, Input Features The input is fed into a two-layer feedforward neural network (MLP). The first layer of the neural network performs a non-linear transformation on the input features through the ReLU activation function to extract high-level semantic features. S63. The second layer of the neural network maps the high-level semantic features to the score space of the candidate interaction objects, obtaining the score y of each candidate interaction object, as shown in the following formula: in, This represents the original score vector of the candidate interaction object. The size of the entity set; The input feature vector is represented by the user. With relational embedding It is pieced together. and These are the weight matrix and bias term of the first layer; the activation function is ReLU. Introducing nonlinear transformations; and The parameters for the second layer map the high-level features to the candidate entity score space; S64. Convert the score y into a probability distribution using the softmax function. ,in This represents the probability that candidate interaction object o will interact with the user at time t; S65, Probability Distribution Compared with the preset abnormal threshold θ, if If the value is greater than θ, it is considered an abnormal relationship; otherwise, it is considered a normal relationship.
6. The method for predicting dynamic relationships in social software based on time-series knowledge graphs according to claim 1, characterized in that, The time encoding φ(t) employs a periodic time embedding method based on sine and cosine functions to convert the timestamp t into a high-dimensional vector in order to capture the periodic patterns and contextual relationships in the time series.
7. The method for predicting dynamic relationships in social software based on time-series knowledge graphs according to claim 1, characterized in that, The HyT-GATv2 multi-relational temporal graph attention network employs a multi-head attention mechanism with four attention heads. Each attention head independently calculates features before concatenation, thereby enhancing the model's ability to represent heterogeneous graphs with multiple relations.
8. The method for predicting dynamic relationships in social software based on time-series knowledge graphs according to claim 1, characterized in that, The hidden layer dimension of the GRU network is consistent with the entity embedding dimension, set to 200 dimensions, and the maximum historical time window is set to 10 time steps to balance the model's ability to capture long-term dependencies with computational complexity.
9. A social software dynamic relationship prediction system based on temporal knowledge graph, used to implement the social software dynamic relationship prediction method based on temporal knowledge graph as described in any one of claims 1-8, characterized in that, include: The data acquisition module is used to collect user interaction data in real time, parse it into a four-tuple format and store it in the time-series knowledge graph database; The spatiotemporal feature extraction module includes the HyT-GATv2 multi-relational temporal graph attention network, which is used to perform fine-grained modeling of spatiotemporal features. The dynamic feature evolution module, which includes a GRU network, is used to capture the temporal evolution features of user interaction behavior. The static semantic extraction module is used to generate static semantic embeddings of users based on the RotatE model; The feature fusion module is used to implement gated weighted fusion of user dynamic features and static semantics; The relationship prediction module is used to calculate the scores of candidate interaction objects and generate probability distributions to achieve relationship prediction and anomaly detection. The results output module is used to structure the prediction results into a specified format and provide them to the social software recommendation system.
10. The social software dynamic relationship prediction system based on time-series knowledge graph according to claim 9, characterized in that, The spatiotemporal feature extraction module, dynamic feature evolution module, static semantic extraction module, feature fusion module, and relationship prediction module adopt a modular design, and the modules interact with each other through standardized data interfaces.