Social recommendation method and system based on structure and semantic double-view comparison and medium

By constructing a social recommendation method with structure and semantic dual views, the problem that social recommendation systems in the prior art is difficult to integrate multiple entities and semantic information, and high-quality recommendations under unsupervised learning are achieved.

CN120277278AActive Publication Date: 2025-07-08OCEAN UNIV OF CHINA
View PDF 11 Cites 0 Cited by

Patent Information

Application Number
CN202510724187.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-03
Publication Date
2025-07-08
Estimated Expiration
2045-06-03

AI Technical Summary

Technical Problem

The existing social recommendation system is difficult to process and integrate multiple entities and complex relationships in social networks at the same time, and ignores the semantic information of user attributes, resulting in the recommendation results one-sided and relying on a large amount of labeled data, which is costly.

Method used

A social recommendation method based on structural and semantic dual views is constructed. By constructing a heterogeneous information network, metapathic neighborhood view and node attribute view, the difficulty-aware contrast loss function is used to optimize node representation to achieve unsupervised learning.

Benefits of technology

It improves the richness and recommendation effect of node characterization, can fully integrate multi-dimensional information without labeled data, and enhances the model's adaptability to complex network structures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120277278A_ABST
    Figure CN120277278A_ABST
Patent Text Reader

Abstract

The invention relates to the field of social network recommendation, and discloses a social recommendation method and system based on structure and semantic double view comparison and a medium, and the method comprises the steps: S1, constructing a heterogeneous information network; s2, constructing a meta-path neighborhood view: defining a target node i, extracting a meta-path neighborhood # imgabs0 # of the target node i based on a predefined meta-path, and obtaining a meta-path neighborhood view representation # imgabs1 # of the target node i by aggregating neighborhood information; s3, constructing a node attribute view; s5, cross-view comparison optimization: projecting the representations obtained in S2 and S3 to a unified feature space, and performing optimization by adopting a difficulty perception comparison loss function, so that the node representations under different views are aligned; and S6, performing recommendation based on the node representation after comparison optimization. According to the method, the multi-dimensional information of the nodes is fully fused, information omission and information redundancy are avoided, the expression ability of node representation is improved, and the social recommendation effect can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of social network recommendation, and particularly to a social recommendation method, system and medium based on the contrast of structural and semantic dual views. Background Art

[0002] Based on the in-depth analysis of user behavior data, a social recommendation system can predict other users, groups or content that a user may be interested in, so as to provide personalized social recommendation services. Graph representation learning technology has been widely applied in the field of social recommendation. Existing methods aim to map nodes, edges and other structures in a heterogeneous social network to a low-dimensional vector space to facilitate subsequent tasks such as friend recommendation and community discovery. Existing methods are difficult to simultaneously process and integrate multiple entities and complex relationships in a social network, resulting in one-sided recommendation results and being unable to comprehensively capture users' social preferences; most social recommendation algorithms rely on supervised learning and require a large amount of labeled data, while in practical applications, explicit social preference labels are often scarce and costly to obtain; existing methods usually focus on network structure information and ignore the rich semantic information in user attributes, and are unable to effectively integrate structural features and semantic features. Summary of the Invention

[0003] The technical problem to be solved by the present application is to overcome the deficiencies of the prior art and provide a social recommendation method, system and medium based on the contrast of structural and semantic dual views, which can improve the recommendation quality by constructing two complementary views without user social preference labels, fully integrate multi-dimensional information such as the high-order structure, low-order structure and attribute semantics of nodes, and avoid information omission and information redundancy, thereby enhancing the expression ability of node representations in a heterogeneous information network and further enhancing the effect of social recommendation.

[0004] To achieve the above object, the first aspect of the present application provides a social recommendation method based on the contrast of structural and semantic dual views, including the following steps: S1. Construct a heterogeneous information network: Model the social network data to be processed as a heterogeneous information network, which is jointly composed of multiple types of nodes and edges, and the relationships between different types of nodes and edges are distinguished by a mapping function; S2. Construct a meta-path neighborhood view: Define the target node i, and extract the meta-path neighborhood of the target node i based on a predefined meta-path , and obtain the meta-path neighborhood view representation of the target node i by aggregating neighborhood information ; S3. Construct a node attribute view: Calculate the cosine similarity between the target node i and other nodes, construct an attribute similarity graph based on a set similarity threshold as the node attribute view, and obtain the node attribute view representation of the target node i by aggregating the attribute information of neighbor nodes. ; S4. Positive sample sampling based on meta-path connection: Statistical the number of meta-path connections between the target node i and other nodes, and select the top k nodes with the largest number of connections as the positive sample set. ; S5. Cross-view contrast optimization: Project the meta-path neighborhood view representations and the node attribute view representations obtained in S2 and S3 into a unified feature space, and optimize using a difficulty-aware contrast loss function to align the node representations under different views; S6. Recommendation based on the node representations optimized by contrast: Select the meta-path neighborhood view representation as the node representation of the target node i, calculate and sort the similarity between the target node i and other node representations, and select the top k targets with the highest similarity to the target node i as the recommendation results.

[0005] Optionally, the node types in S1 include users, topics, groups, and regions, and the edge types include user-interact-topic, user-belong-to-group, and user-locate-in-region.

[0006] Optionally, in S2, extract the meta-path neighborhood of the target node i based on a predefined meta-path , including: centered on the target node i, collect all nodes and their connection relationships reached from the target node i through the predefined meta-path to form a local structure subgraph centered on the target node i, which is the meta-path neighborhood , and use the local structure subgraph as the meta-path neighborhood view of the target node i.

[0007] Optionally, obtaining the meta-path neighborhood view representation of the target node i in S2 , including: Set a predefined meta-path set , extract the meta-path neighborhood of the target node i based on the predefined meta-path , where represents the node set in the meta-path neighborhood , represents the edge set in the meta-path neighborhood ; In each meta-path neighborhood In this method, a graph convolutional neural network is used to aggregate and encode node information, and the node representation under each meta-path neighborhood is obtained, which is expressed as: ; where, represents the node representation of the target node i under the meta-path , is the degree of the node on the meta-path neighborhood , is the activation function, represents the representation of the node , j represents the node in the meta-path neighborhood ; After obtaining the node representation under each meta-path neighborhood, the adaptive fusion of information in different meta-path neighborhoods is achieved through an attention mechanism, including: First, calculate the global weight of each meta-path , which is expressed as: ; where, , and are learnable parameters, represents the global weight of the meta-path , represents the transpose of the learnable parameter , is the activation function, represents the number of target nodes; Subsequently, the node representations in different meta-path neighborhoods are weighted and aggregated to obtain the meta-path neighborhood view representation of the target node , which is expressed as: ; where, represents the total number of meta-paths, represents the current meta-path subscript, represents the traversal variable when normalizing the weight, represents the weight parameter of the th meta-path, p represents the exponential function .

[0008] Optionally, in S3, the cosine similarity between the target node i and other nodes is calculated, and an attribute similarity graph is constructed based on a set similarity threshold as the node attribute view, including: Extract the attribute feature vectors of the target node i and other nodes j, and calculate the cosine similarity between the target node i and other nodes j, which is expressed as: ; Among them, represents the cosine similarity between node i and node j, and represent the attribute feature vectors of the target node and other nodes ; and respectively represent and 's norms; Define the cosine similarity threshold . If the cosine similarity exceeds the cosine similarity threshold , then an undirected edge is established in the node attribute view to form a node attribute similarity graph; On the constructed node attribute view, aggregate the attribute information for each node. For the target node i, collect the neighbor nodes of the target node i in the node attribute view, and aggregate the attribute feature vectors of the neighbor nodes through a graph convolutional neural network to obtain the node attribute view representation of the target node i, which is expressed as: ; Among them, represents a learnable weight matrix, represents the set of neighbor nodes of node in the node attribute view, represents the representation of node ;

[0009] Optionally, in S4, count the number of meta-path connections between the target node i and other nodes, and select the top k nodes with the largest number of connections as the positive sample set , including: For the target node i and other nodes j, count whether node can be connected to the target node through different meta-paths, and define the number of meta-path connections between the target node i and other nodes j as: ; Among them, is an indicator function. If is 's neighbor node under the meta-path , then this item is 1, otherwise it is 0; Subsequently, select the set of nodes with the top number of meta-path connections as the positive sample set of node ​, nodes not included in the positive sample set are regarded as negative nodes to form a negative sample set .

[0010] Optionally, in S5, a difficulty-aware contrastive loss function is used for optimization to align node representations under different views, including: is the target node Calculate the view difference degree to measure the target node and the structural differences of other nodes in the meta-path neighborhood view and the node attribute view, expressed as: ; Among them, is the view difference degree of node , and are the numbers of neighbor nodes aggregated by node in the meta-path neighborhood view and the node attribute view respectively, and are the numbers of neighbor nodes aggregated by node in the meta-path neighborhood view and the node attribute view respectively; denotes traversing all nodes to find 's maximum value, and j is the index for traversing nodes; Calculate the similarity of the projection representations of the node in the meta-path neighborhood view and the node attribute view, and adjust the learning target node of the sample through the difficulty-aware contrastive loss function , expressed as: ; Among them, represents the difficulty-aware contrastive loss function of node , is used to calculate the cosine similarity between two vectors, is the temperature parameter, is a hyperparameter for adjusting the difficulty-aware intensity, denotes 's representation after projecting to the unified feature space, denotes 's representation after projecting to the unified feature space, denotes the index of the traversed node, denotes 's union of positive and negative sample sets; Average the contrastive losses of all nodes to obtain the overall optimization objective, expressed as: ; Among them, is the overall optimization objective, is the target node The quantity of represents the set of target type nodes

[0011] Optionally, select the meta-path neighborhood view representation in S6 as the node representation of target node i, calculate the similarity between target node i and other node representations and sort them, and select the top-k targets with the highest similarity to target node i as the recommendation results, including: Define target node i as user node i; For user node , calculate the meta-path neighborhood view representation of user node and the meta-path neighborhood view representation of other user nodes to calculate the cosine similarity and the meta-path neighborhood view representation of other user nodes and sort the cosine similarity, and select the top- users with the largest similarity to user node i as friend recommendations

[0012] To achieve the above object, the second aspect of the present application provides a social recommendation system based on the comparison of structural and semantic dual views. The social recommendation system includes: A heterogeneous information network construction module, which is used to model the to-be-processed social network data into a heterogeneous information network. The heterogeneous information network is jointly composed of multiple types of nodes and edges, and the relationships between different types of nodes and edges are distinguished by a mapping function; A meta-path neighborhood view construction module, which is used to define target node i, extract the meta-path neighborhood of target node i based on a predefined meta-path , and obtain the meta-path neighborhood view representation of target node i by aggregating neighborhood information ; A node attribute view construction module, which is used to calculate the cosine similarity between the attributes of target node i, construct an attribute similarity graph based on a set similarity threshold as the node attribute view, and obtain the node attribute view representation of target node i by aggregating the attribute information of neighbor nodes ; A node sampling module, which is used to count the number of meta-path connections between target node i and other nodes, and select the nodes ranked top k in terms of the connection quantity as the positive sample set ; A comparison and optimization module, which is used to compare the meta-path neighborhood view representation and the node attribute view representation ​Project it into a unified feature space and optimize it using a difficulty-aware contrast loss function to align the node representations under different views; A recommendation module, which is used to select the meta-path neighborhood view representation As the node representation of the target node i, calculate the similarity between the target node i and other node representations and sort them, and select the top-k targets with the highest similarity to the target node i as the recommendation results.

[0013] To achieve the above object, the third aspect of this application provides a computer-readable storage medium storing a computer program, which when executed by a processor is used to implement the method as described above.

[0014] After adopting the above technical solutions, this application has the following beneficial effects compared with the prior art: Through the view contrast learning mechanism, this application can fully capture multi-dimensional information such as structure and semantics in the social network, significantly improving the richness of node representations; by introducing the meta-path neighborhood, this application can capture high-order structure information and low-order local structure information at the same time without redundancy while fully utilizing the meta-path structure information, realizing multi-level modeling of complex network relationships; this application fully explores and utilizes the important semantic information contained in the node attributes themselves during the representation learning process, making the finally generated node representations more comprehensive; This application adopts a difficulty-aware contrast strategy, assigning greater weights to nodes that are inherently very different in the two views to make their representations consistent, thereby improving the consistency of node representations under multiple views and enhancing the adaptability of the model to complex network structures; this application adopts a self-supervised learning paradigm, which does not rely on manually labeled tag data, can fully explore the multi-dimensional information of the social network under unsupervised conditions, learn high-quality node representations, and apply them to the friend recommendation task.

[0015] The following further describes in detail the specific implementation manners of this application with reference to the accompanying drawings. Description of the Drawings

[0016] The accompanying drawings, as part of this application, are used to provide a further understanding of this application. The schematic embodiments and descriptions thereof of this application are used to explain this application, but do not constitute an improper limitation of this application. Obviously, the accompanying drawings in the following description are only some embodiments, and those of ordinary skill in the art can obtain other drawings based on these drawings without creative efforts.

[0017] In the accompanying drawings of the specification: Figure 1 It is a schematic flowchart of a heterogeneous social recommendation method based on dual-view contrast of structure and semantics; Figure 2It is a schematic diagram of the framework for constructing and encoding the meta-path neighborhood view in this specific embodiment; Figure 3 It is a schematic diagram of the framework for constructing and encoding the node attribute view in this specific embodiment; Figure 4 It is a schematic diagram of the framework for cross-view comparison and optimization in this specific embodiment; Figure 5 It is a schematic diagram of the structure of a heterogeneous social recommendation system based on the comparison of structural and semantic dual views. Specific Embodiment

[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the following will clearly and completely describe the technical solutions in the embodiments in conjunction with the accompanying drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application but are not used to limit the scope of the present application.

[0019] Regarding the related technologies mentioned in the background art, the following brief description is made: Based on in-depth analysis of user behavior data, a social recommendation system can predict other users, groups, or content that a user may be interested in, thereby providing personalized social recommendation services. In a typical social network, a large amount of diverse user information (such as age, hobbies, region, personal profile) and interaction behaviors (such as following, liking, commenting, joining groups together, etc.) are recorded, and this rich data provides a basis for understanding user social preferences. By analyzing these complex data and interactions and mining the implicit social needs and interest connections therein, high-quality social recommendations can be provided for users.

[0020] Based on this, please refer to Figure 1 , the present application provides a social recommendation method based on the comparison of structural and semantic dual views, including the following steps: S1. Construct a heterogeneous information network: Model the social network data to be processed as a heterogeneous information network, which is jointly composed of multiple types of nodes and edges, and the relationships between different types of nodes and edges are distinguished by a mapping function; S2. Construct a meta-path neighborhood view: Define the target node i, and extract the meta-path neighborhood of the target node i based on a predefined meta-path , and obtain the meta-path neighborhood view representation of the target node i by aggregating the neighborhood information ; S3. Construct a node attribute view: Calculate the cosine similarity between the target node i and other nodes, construct an attribute similarity graph based on a set similarity threshold as the node attribute view, and obtain the node attribute view representation of the target node i by aggregating the attribute information of neighbor nodes ; S4. Positive sample sampling based on meta-path connection: Count the number of meta-path connections between the target node i and other nodes, and select the top k nodes with the largest number of connections as the positive sample set ; S5. Cross-view contrast optimization: Project the meta-path neighborhood view representation and the node attribute view representation obtained in S2 and S3 into a unified feature space, and optimize it using a difficulty-aware contrast loss function to align the node representations under different views; S6. Recommendation based on the node representation optimized by contrast: Select the meta-path neighborhood view representation as the node representation of the target node i, calculate and sort the similarity between the target node i and other node representations, and select the top k targets with the highest similarity to the target node i as the recommendation result.

[0021] It should be noted that in this embodiment, the execution subject of the social recommendation method based on the contrast of the structural and semantic dual views is a heterogeneous social recommendation device based on the contrast of the structural and semantic dual views. This device can be an electronic device, a component in an electronic device, an integrated circuit, or a chip. The electronic device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a handheld computer, a vehicle-mounted electronic device, a wearable device, etc., and the non-mobile electronic device can be a server and a personal computer, etc. This application does not make specific limitations. Hereinafter, taking the execution subject as a server as an example, the social recommendation method based on the contrast of the structural and semantic dual views in this embodiment will be described.

[0022] In addition, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the embodiments of the present application, "a plurality" means two or more unless otherwise specifically defined.

[0023] It should be noted that in the following embodiments, the target node i is taken as the user node i for illustration.

[0024] Please refer to Figure 1 , in a realizable embodiment, S1. Construct a heterogeneous information network: Model the to-be-processed social network data as a heterogeneous information network, which is jointly composed of multiple types of nodes and edges, and the relationships between different types of nodes and edges are distinguished by a mapping function.

[0025] Specifically, the social network data to be processed is modeled as a heterogeneous information network, which is composed of multiple types of nodes and multiple types of edges, and can depict the diverse relationships between different entities. Specifically, the heterogeneous information network is defined as , where represents the node set, represents the edge set, represents the node attribute feature set. To describe the heterogeneity of nodes and edges, the node type set and the edge type set are introduced. Each node specifies its type through the type mapping function , and each edge specifies its type through the type mapping function . The essence of the heterogeneous information network lies in the diversity of node types or edge types, that is, satisfying or .

[0026] In a realizable embodiment, the node types in S1 include users, topics, groups, and regions, and the edge types include user - interaction - topic, user - belongs - to - group, and user - located - in - region.

[0027] In practical applications, taking common social network data as an example, the nodes can include types such as users, topics, groups, regions, etc., and the edges can include various types such as "user - interaction - topic", "user - belongs - to - group", "user - located - in - region", etc. The relationships between different types of nodes and edges can be distinguished through the above - mentioned mapping functions. Taking the user node as an example, its attributes (or features) are a set of values used to describe the nature of the node itself. These attributes can include, but are not limited to, information such as the user's age, gender, region, number of posts, personal profile, interest description, etc. Each attribute can be encoded using one - hot encoding or transformed into a vector through an encoder. The specific content of the attributes can be flexibly selected according to the actual application scenario to comprehensively depict the semantic and structural features of the nodes.

[0028] Please refer to Figure 1 and Figure 2 , in a realizable embodiment, in S2, the meta - path neighborhood of the target node i is extracted based on the predefined meta - path, including: centering on the target node i, collecting all the nodes reached from the target node i through the predefined meta - path and their connection relationships, forming a local structure sub - graph centered on the target node i, which is the meta - path neighborhood , and taking the local structure sub - graph as the meta - path neighborhood view of the target node i.

[0029] It should be noted that existing heterogeneous information network representation methods usually only aggregate neighbors based on meta-paths, that is, the endpoints of meta-paths. This method ignores the intermediate nodes in the meta-paths, resulting in some semantic information not being fully utilized. The existing method selects to aggregate meta-path instances, that is, to aggregate all nodes in each meta-path. Since there are usually common nodes among multiple meta-paths, this existing method will cause repeated aggregation of common nodes, resulting in information redundancy.

[0030] The meta-path neighborhood in this embodiment can capture the structure of neighbors based on meta-paths and intermediate nodes of meta-paths without omission and redundancy. Specifically, centered on the target node i, collect all nodes reached from the target node i through predefined meta-paths and their connection relationships to form a local structure subgraph centered on the target node i, which is the meta-path neighborhood . In this embodiment, the local structure subgraph is used as the meta-path neighborhood view of the target node i, so as to take into account high-order and low-order structure information in a unified framework, avoiding redundancy and information omission.

[0031] Please continue to refer to Figure 1 and Figure 2 . In a feasible implementation, the meta-path neighborhood view representation of the target node i is obtained in S2 .

[0032] Specifically, a set of predefined meta-path sets is set. For the user node , traverse the heterogeneous graph along the meta-path , collect all nodes that can be reached from the user node through this meta-path and their connection relationships to form a local subgraph centered on the user node , which is also the meta-path neighborhood, denoted as , where represents the node set in the meta-path neighborhood , and represents the edge set in the meta-path neighborhood .

[0033] Specifically, in each meta-path neighborhood, a graph convolutional neural network is used for node information aggregation and encoding, that is, encoding within the meta-path neighborhood. Here, no limitation is imposed on the graph convolutional neural network, and other neural network encoders can also be selected.

[0034] Specifically, for each node and each meta-path , its embedding on the subgraph is obtained through the following method: ; Among them, represents the node representation of the target node i under the meta-path , is the degree of the node in the meta-path neighborhood , is the activation function, represents the representation of the node , j represents the node in the meta-path neighborhood .

[0035] After obtaining the node representations under each meta-path neighborhood, the attention between meta-path neighborhoods is further introduced to achieve the adaptive fusion of multi-meta-path neighborhood information, that is, the encoding between meta-path neighborhoods. For each meta-path , first calculate the global weight of each meta-path , expressed as: ; Among them, , and are learnable parameters, represents the global weight of the meta-path , represents the transpose of the learnable parameter , is the activation function, represents the number of target nodes.

[0036] Specifically, then weight and aggregate the node representations under different meta-path neighborhoods to obtain the final meta-path neighborhood view representation of the user node , expressed as: ; Among them, represents the total number of meta-paths, represents the current meta-path subscript, represents the traversal variable when normalizing the weights, represents the th weight parameter of the meta-path, p represents the exponential function .

[0037] It should be noted that through the above steps in this embodiment, the node representations can fully fuse various structural semantic information, avoiding redundant aggregation and preventing semantic omission, so as to achieve efficient structural modeling of heterogeneous graphs.

[0038] In practical applications, for the task of relevant friend recommendation, the type of the target node is defined as a user node, and meta-paths that can reflect the association between users are selected. For example, user-topic-user, that is, two users participate in the same topic; user-group-user, that is, two users are in the same group; user-region-user, that is, two users are in the same region.

[0039] Specifically, first, extract the meta-path neighborhood according to the predefined meta-path. Taking the user-topic-user meta-path as an example, for each user node, enumerate all other user nodes reachable through the user-topic-user meta-path, and extract its meta-path neighborhood. Subsequently, for each meta-path extracted meta-path neighborhood , use formula (1) to aggregate the neighbor nodes within each meta-path neighborhood to obtain the node representation of the user node under the meta-path neighborhood . Next, use the attention mechanism to aggregate the representations of the node in different meta-path neighborhoods. Specifically, calculate the global weight of each meta-path neighborhood according to formula (2), and complete the weighted aggregation of the node representation according to formula (3) to obtain the meta-path neighborhood view representation of the user node under the meta-path neighborhood view.

[0040] It should be noted that in this embodiment, for the user node , its neighbor nodes based on the meta-path neighborhood are aggregated, including both low-order structure information and high-order structure information; among them, the low-order structure information is such as topic nodes and group nodes, and the high-order structure information is such as user nodes connected by various meta-paths.

[0041] Please refer to Figure 1 and Figure 3 , in another feasible embodiment, in S3, calculate the cosine similarity between the target node i and other nodes, and construct an attribute similarity graph based on a set similarity threshold as the node attribute view.

[0042] It should be noted that this embodiment aims to mine potential semantic connections from the node attribute space to supplement semantic information other than the structural view for the node representation.

[0043] Specifically, this embodiment includes node attribute view construction and node attribute view encoding. First, based on the attribute features of the nodes, construct the node attribute view, extract the attribute feature vectors of the target node i and other nodes j, calculate the cosine similarity between the target node i and other nodes j, and use the cosine similarity as the similarity measurement criterion to calculate the feature similarity between the target node i and other nodes j, which is expressed as: ; Among them, represents the cosine similarity between node i and node j, and represent the target node and the attribute feature vectors of other nodes . and respectively represent and 's norm.

[0044] Specifically, then set the similarity threshold . When the feature similarity of two nodes is greater than or equal to the similarity threshold , an undirected edge is established in the attribute view, thus constructing a new graph structure based on node attribute similarity and using it as the node attribute view.

[0045] On the constructed node attribute view, aggregate the attribute information for each node. Specifically, for the target node i, collect its neighbor nodes in the attribute view, and aggregate the attribute feature vectors of the neighbors using a graph convolutional neural network. Here, no limitation is imposed on the graph convolutional neural network, and other neural network aggregators can also be selected to obtain the node attribute view representation of the target node i, which is expressed as: ; Among them, represents the learnable weight matrix, represents the neighbor set of node in the node attribute view, represents the representation of node .

[0046] In practical applications, for the related friend recommendation task, the type of the target node is a user node. Collect the attribute information of each user, such as the user's age, gender, number of posts, personal profile, and interest description, and encode them into vectors. Subsequently, calculate the cosine similarity between all user node attribute vectors according to formula (4) to obtain the attribute similarity matrix . Next, according to the set threshold, construct a new attribute similarity graph: if the attribute similarity of two users is greater than the threshold, then connect edges in the new graph. Finally, apply a graph convolutional neural network or other neural network encoders on this attribute similarity graph according to formula (5) to aggregate the neighbor node attribute information and obtain the node attribute view representation of each user under the attribute view.

[0047] It should be noted that this embodiment fully exploits and utilizes the semantic information inherent in the attributes of user nodes, such as age, gender, number of posts, personal profile, and interest description, etc., which can fully reflect the characteristics of users and is more conducive to mining similar user nodes.

[0048] Please refer to Figure 1 and Figure 4 , in an implementable embodiment, in S4, the number of meta-path connections between the target node i and other nodes is statistically counted, and the nodes ranked top k in terms of the connection number are selected as the positive sample set. .

[0049] It should be noted that the purpose of this embodiment is to efficiently collect a positive sample set with strong structural relevance in the unsupervised contrast learning stage, so as to improve the structural sensitivity of node representations.

[0050] Specifically, this embodiment believes that if two nodes can be connected by multiple meta-paths, their structural similarity is relatively strong. For the target node i and other nodes j, it is statistically counted whether other nodes can be connected to the target node through different meta-paths, and the number of meta-path connections between the target node i and other nodes j is defined as: ; where is an indicator function. If is a neighbor node under the meta-path , this item is 1, otherwise it is 0.

[0051] Specifically, subsequently, the node set ranked top in terms of the meta-path connection number is selected as the positive sample set of the target node , and the nodes not included in the positive sample set are regarded as negative nodes to form a negative sample set . .

[0052] In practical applications, according to formula (6), for each user node , the number of connections between the user node and other user nodes through the specified meta-paths, namely user-topic-user, user-region-user, and user-group-user, is statistically counted. The user nodes ranked top k in terms of the connection number are selected as the positive sample set , and the nodes not included in the positive sample set are regarded as negative nodes to form a negative sample set , which is used for contrast learning in subsequent steps.

[0053] Please refer to Figure 1 , Figure 2 ,Figure 3 and Figure 4 , in another embodiment, in S5, a difficulty-aware contrastive loss function is used for optimization to align the node representations under different views.

[0054] It should be noted that this embodiment aims to use a cross-view contrast mechanism to achieve structure-attribute collaborative supervision, fuse and align the representation information of the aforementioned meta-path neighborhood view and node attribute view, and improve the quality of node representations and recommendation effects in the absence of user social preference labels.

[0055] Specifically, first, the embedded representations of the node in the meta-path neighborhood view and the node attribute view are obtained by S2 and S3 respectively, which are the meta-path neighborhood view representation and the node attribute view representation . To eliminate the distribution differences between different views, the two embedded representations are projected into a unified feature space through a multi-layer perceptron MLP, which is expressed as: ; ; where are learnable shared parameters, is a non-linear activation function, represents the representation after projecting into the unified feature space, represents the representation after projecting into the unified feature space.

[0056] Specifically, considering that the information aggregated by the node in the two views may be quite different, this embodiment adopts a difficulty-aware contrastive strategy, and for nodes that are inherently very different in the two views, a greater weight is given during training to make their representations consistent.

[0057] Specifically, for the target node , calculate the view difference degree to measure the structural differences between the target node and other nodes in the meta-path neighborhood view and the node attribute view, which is expressed as: ; where is the view difference degree of node , and are the numbers of neighbor nodes aggregated by node in the meta-path neighborhood view and the node attribute view respectively, and are the numbers of neighbor nodes aggregated by node in the meta-path neighborhood view and the node attribute view respectively; Indicates for all nodes to traverse and find the maximum value, where j is the index for traversing nodes.

[0058] Specifically, calculate the similarity of the projection representations of nodes in the meta-path neighborhood view and the node attribute view, and adjust the learning target nodes of the samples through a difficulty-aware contrast loss function , expressed as:[[]] ; Among them, represents the difficulty-aware contrast loss function of node , is used to calculate the cosine similarity between two vectors, is the temperature parameter, is a hyperparameter for adjusting the difficulty-aware intensity, represents the representation after projecting into the unified feature space, represents the representation after projecting into the unified feature space, represents the index of the traversed node, represents node the union of the positive and negative sample sets.

[0059] Average the contrast losses of all nodes to obtain the overall optimization objective, expressed as:[[]] ; Among them, is the overall optimization objective, is the number of target nodes , represents the set of target type nodes.

[0060] In practical applications, the meta-path neighborhood view and the node attribute view are constructed and encoded through S2 and S3 respectively to obtain the meta-path neighborhood view representation of the user node in the meta-path neighborhood view and the node attribute view representation of the user node in the node attribute view. Subsequently, according to formulas (7) and (8), use a multi-layer perceptron to project the representations of nodes in different views into a unified feature space, that is, obtain and in the same feature space, represents the representation after projecting into the unified feature space, represents the representation after projecting into the unified feature space. Then calculate the user node Regarding the structural differences in the two views, next, according to formula (10), and in combination with the obtained positive and negative sample sets, calculate the similarity of the projected representations of user nodes in the two views, that is, the difficulty-aware contrastive loss. According to formula (11), average the contrastive losses of all user nodes to obtain the overall optimization objective for model training , and update the model parameters through backpropagation to optimize the node representations.

[0061] It should be noted that in this embodiment, the contrastive learning mechanism is utilized to make different views complement each other and supervise each other, so that the representations of the same user in different views are more consistent. Finally, the learned user node representations simultaneously contain information in multiple dimensions such as low-order structure, high-order structure, and node attributes, enhancing the comprehensive expression ability of multi-dimensional semantic and structural information in the representations.

[0062] In a feasible implementation manner, in S6, select the meta-path neighborhood view representation as the node representation of target node i, calculate the similarity between target node i and other node representations and sort them, and select the top-k targets with the highest similarity to target node i as the recommendation results.

[0063] Specifically, define target node i as user node i. For user node , calculate the meta-path neighborhood view representation of user node and the meta-path neighborhood view representation of other user nodes to calculate the cosine similarity , and sort the cosine similarities, and select the top- users with the greatest similarity to user node i as friend recommendations.

[0064] In practical applications, after completing the multi-view heterogeneous graph representation and cross-view contrastive learning, this embodiment applies the obtained node representations to the friend recommendation task in the social network. Through the aforementioned contrastive optimization, select the meta-path neighborhood view representation in the meta-path neighborhood view as the final node representation. For user node , calculate the cosine similarity between the representation of user node and the representations of other users , and sort the similarities, and select the top- users with the greatest similarity to user node for friend recommendation.

[0065] This application has the following advantages compared with the prior art: This application first models the social network as a heterogeneous information network, fully considering various connection relationships among entities such as users, topics, and groups, as well as the attribute information of users. Subsequently, a corresponding meta-path neighborhood view is modeled to mine high-order and low-order structure information in the network without redundancy while fully utilizing information. At the same time, a node attribute view is designed to supplement the semantic features contained in user node attributes. Then, in the absence of user social preference labels, a cross-view contrast mechanism is used to achieve structure-attribute collaborative supervision and fully mine the multi-dimensional information of the social network. Finally, the obtained node representations can be directly applied to the friend recommendation task.

[0066] To verify the effectiveness of the method of this application, this embodiment conducts a comprehensive performance evaluation on the node representations obtained in step S5. Specifically, two types of experiments, namely node classification and node clustering, are designed to verify the quality of the node representations, and Macro-F1, Micro-F1, NMI (Normalized Mutual Information), and ARI (Adjusted Rand Index) are selected as evaluation indicators. In addition, this embodiment selects HeCo, DMGI, and DGI as benchmark comparison methods, and these methods represent the advanced technologies in the current field of graph representation learning.

[0067] The detailed results of the experiments are shown in Table 1 and Table 2, which respectively show the comparison of Macro-F1 and Micro-F1 indicators in the node classification task and the comparison of NMI and ARI indicators in the node clustering task.

[0068] Table 1: Comparison between this application and existing methods in the node classification experiment: Evaluation Metrics Macro-F1 Micro-F1 This Application 0.8067 0.8047 HeCo 0.7749 0.7751 DMGI 0.7637 0.7712 DGI 0.7368 0.7401 Table 2: Comparison between this application and existing methods in the node clustering experiment: Evaluation Metrics NMI ARI This Application 0.3621 0.3841 HeCo 0.3411 0.3424 DMGI 0.3102 0.3025 DGI 0.2866 0.2917

[0069] Please refer to Figure 5 , based on the same inventive concept, this application also provides a social recommendation system based on the contrast of structural and semantic dual views. The social recommendation system includes a heterogeneous information network construction module, a meta-path neighborhood view construction module, a node attribute view construction module, a node sampling module, a contrast optimization module, and a recommendation module.

[0070] Specifically, the heterogeneous information network construction module is used to model the social network data to be processed as a heterogeneous information network. The heterogeneous information network is jointly composed of multiple types of nodes and edges, and the relationships between different types of nodes and edges are distinguished by a mapping function.

[0071] Specifically, the meta-path neighborhood view construction module is used to define the target node i and extract the meta-path neighborhood of the target node i based on the predefined meta-path. By aggregating the neighborhood information, the meta-path neighborhood view representation of the target node i is obtained. ..

[0072] Specifically, the node attribute view construction module is used to calculate the cosine similarity between the attributes of the target node i, construct an attribute similarity graph based on the set similarity threshold as the node attribute view, and obtain the node attribute view representation of the target node i by aggregating the attribute information of the neighbor nodes. .

[0073] Specifically, the node sampling module is used to count the number of meta-path connections between the target node i and other nodes, and select the top k nodes with the largest number of connections as the positive sample set. .

[0074] Specifically, the contrast optimization module is used to project the meta-path neighborhood view representation and the node attribute view representation into a unified feature space, and optimize them using a difficulty-aware contrast loss function to align the node representations under different views.

[0075] Specifically, the recommendation module is used to select the meta-path neighborhood view representation as the node representation of the target node i, calculate the similarity between the target node i and the representations of other nodes and sort them, and select the top k targets with the highest similarity to the target node i as the recommendation results.

[0076] Based on the same inventive concept, the present application also provides a computer-readable storage medium storing a computer program, which when executed by a processor, is used to implement the social recommendation method based on the contrast of structural and semantic dual views as described above.

[0077] The program product for implementing the above method in the present application can be a portable compact disc read-only memory and includes program code, and can run on a terminal device, such as a personal computer. However, the program product of the present application is not limited to this. In the present application, the readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, device, or device.

[0078] It should be noted that a computer-readable storage medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries the readable program code. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable storage medium may also be any readable medium other than the computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical fiber cable, RF, etc., or any suitable combination of the above.

[0079] The above are only the preferred embodiments of the present application, and do not impose any formal limitations on the present application. Although the present application has been disclosed above with the preferred embodiments, it is not intended to limit the present application. Any person skilled in the art of the present application can make some modifications or decorations to be equivalent embodiments with equivalent changes within the scope of the technical solution of the present application using the technical content prompted above. The implementation schemes in the above embodiments can also be further combined or replaced. However, any simple modification, equivalent change, and decoration made to the above embodiments based on the technical essence of the present application without departing from the content of the technical solution of the present application still belong to the scope of the present application's solution.

Claims

1. A social recommendation method based on the comparison of structural and semantic dual views, characterized in that Including the following steps: S1. Construct a heterogeneous information network: Model the social network data to be processed as a heterogeneous information network, which is jointly composed of multiple types of nodes and edges, and the relationships between different types of nodes and edges are distinguished by a mapping function; S2. Construct a meta-path neighborhood view: Define the target node , extract the meta-path neighborhood of the target node based on a predefined meta-path ; , and obtain the meta-path neighborhood view representation of the target node by aggregating the neighborhood information ; ; S3. Construct a node attribute view: Calculate the target node The cosine similarity between the target node and other nodes, construct an attribute similarity graph based on a set similarity threshold, as the node attribute view, and obtain the node attribute view representation of the target node i by aggregating the attribute information of neighbor nodes ; S4. Positive sample sampling based on meta-path connection: Statistical target nodes The number of meta-path connections between other nodes, and select the top k nodes with the largest number of connections as the positive sample set ; S5. Cross-view contrast optimization: The meta-path neighborhood view representation obtained from S2 and S3 and the node attribute view representation are projected into a unified feature space and optimized using a difficulty-aware contrastive loss function to align the node representations under different views; S6. Make recommendations based on the node representations after contrast optimization: Select the meta-path neighborhood view representation As the node representation of the target node Calculate the similarity between the target node And other node representations and sort them. Select the top-k targets with the highest similarity to the target node As the recommendation result.

2. The method according to claim 1, wherein The node types in S1 include users, topics, groups, and regions, and the edge types include user-interact-topic, user-belong-to-group, and user-locate-in-region.

3. The method according to claim 1, characterized in that, Extract target nodes based on predefined meta-paths in S2 of the meta-path neighborhood , including: centering on the target node , collect all nodes reached from the target node i through the predefined meta-path and their connection relationships, to form a local structure subgraph centered on the target node , which is the meta-path neighborhood . Take the local structure subgraph as the meta-path neighborhood view of the target node .

4. The method according to claim 1, wherein Obtain the target node in S2 meta-path neighborhood view representation including: Set a predefined set of meta-paths , extract target nodes based on the predefined meta-paths of the meta-path neighborhood , where represents the set of nodes in the meta-path neighborhood , and represents the set of edges in the meta-path neighborhood; In each meta-path neighborhood the graph convolutional neural network is used to aggregate and encode node information, and the node representation under each meta-path neighborhood is obtained, which is expressed as: ; Among them, represents the target node the node representation under the meta-path is the degree of the node in the meta-path neighborhood is the activation function represents the representation of the node is represents the nodes in the meta-path neighborhood ; After obtaining the node representations under each meta-path neighborhood, adaptive fusion of information from different meta-path neighborhoods is achieved through an attention mechanism, including: First, calculate the global weight of each meta-path which is expressed as: ; Among them, , and are learnable parameters, represents the global weight of the meta-path , represents the transpose of the learnable parameter , represents the activation function, represents the number of target nodes; Subsequently, the node representations in different meta-path neighborhoods are weighted and aggregated to obtain the target node 's meta-path neighborhood view representation , which is expressed as: ; Among them, represents the total number of meta-paths, represents the current meta-path subscript, represents the traversal variable during normalization of weights, represents the weight parameter of the th meta-path, and exp represents the exponential function 5. The method according to claim 1, wherein Calculating the target node in S3 The cosine similarity between it and other nodes, constructing an attribute similarity graph based on a set similarity threshold as the node attribute view, including: Extract target nodes and other nodes of the attribute feature vectors, and calculate the cosine similarity between the target node and other nodes as follows: ; Among them, represents the cosine similarity between node i and node j, and represent the target node and the attribute feature vectors of other nodes ; and respectively represent the and 's norms. Define the cosine similarity threshold , if the cosine similarity exceeds the cosine similarity threshold , then an undirected edge is established in the node attribute view to form a node attribute similarity graph; On the constructed node attribute view, aggregate the attribute information for each node. For the target node i, collect the neighbor nodes of the target node in the node attribute view, and aggregate the attribute feature vectors of the neighbor nodes through a graph convolutional neural network to obtain the node attribute view representation of the target node , which is expressed as: ; Among them, represents a learnable weight matrix, represents a node in the set of neighbor nodes in the node attribute view, represents a node representation.

6. The method according to claim 1, characterized in that Count the target nodes in S4 the number of meta-path connections between the target nodes and other nodes, and select the nodes with the top ranks of connection numbers as the positive sample set , including: For the target node and other nodes , count the node to see if it can establish a connection with the target node through different meta-paths, and define the number of meta-path connections between the target node and other nodes as follows: ; Among them, is an indicator function. If is a neighbor node under the meta-path , then this item is 1; otherwise, it is 0. Subsequently, select the node set with the top number of meta-path connections as the positive sample set of node . Nodes not included in the positive sample set are regarded as negative nodes and used as the negative sample set . .

7. The method according to claim 1, characterized in that, In S5, a difficulty-aware contrast loss function is used for optimization to align the node representations under different views, including: Is the target node Calculate the view difference degree to measure the target node And the structural differences between other nodes in the meta-path neighborhood view and the node attribute view, expressed as: ; Among them, is the view difference degree of the node ; and are respectively the number of neighbor nodes aggregated by the node in the meta-path neighborhood view and the node attribute view, and are respectively the number of neighbor nodes aggregated by the node in the meta-path neighborhood view and the node attribute view; means traversing all nodes to find the maximum value, is the index for traversing nodes; Calculate the similarity of the projection representations of the computing node under the meta-path neighborhood view and the node attribute view, and adjust the learning target nodes of the samples through a difficulty-aware contrastive loss function , which is expressed as: ; Among them, represents the difficulty-aware contrastive loss function of the node , which is used to calculate the cosine similarity between two vectors. is the temperature parameter, which is a hyperparameter for adjusting the difficulty perception intensity. represents the representation after projecting into the unified feature space, and represents the representation after projecting into the unified feature space. represents the traversed node index, and represents the union of the positive and negative sample sets of the node​​ Average the contrast losses of all nodes to obtain an overall optimization objective, expressed as: ; Among them, is the overall optimization goal, is the number of target nodes and represents the set of target type nodes.

8. The method according to claim 1, characterized in that Select the meta-path neighborhood view representation in S6 As the target node Of the node representation, calculate the target node The similarity with other node representations and sort them, select the one with the highest similarity to the target node The highest similarity Top-k Targets, as the recommendation results, including: Define the target node i as a user node ; For user nodes , calculate the meta-path neighborhood view representation of the user node and the meta-path neighborhood view representation of other user nodes to obtain the cosine similarity . Then sort the cosine similarities and select the users with the highest similarity Top-k as friend recommendations 9. A social recommendation system based on the comparison of structural and semantic dual views, characterized in that The social recommendation system includes: A heterogeneous information network construction module, which is used to model the social network data to be processed as a heterogeneous information network, which is jointly composed of multiple types of nodes and edges, and the relationships between different types of nodes and edges are distinguished by a mapping function; Meta-path neighborhood view construction module, which is used to define a target node , extract the meta-path neighborhood of the target node based on a predefined meta-path , and obtain the meta-path neighborhood view representation of the target node by aggregating neighborhood information ; ; Node attribute view construction module, which is used to calculate the cosine similarity between the attributes of the target node and construct an attribute similarity graph based on a set similarity threshold as the node attribute view, and obtain the node attribute view representation of the target node by aggregating the attribute information of neighbor nodes ; Node sampling module, which is used to count the target node the number of meta-path connections with other nodes, and select the top k nodes with the largest number of connections as the positive sample set ; The contrastive optimization module is used to project the meta-path neighborhood view representation and the node attribute view representation into a unified feature space and optimize it using a difficulty-aware contrastive loss function to align the node representations under different views; A recommendation module, which is used to select the meta-path neighborhood view representation as the target node representation, calculate the similarity between the target node and other node representations and sort them, and select the top-k targets with the highest similarity to the target node as the recommendation result.

10. A computer-readable storage medium storing a computer program, characterized in that, When executed by a processor, the computer program is used to implement the method according to any one of claims 1-8.

Citation Information

Patent Citations

  • Man-machine-object fusion system service recommendation method based on heterogeneous network representation learning

    CN112507224A

  • Knowledge graph embedding model training method based on comparative learning

    CN114741530A

  • Deep and dark network group discovery method based on network representation learning

    CN115965795A

  • Multi-view self-supervised learning recommendation method for heterogeneous information network

    CN117743685A

  • Social recommendation method based on multi-view fusion heterogeneous graph neural network

    CN117994007A