Recommendation method and device based on graph structure clustering, equipment and storage medium
Through the graph structure clustering method, the structure similarity of multiple neighbors is considered to divide the items into the same cluster, and when recommendation, it is preferred to recommend projects directly connected to the target project and not directly connected to the cluster, which solves the existing technology. The problem of insufficient recommendations for similar projects has achieved more diverse and accurate recommendation results.
Patent Information
- Application Number
- CN202410844797.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-11-08
AI Technical Summary
The recommendation method of existing projects (such as book recommendations) tends to recommend similar projects, ignoring related projects, resulting in the system's recommended projects being the same type, mainly because the existing clustering method divides the same type of projects into the same cluster. Failed to effectively recommend other items outside the cluster.
Using graph structure clustering method, the relationship of the project is constructed into a graph structure, and clustered by calculating the structural similarity of vertices. Considering all neighbors (h-neighbors) whose distance is not greater than h, the same cluster contains different types. When recommending projects, the projects directly connected to the target project and projects not directly connected in the cluster are preferred.
It realizes the division of different types of projects into the same cluster, and has strong correlation between them, which can recommend more suitable projects, including projects of the same type and the most relevant types, improving the diversity of recommendations and accuracy.
Smart Images

Figure CN118916718A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of graph structure technology, and in particular, to a recommendation method, apparatus, device, and storage medium based on graph structure clustering. Background Art
[0002] Most existing project recommendation methods (such as book recommendations) tend to recommend similar projects, but not related projects. This is mainly because existing clustering methods classify projects of the same type into the same cluster. When a user executes a project, the existing methods will only recommend other projects in the cluster where the project is located, while ignoring other projects outside the cluster. This results in the system recommending projects of the same type. Summary of the invention
[0003] The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.
[0004] The main purpose of the embodiment of the present invention is to propose a recommendation method based on graph structure clustering. The method constructs the relationship between various items into a graph structure, in which vertices represent items. If there are the same or similar keywords between two items, the vertices represented by the two items are connected by an edge. Then the above graph is clustered to divide the items into different clusters. Since the similarity is calculated using h-neighbors during clustering, when determining the structural similarity between two vertices, not only the traditional neighbors with a distance of 1 are considered, but all neighbors with a distance not greater than h, called h-neighbors, are considered. Therefore, different types of items are included in the same cluster, and there is a strong correlation between them.
[0005] To achieve the above object, a first aspect of an embodiment of the present invention provides a recommendation method based on graph structure clustering, and the recommendation method based on graph structure clustering includes:
[0006] If a target item is selected, determining a target cluster where the target item is located from among the plurality of clusters;
[0007] Selecting remaining items from the target cluster for recommendation;
[0008] The cluster selection process includes:
[0009] Constructing a graph structure according to a plurality of projects including the target project, wherein vertices in the graph structure are projects;
[0010] The structural similarity between every two vertices is calculated, and the multiple items are clustered according to the structural similarity; wherein the structural similarity is calculated by the structural neighborhood of the vertex, and the structural neighborhood of the vertex includes a plurality of neighboring vertices.
[0011] In some embodiments, the graph structure includes an undirected unweighted unipartite graph or an undirected unweighted bipartite graph.
[0012] In some embodiments, the graph structure comprises an undirected unweighted unipartite graph;
[0013] The formula for calculating the structural similarity between every two vertices includes:
[0014]
[0015] Among them, N h [u] and N h [v] represents the structural neighborhood of vertices u and v, respectively, d h [u] and d h [v] represents the number of neighbor vertices in the structural neighborhood of vertices u and v respectively. The structural neighborhood of vertex u is composed of multiple vertices whose distance to vertex u is not greater than h, and the structural neighborhood of vertex v is composed of multiple vertices whose distance to vertex v is not greater than h. h represents a natural number greater than 0.
[0016] In some embodiments, before clustering the plurality of items according to the structural similarity, the method further comprises:
[0017] Determine core vertices and non-core vertices in the plurality of items; wherein the core vertex refers to a vertex in a structural neighborhood whose number of vertices similar to the core vertex is greater than a threshold, and the non-core vertex refers to vertices other than the core vertex;
[0018] The clustering of the plurality of items according to the structural similarity comprises:
[0019] For any vertex u, initialize ed(u) to d h [u], initialize sd(u) to 0, and put vertex u in an unvisited state; ed(u) refers to d h [u] minus the number of vertices in its structural neighborhood that are structurally dissimilar to vertex u. sd(u) is N h The number of vertices in [u] that are similar in structure to vertex u;
[0020] The unvisited vertices u among multiple vertices are traversed in the following order:
[0021] Prioritize traversing the core vertices, and then traverse in descending order of ed(u);
[0022] If the current traversal reaches vertex u, according to vertex u and N h The structural similarity of each vertex in [u] is updated by vertex u and N h ed(u) and sd(u) between each vertex in [u];
[0023] Until ed(u)≤μ, μ is the threshold;
[0024] If vertex u is a core vertex, then the N h The core vertices in [u] that have similar structures to vertex u are grouped into the same cluster as vertex u;
[0025] Traverse each core vertex. If vertex u is a core vertex, replace the N h Non-core vertices in [u] that have a similar structure to vertex u are grouped into the same cluster as vertex u.
[0026] In some embodiments, selecting the remaining books from the target cluster for recommendation includes:
[0027] First, recommend items represented by other vertices that are directly connected to the vertex represented by the target item;
[0028] Then, an item in the target cluster that is not directly connected to the vertex represented by the target item is recommended.
[0029] In some embodiments, the item is a book.
[0030] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present invention provides a recommendation device based on graph structure clustering, the recommendation device based on graph structure clustering comprising:
[0031] A cluster selection unit, used for determining a target cluster where the target item is located from among a plurality of clusters if a target item is selected;
[0032] A recommendation unit, configured to select other items from the target cluster for recommendation; wherein the other items are different from the target item;
[0033] The cluster selection process includes:
[0034] Constructing a graph structure according to a plurality of projects including the target project, wherein vertices in the graph structure are projects;
[0035] The structural similarity between every two vertices is calculated, and the multiple items are clustered according to the structural similarity; wherein the structural similarity is calculated by the structural neighborhood of the vertex, and the structural neighborhood of the vertex includes a plurality of neighboring vertices.
[0036] In some embodiments, the recommendation unit is specifically used to:
[0037] First, recommend items represented by other vertices that are directly connected to the vertex represented by the target item;
[0038] Then, an item in the target cluster that is not directly connected to the vertex represented by the target item is recommended.
[0039] To achieve the above-mentioned purpose, the electronic device provided by the third aspect of an embodiment of the present invention includes: at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions that can be executed by the at least one control processor, and the instructions are executed by the at least one control processor so that the at least one control processor can execute the recommendation method based on graph structure clustering of the above-mentioned first aspect.
[0040] To achieve the above-mentioned purpose, a fourth aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the recommendation method based on graph structure clustering of the above-mentioned first aspect.
[0041] An embodiment of the present application provides a recommendation method based on graph structure clustering, the method comprising: if a target project is selected, determining a target cluster where the target project is located from a number of clusters; selecting the remaining projects from the target cluster for recommendation; wherein the remaining projects are different from the target project; the cluster selection process comprises: constructing a graph structure according to multiple projects including the target project, wherein the vertices in the graph structure are projects; calculating the structural similarity between each two vertices, and clustering the multiple projects according to the structural similarity; wherein the structural similarity is calculated by the structural neighborhood of the vertex, and the structural neighborhood of the vertex includes multiple neighbor vertices. The method constructs the relationship between various projects into a graph structure, wherein the vertex represents the project, and if there are the same or similar keywords between two projects, the vertices represented by the two projects are connected by an edge, and then the above graph is clustered to divide the projects into different clusters. Since the similarity is calculated using multiple neighbors during clustering, when determining the structural similarity between two vertices, not only the traditional neighbors with a distance of 1 are considered, but all neighbors with a distance not greater than a threshold are considered, so different types of projects are contained in the same cluster, and there is a strong correlation between them.
[0042] It can be understood that the beneficial effects of the second to fourth aspects compared with the related art are the same as the beneficial effects of the first aspect compared with the related art. Please refer to the relevant description in the first aspect, and no further details will be given here. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0044] Figure 1 is a schematic diagram of a flow chart of a recommendation method based on graph structure clustering provided by an embodiment;
[0045] Figure 2 is a schematic diagram of a clustering process provided by an embodiment;
[0046] Figure 3 is a book relationship diagram provided by an embodiment;
[0047] Figure 4 is a graph structure clustering result based on distance generalization provided by an embodiment;
[0048] Figure 5 The diagram is a schematic diagram of the structure of an electronic device provided by an embodiment. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0051] Before introducing the embodiments of the present application, the following prior art solutions are introduced:
[0052] (1) SCAN, a structural clustering algorithm for networks;
[0053] SCAN (Structural Clustering Algorithm for Networks) is a structural graph clustering method. The goal of SCAN is to discover clusters, hub nodes, and outlier nodes in large networks, and the identification of hub nodes and outlier nodes is crucial for many applications. To achieve this goal, the algorithm uses the neighborhood of vertices as clustering criteria. Vertices are grouped into clusters based on their structural similarities, which makes sense in some cases, such as when considering community detection in large social networks, two people with many common friends should be classified in the same community.
[0054] The basic assumption of SCAN is that if the structural similarity of two vertices is high enough, they should be divided into the same cluster. The algorithm defines the structural similarity between adjacent vertices, and if the structural similarity of two vertices is not less than a given parameter ε, they are considered to be structurally similar. SCAN builds clusters by detecting a special type of vertex, called a core vertex, which is a vertex that is closely adjacent to many similar vertices. The number of similar neighbors of a core vertex is evaluated by a given parameter μ. If a vertex does not belong to any cluster and its neighbors belong to multiple clusters, it is a hub node; otherwise, it is an outlier node. For a graph with m edges and n vertices, SCAN checks whether each vertex of the graph is a core vertex and builds a cluster by expanding the core vertex to all vertices that are structurally similar to the core vertex. The total cost of the algorithm is:
[0055] O(deg(v1)+deg(v2)+...+deg(vn))
[0056] where deg(vi), i = 1, 2, ..., n is the degree of vertex vi, so the running time is O(m). If the number of edges is unknown, the running time can also be derived from the number of vertices. In the worst case, each vertex is connected to all other vertices of a complete graph, so the total cost is O(n2).
[0057] (2) pSCAN, a structural clustering algorithm based on upper and lower bounds;
[0058] Before the pSCAN algorithm was proposed, accurate structural graph clustering usually used two methods: SCAN and SCAN++. The SCAN algorithm essentially calculates the structural similarity of each pair of adjacent vertices, which leads to a high computational cost. The design of SCAN++ is based on the property that vertices and their two-step away expectations share most of the neighborhood. Compared with SCAN, SCAN++ calculates less structural similarity. However, SCAN++ still requires a lot of computation of structural similarity.
[0059] The pSCAN algorithm improves the above two shortcomings to a certain extent. pSCAN is a new method to reduce the number of structural similarity calculations and optimize the structural similarity check between two vertices. First, the proposer made three observations on the structural graph clustering problem:
[0060] 1) There may be overlapping clusters in the structural graph clustering;
[0061] 2) The clusters of core vertices do not intersect;
[0062] 3) The cluster of non-core vertices is uniquely determined by the core vertices. Based on these observations, the authors developed a two-step structural graph clustering paradigm. First, the core vertices are clustered by dividing all core vertices into clusters, and then the non-core vertices are clustered by assigning each non-core vertex v to the cluster where the core vertex adjacent to it (with a structure similar to v) is located. On this basis, a structural graph clustering method based on pruned SCAN is proposed, called pSCAN. The basic idea is as follows: for each vertex v∈V, an effective degree ed(v) and a similarity sd(v) are incrementally maintained, and ed(v)≥sd(v); for vertex v, if sd(v)≥μ, it can be determined as a core vertex, and if ed(v)<μ, it is determined as a non-core vertex. This effectively identifies the set of core vertices. Then, the clusters of core vertices are calculated based on the transitive property. If (u,v)∈E and they are structurally similar, two core vertices u and v are assigned to the same cluster; in addition, if core vertices u and v have been assigned to the same cluster, the structural similarity between them is no longer calculated. Therefore, the pSCAN algorithm saves a lot of structural similarity calculations. To improve efficiency, pSCAN further uses three optimization techniques: cross-linking, pruning rules, and adaptive structural similarity checks, which speed up the check of structural similarity between two vertices without calculating the structural similarity of the two vertices.
[0063] (3) Index-based structural clustering algorithm GS-SCAN;
[0064] All previous solutions to the GS-SCAN algorithm focused on online calculation of all clusters with two precisely given parameters, and the optimal parameter settings depend on different graph properties and different user requirements, so the parameters need to be changed frequently. In addition, previous solutions all need to scan the entire graph, even if there are only a small number of vertices in the cluster. This may consume a lot of time for large graphs and is beyond the acceptable range.
[0065] Inspired by these challenges, the GS-SCAN algorithm exploits indexes to efficiently answer any given query with 0<ε≤1 and μ≥2, with a time complexity only proportional to the size of the resulting subgraph.
[0066] The improvement of the time complexity of the GS-SCAN algorithm depends largely on two indexes: core index and neighbor index. With given parameters μ and ε, the core index can effectively obtain all cores. The core index is based on two observations: first, the given parameter μ must be in the range of 2 to the maximum degree; second, if the degree of a vertex u is less than the parameter μ, then vertex u cannot be a core vertex. Combining these two observations, it is found that each vertex has a maximum value of ε under a specific μ, which makes the vertex a core vertex. This maximum value of ε is called the core threshold. For each possible parameter μ, the core threshold of all vertices is calculated, and all vertices are sorted in descending order according to the core threshold, and the core index can be obtained. Based on this index, all core vertices can be obtained given any reasonable parameters μ and ε, where the core threshold of vertex u is the structural similarity of the μth largest vertex among u's neighbors. The core index can determine all core vertices, while the neighbor index can determine whether the neighbors of each core vertex belong to the current cluster. The neighbor index can be obtained by sorting the neighbors of each vertex from large to small according to the structural similarity. Only neighbors with structural similarity greater than or equal to ε belong to the cluster where the core vertex is located. According to the neighbor index, the core threshold of each vertex can be obtained, thus linking the core index and the neighbor index, which is naturally used to cluster non-core vertices together.
[0067] The GS-SCAN algorithm is the first index-based structured graph clustering algorithm. The space complexity of the proposed index structure can be limited to O(m). Based on the index, the GS-SCAN algorithm can efficiently solve any query with possible μ and ε as parameters, and its time complexity is linearly related to the size of the result cluster, thus achieving optimal query efficiency. In addition, in order to make the solution applicable to large graphs, the index size of GS-SCAN is well limited, and the time cost of building the index is relatively acceptable.
[0068] Most existing project recommendation methods (such as book recommendations) tend to recommend similar projects, but not related projects. This is mainly because existing clustering methods classify projects of the same type into the same cluster. When a user executes a project, the existing methods will only recommend other projects in the cluster where the project is located, while ignoring other projects outside the cluster. This results in the system recommending projects of the same type.
[0069] Reference Figure 1 In one embodiment of the present application, a recommendation method based on graph structure clustering is provided. The recommendation method based on graph structure clustering includes the following steps S110 to S120:
[0070] Step S110: If a target item is selected, determine a target cluster where the target item is located from among a plurality of clusters.
[0071] Step S120: Select remaining items from the target cluster for recommendation.
[0072] In step S110, the project here can be a book, a song, etc., and the target project refers to the project being executed in the crowd project. For example, if the project is a book, the target project can be the book being viewed (browsed on a mobile app or a computer browser). The purpose of this embodiment is to recommend books of the same type and the most relevant type to the book that the user is viewing.
[0073] In step S110, the cluster selection process includes:
[0074] Step S1110: construct a graph structure based on multiple projects including the target project, wherein the vertices in the graph structure are projects.
[0075] Step S1120, calculating the structural similarity between every two vertices, and clustering the multiple items according to the structural similarity; wherein the structural similarity is calculated by the structural neighborhood of the vertex, and the structural neighborhood of the vertex includes multiple neighboring vertices.
[0076] In step S1110, the project selection process is set as a graph structure, that is, a vertex represents a project, and if two projects have the same or similar keywords, an edge is used to connect the vertices represented by the two projects.
[0077] In step S1120, compared with the prior art, the graph structure clustering model needs to calculate the number of common neighbors of two vertices when considering structural similarity. However, these models only consider neighbors with a distance of 1, that is, one-hop neighbors, which leads to certain difficulties in accurately capturing fine-grained structural information in the graph. This embodiment calculates the structural similarity between every two vertices. The structural similarity is calculated by the structural neighborhood of the vertex, and the structural neighborhood of the vertex includes multiple neighbor vertices. Multiple neighbor vertices form a neighborhood, and then the structural similarity is calculated, and then the structural similarity is used to cluster multiple items. In this way, since the similarity is calculated using multiple neighbor vertices during clustering, different types of items are included in the same cluster, and there is a strong correlation between them.
[0078] In step S120, the remaining items in the target cluster are selected for recommendation.
[0079] This method constructs the relationship between various projects into a graph structure, in which the vertices represent the projects, and then clusters the above structure to divide the projects into different clusters. Since the similarity is calculated using multiple neighbors during clustering, when determining the structural similarity between two vertices, not only the traditional neighbors with a distance of 1 are considered, but all neighbors with a distance not greater than h (threshold), called h-neighbors, are considered. Therefore, different types of projects are included in the same cluster, and there is a strong correlation between them. Recommending projects of the same type and the most relevant type based on the project the user is executing can find more suitable projects for recommendation.
[0080] In some embodiments of the present application, the graph structure includes an undirected unweighted unipartite graph or an undirected unweighted bipartite graph. Taking books as an example, when the graph structure includes an undirected unweighted bipartite graph, one vertex on one side represents a book, one vertex on the other side represents a user, and the edge represents a user's interest in a book. The bipartite graph obtained by such conversion can be clustered, and the obtained cluster contains not only book vertices but also user vertices.
[0081] In some embodiments of the present application, the graph structure includes an undirected unweighted unipartite graph;
[0082] The formula for calculating the structural similarity between each two vertices includes:
[0083]
[0084] Among them, N h [u] and N h [v] represents the structural neighborhood of vertices u and v, respectively, d h [u] and d h [v] represents the number of neighbor vertices in the structural neighborhood of vertices u and v respectively. The structural neighborhood of vertex u is composed of multiple vertices whose distance to vertex u is not greater than h, and the structural neighborhood of vertex v is composed of multiple vertices whose distance to vertex v is not greater than h. h represents a natural number greater than 0.
[0085] In this embodiment, the structural neighborhood of vertex u is represented by N h [u] is defined as the set of all vertices whose distance from vertex u is no greater than h, that is, N h [u] = {v∈V|d(u,v)≤h}, where d(u,v) represents the shortest path distance between vertex u and vertex v. Specifically, N h [u] is the set of all vertices that can be reached from vertex u via at most h edges, including vertex u itself. The number of vertices in the structural neighborhood of vertex u is called h-degree and is expressed as d h [u].
[0086] Structural similarity refers to the structural similarity between vertex u and vertex v, denoted as σh (u,v), is defined as N h [u] and N h [v] is the number of common vertices divided by the geometric mean of their cardinality. For any two vertices, if the structural similarity between them is greater than a given similarity threshold, they are said to be structurally similar. Intuitively, for two vertices, the more common vertices they have in their structural neighborhoods, the greater their structural similarity.
[0087] In some embodiments of the present application, before clustering the multiple items according to structural similarity in step S1120, the method further includes step S210:
[0088] Determine the core vertices and non-core vertices in the multiple items; wherein the core vertex refers to the vertex whose number of vertices with similar structures in the structural neighborhood is greater than a threshold, and the non-core vertex refers to the other vertices except the core vertex.
[0089] In this embodiment, h,ε-neighborhood means: for vertex u, its h,ε-neighborhood represents all vertices in its structural neighborhood that are similar to it, that is, N h,ε (u)={v∈N h [u]|σ k (u,v)≥ε}.
[0090] Core vertices refer to given structural similarity threshold 0<ε≤1 and integer μ≥1, if N h,ε (u)≥μ, then vertex u is a core vertex. If the vertex is not a core node, it is called a non-core node. μ represents the threshold.
[0091] Given parameters 0<ε≤1 and integer μ≥1, vertex u and vertex v are structurally reachable, meaning there exists a vertex sequence v1,v2,...,v l ∈V (integer l ≥ 2) satisfies:
[0092] v1=u and v l =v;
[0093] v1,v2,...,v l-1 It is a core node;
[0094] For any 1≤i≤l-1, v i+1 ∈N h,ε (v i ).
[0095] The step S1120 of clustering the multiple items according to structural similarity includes steps S1121 to S1127:
[0096] Step S1121: For any vertex u, initialize ed(u) to dh [u], initialize sd(u) to 0, and put vertex u in an unvisited state; ed(u) refers to d h [u] minus the number of vertices in its structural neighborhood that are structurally dissimilar to vertex u, sd(t) refers to N h The number of vertices in [u] that are structurally similar to vertex u.
[0097] The effective degree refers to: the effective degree of vertex u∈V, denoted as ed(u), is the h-degree of vertex u minus the number of vertices in its structural neighborhood that are determined to be structurally dissimilar to vertex u.
[0098] Similarity refers to: the similarity of vertex u∈V, denoted as sd(u), is the number of vertices in the structural neighborhood of vertex u that have been determined to be structurally similar to vertex u.
[0099] Step S1122: traverse the unvisited vertex u among the multiple vertices in the following order.
[0100] Step S1123, traverse the core vertices first, and then traverse in descending order of ed(u).
[0101] Step S1124: If the current traversal reaches vertex u, h The structural similarity of each vertex in [u] is updated by vertex u and N h ed(u) and sd(u) between each vertex in [u].
[0102] Step S1125, until ed(u)≤μ, μ is the threshold.
[0103] Step S1126: If vertex u is a core vertex, then h The core vertices in [u] that have a similar structure to vertex u are grouped into the same cluster as vertex u.
[0104] Step S1127: traverse each core vertex. If vertex u is a core vertex, replace the N h Non-core vertices in [u] that have a similar structure to vertex u are grouped into the same cluster as vertex u.
[0105] In some embodiments of the present application, the step S120 of selecting the remaining books from the target cluster for recommendation includes steps S1210 to S1220. Specifically:
[0106] Step S1210: First recommend items represented by other vertices that are directly connected to the vertex represented by the target item.
[0107] Step S1220: recommend items in the target cluster that are not directly connected to the vertex represented by the target item.
[0108] Reference Figure 2 In order to facilitate the understanding of those skilled in the art, the present application proposes a method for recommending books based on a structural clustering model based on distance generalization. The method can recommend books of the same type and the most relevant type based on the books that the user has read, so as to find the user's favorite books as much as possible. The embodiment proposes a structural clustering model based on distance generalization. When determining the structural similarity between two vertices, the model not only considers traditional neighbors with a distance of 1, but also considers all neighbors with a distance not greater than h, called h-neighbors. The structural clustering model constructs the relationship between various books into an undirected unweighted graph, in which the vertices represent books. If two books have the same or similar keywords, the vertices represented by the two books are connected by an edge. Then, the above-mentioned graph structure is clustered using a structural clustering model based on distance generalization, and the books are divided into different clusters. Since the similarity is calculated using h-neighbors during clustering, different types of books are contained in the same cluster, and there is a strong correlation between them.
[0109] A cluster C is a subset of V, contains at least two vertices (i.e. |C| ≥ 2), and satisfies the following conditions:
[0110] Maximality: If a core vertex u∈C, then all vertices structurally reachable from u also belong to C.
[0111] Connectivity; for any two vertices v1 and v2 in a cluster, they are structurally reachable.
[0112] Problem description: Given an undirected unweighted graph, parameters 0<ε≤1 and integers μ≥1 and h≥1, the purpose of the structural clustering model based on distance generalization is to find all clusters in the undirected unweighted graph.
[0113] The process includes:
[0114] Step S910: For any vertex u∈V, calculate d h [u], and initialize ed(u) to d h [u], sd(u) is initialized to 0, setting u to an unvisited state.
[0115] Step S920, traverse the unvisited vertices in V in the following order: if there is a vertex that has been determined as a core vertex, traverse it first; if there is no such vertex, traverse it in descending order of ed(u). For the currently traversed vertex u, calculate and record the structural similarity between u and each vertex in its structural neighborhood, determine whether the structures are similar, and update the similarity and effective degree of the two at the same time until ed(u)≤μ. After the above operation is performed, if u is a core vertex, the core vertices in its structural neighborhood that are similar to it and have been determined are divided into the same cluster as u.
[0116] Step S930: So far, the cluster division of all core vertices in the graph is obtained, and then each core vertex is traversed to divide the non-core vertices with similar structures in its structural neighborhood into the cluster where it belongs.
[0117] An important step of the distance generalization-based structural clustering provided in this embodiment is to determine whether a vertex is a core vertex. According to the above two definitions, if ed(u) of vertex u is less than a given parameter μ, then vertex u may be a non-core vertex; if sd(u) of vertex v is greater than or equal to parameter μ, then vertex u is a core vertex. Therefore, pruning can be performed based on this to avoid useless calculations.
[0118] When a user expresses interest in a book, the system searches the cluster where the book is located in the clustering structure and recommends other books in the cluster to the user. The recommendation order is as follows: books represented by other vertices directly connected to the vertex represented by the book are given priority, because such books have the same keywords or types; then books in the cluster that are not directly connected to the vertex represented by the book are recommended to the user. Although such books are not of the same type as the books that the user is currently interested in, the model results show that the two types of books have the same or similar characteristics in some aspects, so they can also be recommended to the user.
[0119] Previous graph structure clustering studies only considered neighbors with a distance of 1 and used this for modeling, while the graph structure clustering model considers neighbors with a vertex distance greater than or equal to 1 and uses this for community modeling. The resulting clustering results can further accurately capture the fine-grained structural information in the graph and mine cluster divisions with practical value.
[0120] Previous book or audiobook recommendation methods tend to recommend books of the same type. This embodiment not only recommends books of the same type, but also recommends related books of different types to users based on the modeling results.
[0121] For example, refer to Figure 3 is an undirected and unweighted graph constructed by book relationships. When given parameter ε = 0.8 and integer μ = 5, the existing graph structure clustering model cannot cluster it to obtain any clusters, while the graph structure clustering model based on distance generalization can cluster it to obtain two clusters, such as Figure 4 As shown, they are (v1,v2,v3,v4,v5) and (v8,v9,v 10 ,v 11 ,v 12 ), where v4 and v9 are core vertices.
[0122] It can be concluded that the graph structure clustering model based on distance generalization can capture the fine-grained structural information in the graph more accurately than the existing graph structure clustering model.
[0123] When a user expresses interest in a book in any cluster, the system can recommend other books in the cluster to the user.
[0124] The current embodiment scheme converts the relationship between books into an undirected unweighted unipartite graph and models it on this basis. However, the relationship between books and users can also be converted into an undirected unweighted bipartite graph, in which one vertex represents the book, the other vertex represents the user, and the edge represents the interest of a user in a book. The bipartite graph obtained by such conversion can also be clustered based on the graph structure of distance generalization, and the obtained cluster contains not only book vertices but also user vertices. In this way, when recommending books to users, not only books in the same cluster can be recommended, but also books liked by other users in the same cluster can be recommended.
[0125] This embodiment provides a recommendation device based on graph structure clustering, and the recommendation device based on graph structure clustering includes:
[0126] A cluster selection unit, used for determining a target cluster where the target item is located from among a plurality of clusters if a target item is selected;
[0127] A recommendation unit, used for selecting the remaining items from the target cluster for recommendation; wherein the remaining items are different from the target items;
[0128] The cluster selection process includes:
[0129] Construct a graph structure based on multiple projects including the target project, where the vertices in the graph structure are projects;
[0130] The structural similarity between every two vertices is calculated, and multiple items are clustered according to the structural similarity; wherein the structural similarity is calculated through the structural neighborhood of the vertex, and the structural neighborhood of the vertex includes multiple neighboring vertices.
[0131] It should be noted that the present device embodiment and the above-mentioned method embodiment are based on the same inventive concept, so the relevant contents of the above-mentioned method embodiment are also applicable to the present device embodiment and will not be repeated here.
[0132] like Figure 5 The present application also provides an electronic device, which includes:
[0133] at least one memory;
[0134] at least one processor;
[0135] at least one program;
[0136] The program is stored in the memory, and the processor executes at least one program to implement the above-mentioned recommendation method based on graph structure clustering in the present disclosure.
[0137] The electronic device may be any intelligent terminal including a mobile phone, a tablet computer, a personal digital assistant (PDA), a car computer, etc.
[0138] The electronic device according to the embodiment of the present application is described in detail below.
[0139] The processor 1600 may be implemented by a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present invention;
[0140] The memory 1700 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1700 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the program code is stored in the memory 1700, and the processor 1600 calls and executes the recommendation method based on graph structure clustering in the embodiment of the present invention.
[0141] Input / output interface 1800, used to implement information input and output;
[0142] The communication interface 1900 is used to realize the communication interaction between the device and other devices. The communication can be realized through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WIFI, Bluetooth, etc.);
[0143] Bus 2000 , which transmits information between various components of the device (e.g., processor 1600 , memory 1700 , input / output interface 1800 , and communication interface 1900 );
[0144] The processor 1600 , the memory 1700 , the input / output interface 1800 , and the communication interface 1900 are connected to each other in communication within the device via the bus 2000 .
[0145] An embodiment of the present invention further provides a storage medium, which is a computer-readable storage medium. The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the above-mentioned recommendation method based on graph structure clustering.
[0146] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0147] The embodiments described in the present invention are intended to more clearly illustrate the technical solutions of the embodiments of the present invention and do not constitute a limitation on the technical solutions provided by the embodiments of the present invention. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems.
[0148] Those skilled in the art will appreciate that the technical solutions shown in the figures do not limit the embodiments of the present invention and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0149] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0150] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0151] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0152] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0153] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0154] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0155] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0156] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable an electronic device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store programs.
[0157] The above is a specific description of the preferred implementation of the embodiments of the present application, but the embodiments of the present application are not limited to the above-mentioned implementation methods. Technical personnel familiar with the field can also make various equivalent modifications or substitutions without violating the spirit of the embodiments of the present application. These equivalent modifications or substitutions are all included in the scope defined by the claims of the embodiments of the present application.
Claims
1. A recommendation method based on graph structure clustering, characterized in that: The recommendation method based on graph structure clustering includes: If a target item is selected, determining a target cluster where the target item is located from among the plurality of clusters; Selecting remaining items from the target cluster for recommendation; The cluster selection process includes: Constructing a graph structure according to a plurality of projects including the target project, wherein vertices in the graph structure are projects; The structural similarity between every two vertices is calculated, and the multiple items are clustered according to the structural similarity; wherein the structural similarity is calculated by the structural neighborhood of the vertex, and the structural neighborhood of the vertex includes a plurality of neighboring vertices.
2. The recommendation method based on graph structure clustering according to claim 1, characterized in that: The graph structure includes an undirected unweighted unipartite graph or an undirected unweighted bipartite graph.
3. The recommendation method based on graph structure clustering according to claim 2, characterized in that: The graph structure includes an undirected unweighted unipartite graph; The formula for calculating the structural similarity between every two vertices includes: Among them, N h [u] and N h [v] represents the structural neighborhood of vertices u and v, respectively, d h [u] and d h [v] represents the number of neighbor vertices in the structural neighborhood of vertices u and v respectively. The structural neighborhood of vertex u is composed of multiple vertices whose distance to vertex u is not greater than h, and the structural neighborhood of vertex v is composed of multiple vertices whose distance to vertex v is not greater than h. h represents a natural number greater than 0.
4. The recommendation method based on graph structure clustering according to claim 3, characterized in that: Before clustering the plurality of items according to the structural similarity, the method further includes: Determine core vertices and non-core vertices in the plurality of items; wherein the core vertex refers to a vertex in a structural neighborhood whose number of vertices similar to the core vertex is greater than a threshold, and the non-core vertex refers to vertices other than the core vertex; The clustering of the plurality of items according to the structural similarity comprises: For any vertex u, initialize ed(u) to d h [u], initialize sd(u) to 0, and put vertex u in an unvisited state; ed(u) refers to d h [u] minus the number of vertices in its structural neighborhood that are structurally dissimilar to vertex u. sd(u) is N h The number of vertices in [u] that are similar in structure to vertex u; The unvisited vertices u among multiple vertices are traversed in the following order: Prioritize traversing the core vertices, and then traverse in descending order of ed(u); If the current traversal reaches vertex u, according to vertex u and N h The structural similarity of each vertex in [u] is updated by vertex u and N h ed(u) and sd(u) between each vertex in [u]; Until ed(u)≤μ, μ is the threshold; If vertex u is a core vertex, then the N h The core vertices in [u] with similar structures to vertex u are grouped into the same cluster as vertex u; Traverse each core vertex. If vertex u is a core vertex, replace the N h Non-core vertices in [u] that have a similar structure to vertex u are grouped into the same cluster as vertex u.
5. The recommendation method based on graph structure clustering according to claim 1, characterized in that: The selecting the remaining books from the target cluster for recommendation comprises: First, recommend items represented by other vertices that are directly connected to the vertex represented by the target item; Then, an item in the target cluster that is not directly connected to the vertex represented by the target item is recommended.
6. The recommendation method based on graph structure clustering according to any one of claims 1 to 5, characterized in that: The items in question are books.
7. A recommendation device based on graph structure clustering, characterized in that: The recommendation device based on graph structure clustering includes: A cluster selection unit, used for determining a target cluster where the target item is located from among a plurality of clusters if a target item is selected; A recommendation unit, configured to select other items from the target cluster for recommendation; wherein the other items are different from the target item; The cluster selection process includes: Constructing a graph structure according to a plurality of projects including the target project, wherein vertices in the graph structure are projects; The structural similarity between every two vertices is calculated, and the multiple items are clustered according to the structural similarity; wherein the structural similarity is calculated by the structural neighborhood of the vertex, and the structural neighborhood of the vertex includes a plurality of neighboring vertices.
8. The recommendation device based on graph structure clustering according to claim 7, characterized in that: The recommendation unit is specifically used for: First, recommend items represented by other vertices that are directly connected to the vertex represented by the target item; Then, an item in the target cluster that is not directly connected to the vertex represented by the target item is recommended.
9. An electronic device, characterized in that: include: at least one control processor and a memory for communicatively coupling with the at least one control processor; The memory stores instructions that can be executed by the at least one control processor, and the instructions are executed by the at least one control processor so that the at least one control processor can execute the recommendation method based on graph structure clustering as described in any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the recommendation method based on graph structure clustering according to any one of claims 1 to 6.
