Social recommendation method, system and medium based on structural and semantic dual-view comparison

By constructing a heterogeneous information network and node attribute view, and optimizing node representation using difficulty perception contrast loss function, the problem of insufficient information fusion in the existing social recommendation method is solved, and efficient unsupervised social recommendation is achieved.

CN120277278BActive Publication Date: 2025-08-15OCEAN UNIV OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing social recommendation methods are difficult to simultaneously process and integrate multiple entities and complex relationships in social networks, resulting in one-sided recommendation results, and relying on supervised learning requires a large amount of labeled data, ignoring the semantic information of user attributes.

Method used

Build a heterogeneous information network, and use the meta-path neighborhood view and node attribute view to optimize the difficulty-aware comparison loss function to align node representations under different views, realizing unsupervised multi-dimensional information fusion.

Benefits of technology

It improves the expression ability and recommendation effect of node representation, and can fully explore the multi-dimensional information of social networks without user social preference tags, and enhances the model's adaptability to complex network structures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120277278B_ABST
    Figure CN120277278B_ABST
Patent Text Reader

Abstract

This application relates to the field of social network recommendation and discloses a social recommendation method, system, and medium based on structural and semantic dual-view comparison. The method includes: S1, constructing a heterogeneous information network; S2, constructing a meta-path neighborhood view: defining a target node i, extracting the meta-path neighborhood #imgabs0# of the target node i based on a predefined meta-path, and obtaining the meta-path neighborhood view representation #imgabs1# of the target node i by aggregating the neighborhood information; S3, constructing a node attribute view; S5, cross-view comparison optimization: projecting the representations obtained in S2 and S3 respectively into a unified feature space, optimizing using a difficulty-aware comparison loss function, and aligning the node representations under different views; S6, making recommendations based on the node representations after comparison optimization. This application fully integrates the multi-dimensional information of the node, avoids information omission and information redundancy, and improves the expressiveness of the node representation, which can effectively improve the effect of social recommendation.
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 in particular to a social recommendation method, system, and medium based on structural and semantic dual-view comparison. Background Art

[0002] Social recommendation systems, based on in-depth analysis of user behavior data, can predict other users, groups, or content that users may be interested in, thereby providing personalized social recommendation services. Graph representation learning technology is widely used in the field of social recommendation. Existing methods aim to map nodes, edges, and other structures in heterogeneous social networks into low-dimensional vector spaces to facilitate subsequent tasks such as friend recommendation and community discovery. Existing methods have difficulty simultaneously processing and integrating multiple entities and complex relationships in social networks, resulting in one-sided recommendation results and an inability to fully capture users' social preferences. Most social recommendation algorithms rely on supervised learning and require a large amount of labeled data. However, in practical applications, clear social preference annotations are often scarce and costly to obtain. Existing methods generally focus on network structure information while ignoring the rich semantic information in user attributes, and are unable to effectively integrate structural and semantic features. Summary of the Invention

[0003] The technical problem to be solved by this application is to overcome the shortcomings of the existing technology and provide a social recommendation method, system and medium based on the comparison of structural and semantic dual views. In the absence of user social preference tags, the recommendation quality can be improved by constructing two complementary views, fully integrating multi-dimensional information such as the high-order structure, low-order structure and attribute semantics of the node, and avoiding information omission and information redundancy, thereby improving the expressive ability of node representation in heterogeneous information networks, and further improving the effect of social recommendation.

[0004] To achieve the above objectives, the first aspect of the present application provides a social recommendation method based on structural and semantic dual-view comparison, comprising the following steps:

[0005] S1. Constructing a heterogeneous information network:

[0006] The social network data to be processed is modeled as a heterogeneous information network, which is composed of multiple types of nodes and edges. The relationships between different types of nodes and edges are distinguished by mapping functions.

[0007] S2. Build meta-path neighborhood view:

[0008] Define the target node i and extract the meta-path neighborhood of the target node i based on the predefined meta-path , by aggregating neighborhood information, we can get the meta-path neighborhood view representation of target node i ;

[0009] S3. Build the node attribute view:

[0010] Calculate the cosine similarity between the target node i and other nodes, and construct an attribute similarity graph based on the set similarity threshold as the node attribute view. By aggregating the attribute information of neighboring nodes, the node attribute view representation of the target node i is obtained. ;

[0011] S4. Positive sample sampling based on meta-path connection:

[0012] Count the number of meta-path connections between target node i and other nodes, and select the top k nodes with the most connections as the positive sample set ;

[0013] S5. Cross-view comparison optimization:

[0014] Represent the meta-path neighborhood view obtained by S2 and S3 and node attribute view representation Projecting to a unified feature space, optimizing using a difficulty-aware contrast loss function to align node representations in different views;

[0015] S6. Recommendations based on the optimized node representations:

[0016] Selecting a metapath 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.

[0017] Optionally, the node types in S1 include user, topic, group, and region, and the edge types include user-interaction-topic, user-belongs-to-group, and user-is-located-region.

[0018] Optionally, in S2, the meta-path neighborhood of the target node i is extracted based on the predefined meta-path , including: taking the target node i as the center, collecting all the paths starting from the target node i through the predefined meta-paths The nodes reached and their connection relationships form a local structure subgraph centered on the target node i, which is the meta-path neighborhood , taking the local structure subgraph as the meta-path neighborhood view of target node i.

[0019] Optionally, the meta-path neighborhood view representation of the target node i is obtained in S2 ,include:

[0020] Set a set of predefined meta paths , extract the meta-path neighborhood of target node i based on the predefined meta-path ,in, Represents the metapath neighborhood The node set in Represents the metapath neighborhood The set of edges in ;

[0021] In each metapath neighborhood In

[15] , 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:

[0022] ;

[0023] in, Indicates that the target node i is in the meta-path The node representation below, For nodes In the metapath neighborhood The degree of is the activation function, Representation node The representation of j represents the meta-path neighborhood Nodes in

[0024] After obtaining the node representation under each meta-path neighborhood, the attention mechanism is used to achieve adaptive fusion of different meta-path neighborhood information, including:

[0025] First calculate each meta-path The global weight of is expressed as:

[0026] ;

[0027] in, 、 and is a learnable parameter, Represents a meta path The global weight of Represents learnable parameters The transpose of represents the activation function, Indicates the number of target nodes;

[0028] Then, the node representations under different meta-path neighborhoods are weightedly aggregated to obtain the target node Metapath neighborhood view representation of , expressed as:

[0029] ;

[0030] in, Indicates the total number of meta-paths, Indicates the current meta path index, represents the ergodic variable when normalizing the weights, Indicates the The weight parameter of the element path, p represents the exponential function .

[0031] Optionally, S3 calculates the cosine similarity between the target node i and other nodes, and constructs an attribute similarity graph based on a set similarity threshold as a node attribute view, including:

[0032] 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:

[0033] ;

[0034] in, represents the cosine similarity between node i and node j, and Indicates the target node and other nodes The attribute feature vector of and Respectively and of norm;

[0035] Define the cosine similarity threshold , if the cosine similarity exceeds the cosine similarity threshold , then undirected edges are established in the node attribute view to form a node attribute similarity graph;

[0036] On the constructed node attribute view, attribute information of each node is aggregated. For target node i, the neighbor nodes of target node i in the node attribute view are collected, and the attribute feature vectors of the neighbor nodes are aggregated through the graph convolutional neural network to obtain the node attribute view representation of target node i. , expressed as:

[0037] ;

[0038] in, represents the learnable weight matrix, Representation node In the node properties view, the neighbor node collection, Representation node representation.

[0039] Optionally, in S4, the number of meta-path connections between the target node i and other nodes is counted, and the nodes with the top k connections are selected as the positive sample set. ,include:

[0040] For the target node i and other nodes j, the statistical nodes Is it possible to connect to the target node through different meta paths? Establish connections, and define the number of meta-path connections between target node i and other nodes j as:

[0041] ;

[0042] in, is an indicator function, if for In the meta path If the node is a neighbor node, the value is 1, otherwise it is 0;

[0043] Then select the top ranked by the number of meta-path connections A node collection, as a node The positive sample set Nodes not included in the positive sample set are considered negative nodes as the negative sample set .

[0044] Optionally, S5 uses a difficulty-aware contrast loss function for optimization to align node representations in different views, including:

[0045] Target node Calculate the view difference and measure the target node The structural differences between nodes and other nodes in the meta-path neighborhood view and node attribute view are expressed as:

[0046] ;

[0047] in, is a node The view difference of and Node The number of neighbor nodes aggregated in the meta-path neighborhood view and node attribute view, and Node The number of neighbor nodes aggregated in the meta-path neighborhood view and node attribute view; For all nodes Traverse and find The maximum value of , j is the index used to traverse the node;

[0048] Calculate the similarity of the projection representation 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 contrast loss function , expressed as:

[0049] ;

[0050] in, Representation node The difficulty perception contrast loss function, Used to calculate the cosine similarity between two vectors, is the temperature parameter, is a hyperparameter that adjusts the perceived intensity of difficulty, Indicates that Representation after projection into unified feature space, Indicates that Representation after projection into unified feature space, Indicates the node index to be traversed, Representation node The union of the positive and negative sample sets;

[0051] The contrast loss of all nodes is averaged to obtain the overall optimization target, which is expressed as:

[0052] ;

[0053] in, is the overall optimization goal, is the target node the number of Represents a target type node collection.

[0054] 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:

[0055] Define target node i as user node i;

[0056] For user nodes , calculate user nodes Metapath neighborhood view representation of With other user nodes Metapath neighborhood view representation of Cosine similarity of , and sort the cosine similarity, select the top- users, recommended as friends.

[0057] To achieve the above objectives, the second aspect of the present application provides a social recommendation system based on structural and semantic dual-view comparison, the social recommendation system comprising:

[0058] A heterogeneous information network construction module, wherein the heterogeneous information network construction module is used to model the social network data to be processed into a heterogeneous information network, wherein the heterogeneous information network is composed of multiple types of nodes and edges, and the relationships between different types of nodes and edges are distinguished by mapping functions;

[0059] 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 neighborhood information, we can get the meta-path neighborhood view representation of target node i ;

[0060] The node attribute view construction module is used to calculate the cosine similarity between the attributes of the target node i, and construct an attribute similarity graph based on the set similarity threshold as the node attribute view. By aggregating the attribute information of the neighboring nodes, the node attribute view representation of the target node i is obtained. ;

[0061] Node sampling module, which is used to count the number of meta-path connections between target node i and other nodes, and select the top k nodes with the most connections as the positive sample set ;

[0062] A comparison optimization module is used to represent the meta-path neighborhood view and node attribute view representation Projecting to a unified feature space, optimizing using a difficulty-aware contrast loss function to align node representations in different views;

[0063] Recommendation module, which is used to select 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.

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

[0065] After adopting the above technical solution, this application has the following beneficial effects compared with the prior art:

[0066] Through the view comparison learning mechanism, this application can fully capture multi-dimensional information such as structure and semantics in social networks, significantly improving the richness of node representations. By introducing meta-path neighborhoods, this application can fully utilize meta-path structural information without redundancy, simultaneously capturing high-order structural information and low-order local structural information, thereby achieving multi-level modeling of complex network relationships. In the representation learning process, this application fully explores and utilizes the important semantic information contained in the node attributes themselves, making the final generated node representation more comprehensive.

[0067] This application adopts a difficulty-aware comparison strategy, which assigns greater weights to nodes that are already very different in the two views to make their representations consistent, thereby improving the consistency of node representations under multiple views and enhancing the model's adaptability to complex network structures; this application adopts a self-supervised learning paradigm, which does not rely on manually annotated label data and can fully mine the multi-dimensional information of social networks under unsupervised conditions, learn high-quality node representations, and apply them to friend recommendation tasks.

[0068] The specific implementation methods of the present application are further described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] The accompanying drawings are part of this application and are used to provide a further understanding of this application. The illustrative embodiments of this application and their descriptions are used to explain this application but do not constitute an undue limitation of this application. Obviously, the drawings described below are only some embodiments. For those of ordinary skill in the art, other drawings can be derived from these drawings without inventive effort.

[0070] In the drawings of the specification:

[0071] Figure 1 This is a flowchart of a heterogeneous social recommendation method based on the comparison of structural and semantic dual views;

[0072] Figure 2 It is a schematic diagram of the framework of the meta-path neighborhood view construction and encoding in this specific implementation method;

[0073] Figure 3 This is a schematic diagram of the framework for constructing and encoding node attribute views in this specific implementation method;

[0074] Figure 4 is a schematic diagram of a framework for cross-view comparison optimization in this specific implementation manner;

[0075] Figure 5 This is a structural diagram of a heterogeneous social recommendation system based on the comparison of structural and semantic dual views. DETAILED DESCRIPTION

[0076] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments will be clearly and completely described below in conjunction with the 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.

[0077] The following is a brief description of the related technologies mentioned in the background technology:

[0078] Social recommendation systems, based on in-depth analysis of user behavior data, can predict other users, groups, or content that users may be interested in, thereby providing personalized social recommendation services. In typical social networks, a large amount of diverse user information (such as age, hobbies, region, and profile) as well as interactive behaviors (such as following, liking, commenting, and joining groups together) are recorded. This rich data provides a foundation for understanding user social preferences. By analyzing this complex data and interactions and uncovering the underlying social needs and interest connections, high-quality social recommendations can be provided to users.

[0079] Based on this, see Figure 1 , this application provides a social recommendation method based on structural and semantic dual-view comparison, including the following steps:

[0080] S1. Constructing a heterogeneous information network:

[0081] The social network data to be processed is modeled as a heterogeneous information network, which is composed of multiple types of nodes and edges. The relationships between different types of nodes and edges are distinguished by mapping functions.

[0082] S2. Build meta-path neighborhood view:

[0083] Define the target node i and extract the meta-path neighborhood of the target node i based on the predefined meta-path , by aggregating neighborhood information, we can get the meta-path neighborhood view representation of target node i ;

[0084] S3. Build the node attribute view:

[0085] Calculate the cosine similarity between the target node i and other nodes, and construct an attribute similarity graph based on the set similarity threshold as the node attribute view. By aggregating the attribute information of neighboring nodes, the node attribute view representation of the target node i is obtained. ;

[0086] S4. Positive sample sampling based on meta-path connection:

[0087] Count the number of meta-path connections between target node i and other nodes, and select the top k nodes with the most connections as the positive sample set ;

[0088] S5. Cross-view comparison optimization:

[0089] Represent the meta-path neighborhood view obtained by S2 and S3 and node attribute view representation Projecting to a unified feature space, optimizing using a difficulty-aware contrast loss function to align node representations in different views;

[0090] S6. Recommendations based on the optimized node representations:

[0091] Selecting a metapath 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.

[0092] It should be noted that the execution subject of the social recommendation method based on structural and semantic dual-view comparison in this embodiment is a heterogeneous social recommendation device based on structural and semantic dual-view comparison, which 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. For example, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, etc., and the non-mobile electronic device can be a server and a personal computer, etc., which is not specifically limited in this application. The following describes the social recommendation method based on structural and semantic dual-view comparison in this embodiment by taking the execution subject as an example of a server.

[0093] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of this application, the meaning of "plurality" is two or more, unless otherwise clearly specified.

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

[0095] See Figure 1 In one feasible implementation, S1. Constructing a heterogeneous information network: Modeling the social network data to be processed as a heterogeneous information network, wherein the heterogeneous information network is composed of multiple types of nodes and edges, and the relationships between different types of nodes and edges are distinguished by mapping functions.

[0096] 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 ,in Represents a collection of nodes, represents the edge set, Represents a set of node attribute features. In order to describe the heterogeneity of nodes and edges, a node type set is introduced and edge type set , each node Mapping functions via types Specify its type, each edge Mapping functions via types Specify its type. The essence of heterogeneous information networks lies in the diversity of node types or edge types, that is, satisfying or .

[0097] In one feasible implementation, the node types in S1 include user, topic, group, and region, and the edge types include user-interaction-topic, user-belongs-to-group, and user-is-located-region.

[0098] In practical applications, taking common social network data as an example, nodes can include types such as users, topics, groups, and regions, while edges can include various types, such as "user-interaction-topic," "user-belongs-group," and "user-location-region." The relationships between different types of nodes and edges can be distinguished using the aforementioned mapping function. For example, a user node's attributes (or features) are a set of values that describe the node's properties. These attributes may include, but are not limited to, the user's age, gender, region, number of posts, personal profile, and interests. Each attribute can be one-hot encoded or converted into a vector using an encoder. The specific attributes can be flexibly selected based on the actual application scenario to comprehensively characterize the node's semantic and structural characteristics.

[0099] See Figure 1 and Figure 2 In one feasible implementation, in S2, the meta-path neighborhood of the target node i is extracted based on the predefined meta-path. , including: taking the target node i as the center, collecting all the paths starting from the target node i through the predefined meta-paths The nodes reached and their connection relationships form a local structure subgraph centered on the target node i, which is the meta-path neighborhood , taking the local structure subgraph as the meta-path neighborhood view of target node i.

[0100] It's important to note that existing methods for representing heterogeneous information networks typically only aggregate neighbors based on meta-paths, i.e., the endpoints of meta-paths. This approach ignores intermediate nodes within meta-paths, resulting in the underutilization of some semantic information. Existing methods aggregate meta-path instances, aggregating all nodes within each meta-path. Because multiple meta-paths often share common nodes, this approach leads to repeated aggregation of common nodes, resulting in information redundancy.

[0101] The meta-path neighborhood in this embodiment can capture the structure of the meta-path-based neighbors and the meta-path intermediate nodes without omission or redundancy. Specifically, with the target node i as the center, all nodes starting from the target node i and passing through the predefined meta-path are collected. The nodes reached and their connection relationships form a local structure subgraph centered on the target node i, which is the meta-path neighborhood ,This embodiment uses the local structure subgraph as the meta-path neighborhood view of the target node i, thereby ,taking both high-order and low-order structural information into a unified ,framework, avoiding redundancy and information omission.

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

[0103] Specifically, set a set of predefined meta-path sets For user nodes , along the metapath Traverse the heterogeneous graph and collect all the nodes from the user The nodes that can be reached through the meta-path and their connection relationships form a user node The local subgraph centered on is the meta-path neighborhood, denoted as ,in, Represents the metapath neighborhood The node set in Represents the metapath neighborhood The set of edges in .

[0104] Specifically, within each meta-path neighborhood, a graph convolutional neural network is used to aggregate and encode node information, i.e., meta-path neighborhood encoding. This is not limited to the graph convolutional neural network; other neural network encoders can also be used.

[0105] Specifically, for each node and each meta-path , which is in the subgraph The embedding on is obtained as follows:

[0106] ;

[0107] in, Indicates that the target node i is in the meta-path The node representation below, For nodes In the metapath neighborhood The degree of is the activation function, Representation node The representation of j represents the meta-path neighborhood Nodes in .

[0108] After obtaining the node representation under each meta-path neighborhood, we further introduce the attention between meta-path neighborhoods to achieve the adaptive fusion of multi-path neighborhood information, namely, meta-path neighborhood encoding. , first calculate each meta-path The global weight of is expressed as:

[0109] ;

[0110] in, 、 and is a learnable parameter, Represents the meta path The global weight of Represents learnable parameters The transpose of represents the activation function, Indicates the number of target nodes.

[0111] Specifically, the node representations under different meta-path neighborhoods are then weighted aggregated to obtain the user node The final meta-path neighborhood view representation of , expressed as:

[0112] ;

[0113] in, Indicates the total number of meta-paths, Indicates the current meta path index, represents the ergodic variable when normalizing the weights, Indicates the The weight parameter of the element path, p represents the exponential function .

[0114] It should be noted that, through the above steps, the node representation of this embodiment can fully integrate multiple structural semantic information, avoiding both redundant aggregation and semantic omission, thereby achieving efficient structural modeling of heterogeneous graphs.

[0115] In practical applications, for related friend recommendation tasks, the target node type is defined as a user node, and a meta-path that can reflect the relationship between users is selected. For example, user-topic-user means that two users participate in the same topic; user-group-user means that two users are in the same group; user-region-user means that two users are in the same region.

[0116] Specifically, firstly, we extract the meta-path neighborhood based on the predefined meta-path. Taking the user-topic-user meta-path as an example, for each user node, we enumerate all other user nodes reachable through the user-topic-user meta-path and extract their meta-path neighborhood. Then, for each user node based on the meta-path, we extract the meta-path neighborhood. Extracted meta-path neighborhood , use formula (1) to aggregate the neighbor nodes in each meta-path neighborhood to obtain the user node In the metapath neighborhood Node representation under Next, the attention mechanism is used to aggregate the representations of nodes in different meta-path neighborhoods. Specifically, the global weight of each meta-path neighborhood is calculated according to formula (2): , and characterize the nodes according to formula (3) Complete weighted aggregation and obtain user nodes Meta-path neighborhood view representation under the meta-path neighborhood view .

[0117] It is worth noting that this embodiment is a user node It aggregates its neighbor nodes based on the meta-path neighborhood, and contains both low-order structural information and high-order structural information; among them, low-order structural information includes topic nodes and group nodes, and high-order structural information includes user nodes connected by various meta-paths.

[0118] See Figure 1 and Figure 3 In another feasible implementation, the cosine similarity between the target node i and other nodes is calculated in S3, and an attribute similarity graph is constructed based on a set similarity threshold as a node attribute view.

[0119] It should be noted that this embodiment aims to mine potential semantic connections from the node attribute space and supplement the node representation with semantic information beyond the structural view.

[0120] Specifically, this embodiment includes node attribute view construction and node attribute view encoding. First, based on the attribute features of the nodes, a node attribute view is constructed, the attribute feature vectors of the target node i and other nodes j are extracted, and the cosine similarity between the target node i and other nodes j is calculated. Using cosine similarity as the similarity metric, the feature similarity between the target node i and other nodes j is calculated, which is expressed as:

[0121] ;

[0122] in, represents the cosine similarity between node i and node j, and Indicates the target node and other nodes The attribute feature vector of and Respectively and of norm.

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

[0124] On the constructed node attribute view, attribute information of each node is aggregated. Specifically, for the target node i, its neighbor nodes in the attribute view are collected, and the attribute feature vectors of the neighbors are aggregated using a graph convolutional neural network. There is no limitation on the graph convolutional neural network here, and other neural network aggregators can also be selected to obtain the node attribute view representation of the target node i. , expressed as:

[0125] ;

[0126] in, represents the learnable weight matrix, Representation node Neighbors collection in the node properties view, Representation node representation.

[0127] In practical applications, for the friend recommendation task, the target node type is the user node. The attribute information of each user is collected, such as the user's age, gender, number of posts, personal profile and interest description, and encoded into a vector. Then, the cosine similarity between all user node attribute vectors is calculated according to formula (4), and the attribute similarity matrix is obtained. Next, a new attribute similarity graph is constructed based on the set threshold: if the attribute similarity of two users is greater than the threshold, an edge is connected in the new graph. Finally, according to formula (5), a graph convolutional neural network or other neural network encoder is applied to the attribute similarity graph to aggregate the attribute information of neighbor nodes and obtain the node attribute view representation of each user under the attribute view. .

[0128] It should be noted that this embodiment fully mines and utilizes the semantic information contained in the attributes of the user node, such as age, gender, number of posts, personal profile and interest description, etc., which fully reflects the characteristics of the user and is more conducive to mining similar user nodes.

[0129] See Figure 1 and Figure 4 In one feasible implementation, in S4, the number of meta-path connections between the target node i and other nodes is counted, and the nodes with the top k connections are selected as the positive sample set. .

[0130] It should be noted that this embodiment aims to efficiently collect a set of positive samples with strong structural correlation in the unsupervised contrastive learning stage, thereby improving the structural sensitivity of node representation.

[0131] Specifically, this embodiment considers that if two nodes can be connected by multiple meta-paths, their structural similarity is strong. Is it possible to connect to the target node through different meta paths? Establish connections, and define the number of meta-path connections between target node i and other nodes j as:

[0132] ;

[0133] in, is an indicator function, if for In the meta path If the node is a neighbor node, the value is 1, otherwise it is 0.

[0134] Specifically, the top meta-path connections are selected. The node set of The positive sample set Nodes not included in the positive sample set are considered negative nodes as the negative sample set .

[0135] In practical applications, according to formula (6), for each user node , statistics user nodes The number of connections between user nodes and other user nodes through the specified meta-path, i.e. user-topic-user, user-region-user, user-group-user. The top k user nodes with the most connections are selected as the positive sample set. Nodes not included in the positive sample set are considered negative nodes as the negative sample set , which is used for contrastive learning in subsequent steps.

[0136] See Figure 1 、 Figure 2 、 Figure 3 and Figure 4 ,In another implementation, a difficulty-aware contrast loss function is used for ,optimization in S5 to align node representations under different ,views.

[0137] It should be noted that this embodiment aims to use a cross-view comparison mechanism in the absence of user social preference tags 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 representation and recommendation effect.

[0138] Specifically, S2 and S3 first obtain the embedded representation of the node in the meta-path neighborhood view and the node attribute view respectively, which is the meta-path neighborhood view representation and node attribute view representation ,In order to eliminate the distribution differences of different views, the two embedding representations are projected into a unified feature space through a multi-layer perceptron MLP, which is expressed as:

[0139] ;

[0140] ;

[0141] in, is a learnable shared parameter, is a nonlinear activation function, Indicates that Representation after projection into unified feature space, Indicates that Representation after projection into unified feature space.

[0142] Specifically, considering that the information aggregated by a node in the two views may be quite different, this implementation adopts a difficulty-aware comparison strategy. For nodes that are already very different in the two views, a larger weight is given during training to make their representations consistent.

[0143] Specifically, the target node Calculate the view difference and measure the target node The structural differences between nodes and other nodes in the meta-path neighborhood view and node attribute view are expressed as:

[0144] ;

[0145] in, is a node The view difference of and Node The number of neighbor nodes aggregated in the meta-path neighborhood view and node attribute view, and Node The number of neighbor nodes aggregated in the meta-path neighborhood view and node attribute view; For all nodes Traverse and find The maximum value of , j is the index used to traverse the node.

[0146] Specifically, the similarity of the projection representation of the node in the meta-path neighborhood view and the node attribute view is calculated, and the learning target node of the sample is adjusted through the difficulty-aware contrast loss function. , expressed as:

[0147] ;

[0148] in, Representation node The difficulty perception contrast loss function, Used to calculate the cosine similarity between two vectors, is the temperature parameter, is a hyperparameter that adjusts the perceived intensity of difficulty, Indicates that Representation after projection into unified feature space, Indicates that Representation after projection into unified feature space, Indicates the node index to be traversed, Representation node The union of the positive and negative sample sets.

[0149] The contrast loss of all nodes is averaged to obtain the overall optimization target, which is expressed as:

[0150] ;

[0151] in, is the overall optimization goal, is the target node the number of Represents a target type node collection.

[0152] In practical applications, the meta-path neighborhood view and node attribute view are constructed and encoded by S2 and S3 respectively, and the user node Meta-path neighborhood view representation in the meta-path neighborhood view and the node attribute view representation in the node attribute view Then, according to formula (7) and formula (8), a multi-layer perceptron is used to project the representations of nodes in different views into a unified feature space, that is, and , Indicates that Representation after projection into unified feature space, Indicates that The representation after projection to the unified feature space. Then calculate the user node according to formula (9) The structural differences in the two views are then calculated according to formula (10) and combined with the obtained positive and negative sample sets to calculate the similarity of the projection representation of the user node in the two views, that is, the contrast loss of difficulty perception. According to formula (11), all user nodes The contrast loss is averaged to obtain the overall optimization goal of model training , and update the model parameters through back propagation to optimize the node representation.

[0153] It is worth noting that this embodiment uses a contrastive learning mechanism to enable different views to complement and supervise each other, and the representation of the same user in different views is more consistent. The user node representation finally learned simultaneously contains information in multiple dimensions such as low-order structure, high-order structure, and node attributes, thereby enhancing the comprehensive expression ability of representing multi-dimensional semantic and structural information.

[0154] In one possible implementation, the meta-path neighborhood view representation is selected 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.

[0155] Specifically, define the target node i as user node i, for user node , calculate user nodes Metapath neighborhood view representation of With other user nodes Metapath neighborhood view representation of Cosine similarity of , and sort the cosine similarity, select the top- users, recommended as friends.

[0156] In practical applications, after completing the multi-view heterogeneous graph representation and cross-view comparative learning, this embodiment applies the obtained node representation to the friend recommendation task in the social network. Through the aforementioned comparative optimization, the meta-path neighborhood view representation under the meta-path neighborhood view is selected. As the final node representation, for user node , calculate user nodes Characterization and other users Cosine similarity of representations , and sort the similarities, select the node with the user The most similar Top- Users can make friend recommendations.

[0157] Compared with the prior art, this application has the following advantages:

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

[0159] To verify the effectiveness of this method, this example conducted a comprehensive performance evaluation of the node representation obtained in step S5. Specifically, two experiments, node classification and node clustering, were designed to verify the quality of the node representation. Macro-F1, Micro-F1, Normalized Mutual Information (NMI), and Adjusted Rand Index (ARI) were selected as evaluation metrics. Furthermore, this example selected HeCo, DMGI, and DGI as benchmark comparison methods, representing the current state-of-the-art in graph representation learning.

[0160] The detailed experimental results are shown in Tables 1 and 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.

[0161] Table 1: Comparison of node classification experiments between this application and existing methods:

[0162] 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

[0163] Table 2: Comparison of node clustering experiments between this application and existing methods:

[0164] 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

[0165] See Figure 5 Based on the same inventive concept, the present application also provides a social recommendation system based on structural and semantic dual view comparison. 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 comparison optimization module and a recommendation module.

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

[0167] 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 neighborhood information, we can get the meta-path neighborhood view representation of target node i . .

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

[0169] 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 most connections as the positive sample set. .

[0170] Specifically, the contrast optimization module is used to represent the meta-path neighborhood view and node attribute view representation Projected into a unified feature space, the difficulty-aware contrast loss function is used for optimization to align the node representations in different views.

[0171] Specifically, the recommendation module is used to 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.

[0172] 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 structural and semantic dual-view comparison as described above.

[0173] The program product of the present application for implementing the above-mentioned method may be a portable compact disk read-only memory and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present application is not limited thereto. In the present application, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0174] It should be noted that a computer-readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, which carries readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction 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 cable, RF, etc., or any suitable combination thereof.

[0175] The above is only a preferred embodiment of the present application and does not constitute any form of limitation to the present application. Although the present application has been disclosed as above with preferred embodiments, it is not intended to limit the present application. Any technician familiar with the present application can make some changes or modifications to equivalent embodiments with equivalent changes using the technical content suggested above without departing from the scope of the technical solution of the present application. The implementation schemes in the above embodiments can also be further combined or replaced. However, any simple modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present application that do not depart from the content of the technical solution of the present application still fall within the scope of the solution of the present application.

Claims

1. A social recommendation method based on structural and semantic dual-view comparison, characterized by: The following steps are involved: S1. Constructing a heterogeneous information network: The social network data to be processed is modeled as a heterogeneous information network, which is composed of multiple types of nodes and edges. The relationships between different types of nodes and edges are distinguished by mapping functions. S2. Build meta-path neighborhood view: Define the target node i and extract the meta-path neighborhood of the target node i based on the predefined meta-path By aggregating neighborhood information, we can get the meta-path neighborhood view representation of target node i. Set the predefined meta-path set P = {P1, P2, ..., P L }, extract the meta-path neighborhood of target node i based on the predefined meta-path in, Represents the metapath neighborhood The node set in Represents the metapath neighborhood The set of edges in ; In each metapath neighborhood In [15], a graph convolutional neural network is used to aggregate and encode node information to obtain the node representation under each meta-path neighborhood; After obtaining the node representation under each meta-path neighborhood, the adaptive fusion of different meta-path neighborhood information is realized through the attention mechanism, including: first calculating each meta-path P l The global weight of the target node i is then weighted and aggregated to obtain the meta-path neighborhood view representation of the target node i. S3. Build the node attribute view: Calculate the cosine similarity between the target node i and other nodes, and construct an attribute similarity graph based on the set similarity threshold as the node attribute view. By aggregating the attribute information of neighboring nodes, the node attribute view representation of the target node i is obtained. S4. Positive sample sampling based on meta-path connection: Count the number of meta-path connections between target node i and other nodes, and select the top k nodes with the most connections as the positive sample set S5. Cross-view comparison optimization: Represent the meta-path neighborhood view obtained by S2 and S3 and node attribute view representation Projecting to a unified feature space, optimizing using a difficulty-aware contrast loss function to align node representations in different views; S6. Recommendations based on the optimized node representations: Selecting a metapath 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.

2. The method according to claim 1, characterized in that 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-is-located-region.

3. The method according to claim 1, characterized in that In S2, the meta-path neighborhood of target node i is extracted based on the predefined meta-path Including: taking the target node i as the center, collecting all the paths starting from the target node i through the predefined meta-path P l The nodes reached and their connection relationships form a local structure subgraph centered on the target node i, which is the meta-path neighborhood The local structure subgraph is used as the meta-path neighborhood view of the target node i.

4. The method according to claim 1, wherein The meta-path neighborhood view representation of the target node i is obtained in S2 include: In each metapath neighborhood In [15], 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: in, Indicates that the target node i is on the meta-path P l The node representation under d i is the node i in the meta-path neighborhood The degree of σ is the activation function, h j represents the representation of node j, and j represents the meta-path neighborhood Nodes in First calculate each meta-path P l The global weight of is expressed as: Among them, a Ct 、W Ct and b Ct is a learnable parameter, Represents the meta-path p l The global weight of Represents the learnable parameter a Ct The transpose of , tanh represents the activation function, |V| represents the number of target nodes; Then, the node representations under different meta-path neighborhoods are weightedly aggregated to obtain the meta-path neighborhood view representation of the target node i. Expressed as: Among them, L represents the total number of meta-paths, l represents the current meta-path subscript, and m represents the traversal variable when normalizing the weight. represents the weight parameter of the mth meta-path, and exp represents the exponential function e x .

5. The method according to claim 1, characterized in that In S3, the cosine similarity between the target node i and other nodes is calculated, and an attribute similarity graph is constructed based on the set similarity threshold as a 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, s ij represents the cosine similarity between node i and node j, h i and h j represents the attribute feature vector of target node i and other nodes j, ||h i || and ||h j || represent h respectively i and h j The L2 norm of Define a cosine similarity threshold θ. If the cosine similarity exceeds the cosine similarity threshold θ, an undirected edge is established in the node attribute view to form a node attribute similarity graph. On the constructed node attribute view, attribute information of each node is aggregated. For target node i, the neighbor nodes of target node i in the node attribute view are collected, and the attribute feature vectors of the neighbor nodes are aggregated through the graph convolutional neural network to obtain the node attribute view representation of target node i. Expressed as: Among them, W Fs represents the learnable weight matrix, represents the neighbor node set of node i in the node attribute view, h n Represents the representation of node n.

6. The method according to claim 1, characterized in that In S4, the number of meta-path connections between the target node i and other nodes is counted, and the top k nodes with the highest number of connections are selected as the positive sample set. include: For target node i and other nodes j, count whether node j can establish a connection with target node i through different meta-paths, and define the number of meta-path connections between target node i and other nodes j as: Among them, 1(·) is the indicator function, if j is i in the element path P m If the node is a neighbor node, the value is 1, otherwise it is 0; Then select the node set with the top k number of meta-path connections as the positive sample set of node i Nodes not included in the positive sample set are considered negative nodes as the negative sample set.

7. The method according to claim 1, characterized in that S5 uses a difficulty-aware contrast loss function for optimization to align node representations in different views, including: Calculate the view difference for the target node i, which measures the structural difference between the target node i and other nodes in the meta-path neighborhood view and the node attribute view, expressed as: Among them, d i is the view difference of node i, and are the number of neighbor nodes aggregated by node i in the meta-path neighborhood view and node attribute view, and are the number of neighbor nodes aggregated by node j in the meta-path neighborhood view and node attribute view respectively; max j Indicates that all nodes j are traversed and found The maximum value of , j is the index used to traverse the node; Calculate the similarity of the projection representation of the node in the meta-path neighborhood view and the node attribute view, and adjust the learning target node i of the sample through the difficulty-aware contrast loss function, which is expressed as: in, represents the difficulty perception contrast loss function of node i, sim(.) is used to calculate the cosine similarity between two vectors, τ is the temperature parameter, and α is a hyperparameter that adjusts the difficulty perception intensity. Indicates that Representation after projection into unified feature space, Indicates that After projecting into the unified feature space, k represents the node index traversed. represents the union of the positive and negative sample sets of node i; The contrast loss of all nodes is averaged to obtain the overall optimization target, which is expressed as: in, is the overall optimization goal, |V| is the number of target nodes i, and V represents the set of target type nodes.

8. The method according to claim 1, characterized in that Neighborhood view representation of selector paths 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 i, calculate the meta-path neighborhood view representation of user node i Meta-path neighborhood view representation with other user node j Cosine similarity of The cosine similarity is sorted and the top-k users with the greatest similarity to user node i are selected as friend recommendations.

9. A social recommendation system based on structural and semantic dual view comparison, characterized by: The social recommendation system includes: A heterogeneous information network construction module, wherein the heterogeneous information network construction module is used to model the social network data to be processed into a heterogeneous information network, wherein the heterogeneous information network is composed of multiple types of nodes and edges, and the relationships between different types of nodes and edges are distinguished by mapping functions; 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 neighborhood information, we can get the meta-path neighborhood view representation of target node i. Set the predefined meta-path set P = {P1, P2, ..., P L }, extract the meta-path neighborhood of target node i based on the predefined meta-path in, Represents the metapath neighborhood The node set in Represents the metapath neighborhood The set of edges in ; In each metapath neighborhood In [15], a graph convolutional neural network is used to aggregate and encode node information to obtain the node representation under each meta-path neighborhood; After obtaining the node representation under each meta-path neighborhood, the adaptive fusion of different meta-path neighborhood information is realized through the attention mechanism, including: first calculating each meta-path P l The global weight of the target node i is then weighted and aggregated to obtain the meta-path neighborhood view representation of the target node i. The node attribute view construction module is used to calculate the cosine similarity between the attributes of the target node i, and construct an attribute similarity graph based on the set similarity threshold as the node attribute view. By aggregating the attribute information of the neighboring nodes, the node attribute view representation of the target node i is obtained. Node sampling module, which is used to count the number of meta-path connections between target node i and other nodes, and select the top k nodes with the most connections as the positive sample set A comparison optimization module is used to represent the meta-path neighborhood view and node attribute view representation Projecting to a unified feature space, optimizing using a difficulty-aware contrast loss function to align node representations in different views; Recommendation module, which is used to select 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.

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

Citation Information

Patent Citations

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

    CN112507224A

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

    CN117743685A