CN111966912B - Recommendation method and device based on knowledge graph, computer equipment and storage medium - Google Patents
Recommendation method and device based on knowledge graph, computer equipment and storage medium Download PDFInfo
- Publication number
- CN111966912B CN111966912B CN202010907984.7A CN202010907984A CN111966912B CN 111966912 B CN111966912 B CN 111966912B CN 202010907984 A CN202010907984 A CN 202010907984A CN 111966912 B CN111966912 B CN 111966912B
- Authority
- CN
- China
- Prior art keywords
- node
- nodes
- analyzed
- neighbor
- layer
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/953—Querying, e.g. by the use of web search engines
- G06F16/9535—Search customisation based on user profiles and personalisation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/36—Creation of semantic tools, e.g. ontology or thesauri
- G06F16/367—Ontology
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Animal Behavior & Ethology (AREA)
- Computational Linguistics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a recommendation method, a recommendation device, computer equipment and a storage medium based on a knowledge graph, wherein the recommendation method comprises the following steps: determining a node to be analyzed in the plurality of nodes, setting a relation weight value of the node to be analyzed and a first-layer neighbor node as a, and randomly calculating a relation weight value I from any neighbor node of the node to be analyzed to an L-layer node of the node to be analyzed, wherein I = a- (L-1) × (a/6); selecting nodes with the relation weight values from the nodes to be analyzed to other nodes larger than a preset value to generate recommended paths; and generating recommendation data between the node to be analyzed and other nodes according to the recommendation path. According to the invention, the relation strength values of other nodes are obtained from a single node by randomly calculating the nodes of the knowledge graph for multiple times, and then the nodes meeting the preset relation strength values are selected to generate the recommendation path, so that the problem that the accurate recommendation result cannot be obtained with high efficiency and low cost is solved.
Description
Technical Field
The invention relates to the field of data knowledge maps, in particular to a recommendation method and device based on a knowledge map, computer equipment and a storage medium.
Background
In a recommendation system based on a knowledge graph, the relationship strength between network nodes needs to be calculated so as to obtain a recommendation result based on the correlation between the network nodes, and when the relationship strength between the network nodes is calculated, various methods such as path search and similarity between the nodes are generally adopted, wherein the method of path search can reflect the correlation between two points better and has an important role in relationship strength calculation and relationship prediction.
The existing path searching method mainly comprises the following steps:
when the shortest path is adopted to measure the strength of the relationship between two points, the path information which reaches the target point first is adopted to calculate the strength of the relationship. However, such a method has a disadvantage that information is considered only from a local point of view, and the association is not considered from an overall point of view, and even if the shortest path between two points is long, the strength of the relationship is still strong if there are many paths between the two points.
When a full-path method is adopted to calculate all paths between two points, although the method is considered from the global perspective, for a large-scale map, more than one million paths can exist between the two points, and execution once has higher time and space cost, and the method can only be used as query and cannot calculate the relation weight of any two points in the map at one time.
Therefore, when the recommendation result is obtained through the relationship strength among nodes of the knowledge graph, the prior art also has the problem that the accurate recommendation result cannot be obtained efficiently and at low cost.
Disclosure of Invention
In view of the above, the present invention provides a recommendation method, apparatus, computer device and storage medium based on a knowledge graph, which are used to solve the problem that when a recommendation result is obtained through the strength of the relationship between nodes of the knowledge graph, an accurate recommendation result cannot be obtained with high efficiency and low cost.
First, in order to achieve the above object, the present invention provides a recommendation method based on a knowledge graph, where the knowledge graph includes a plurality of nodes, and the method includes:
determining a node to be analyzed in the plurality of nodes, setting a relation weight value of the node to be analyzed and a first-layer neighbor node as a, and randomly calculating a relation weight value I from any neighbor node of the node to be analyzed to an L-th-layer node of the node to be analyzed, wherein I = a- (L-1) × (a/6);
selecting nodes with the relation weight values from the nodes to be analyzed to other nodes larger than a preset value to generate recommended paths;
and generating recommendation data between the node to be analyzed and other nodes according to the recommendation path.
Further, the knowledge-graph includes user attribute nodes and product attribute nodes, and the method further includes:
generating user attribute nodes of the knowledge graph according to a user attribute table, and generating product attribute nodes of the knowledge graph according to a product attribute table, wherein the user attribute table comprises product purchase history records of users, and the product attribute table comprises attribute information of corresponding products; correspondingly, the generating of the recommendation data between the node to be analyzed and other nodes according to the recommendation path includes:
recommending the product attribute node information in the recommended path to the user attribute node in the recommended path.
Further, the determining a node to be analyzed in the plurality of nodes, setting a relationship weight value between the node to be analyzed and a first-layer neighbor node as a, and randomly calculating a relationship weight value I from any neighbor node of the node to be analyzed to an lth-layer node of the node to be analyzed includes:
initializing the relation weight values from the node to be analyzed to other nodes;
associating the node to be analyzed with the first-layer neighbor node;
assigning a value a to the relation weight from the node to be analyzed to the first-layer neighbor node;
randomly selecting any node in the first layer of neighbor nodes, defining the node as a first node, defining the adjacent node of the first node as a second layer of neighbor nodes, and associating the first node with the second layer of neighbor nodes;
and assigning the relation weight from the node to be analyzed to the second-layer neighbor node as a- (a/6).
Further, after the assigning the relationship weight from the node to be analyzed to the second-layer neighbor node as a- (a/6), the method further includes:
when any node in the second-layer neighbor nodes has a neighbor node, randomly selecting any node in the second-layer neighbor nodes to define the node as a second node, defining the neighbor node of the second node as a third-layer neighbor node, and associating the second node with the third-layer neighbor node;
assigning a relation weight from the node to be analyzed to the third-layer neighbor node as a-2 x (a/6);
and when the neighbor nodes exist in the L-th layer neighbor nodes and L is more than or equal to 6, assigning 0 to the nodes in the 6 th layer and the later layers.
Further, before generating the recommended path for the node with the relationship weight value from the node to be analyzed to the other node larger than the preset value, the method further includes:
and if the neighbor nodes of different levels of the first node complete the relation weight assignment or the first node has no neighbor node, randomly selecting other nodes except the first node in the neighbor nodes of the first layer to define the other nodes as new first nodes, and calculating the relation weight values L-1 of the new first nodes and the new neighbor nodes of different levels of the first nodes.
Further, before the selecting the node with the relationship weight value larger than the preset value to generate the recommended path, the method further includes:
and if a plurality of relationship weight values exist between the node to be analyzed and other nodes, averaging the corresponding relationship weight values to be used as the final relationship weight values of the node to be analyzed and other nodes.
Further, after generating the recommendation data among the plurality of nodes according to the recommendation path, the method further includes:
and uploading recommended data among the plurality of nodes generated according to the recommended path to a block chain.
To achieve the above object, the present invention further provides a knowledge-graph-based recommendation apparatus, the knowledge-graph including a plurality of nodes, the knowledge-graph-based recommendation apparatus including:
the weight calculation module is used for determining a node to be analyzed in the plurality of nodes, setting the relation weight value of the node to be analyzed and a first-layer neighbor node as a, and randomly calculating a relation weight value I from any neighbor node of the node to be analyzed to an L-th-layer node of the node to be analyzed, wherein I = a- (L-1) × (a/6);
the path searching module is used for selecting the nodes with the relation weight values from the nodes to be analyzed to other nodes larger than a preset value to generate recommended paths;
and the recommendation output module is used for generating recommendation data between the node to be analyzed and other nodes according to the recommendation path.
To achieve the above object, the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
To achieve the above object, the present invention also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the above method.
Compared with the prior art, the recommendation method, the recommendation device, the computer equipment and the storage medium based on the knowledge graph in the embodiment of the invention have the advantages that by randomly calculating the nodes of the knowledge graph for many times, starting from a single node, all relation strength values from the node to other nodes are obtained, and then the node meeting the preset relation strength value is selected to generate the recommendation path, so that the problem that an accurate recommendation result cannot be obtained efficiently at low cost is solved.
Drawings
FIG. 1 is a schematic diagram of an application environment of an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a knowledge-graph-based recommendation method according to a first embodiment of the present invention;
FIG. 3 is a schematic node diagram of an example knowledge-graph according to an embodiment of the present invention;
FIG. 4 is a schematic flow chart illustrating the process of calculating relationship weight values between nodes in FIG. 2;
FIG. 5 is a block diagram of a second embodiment of a knowledge-graph based recommender;
FIG. 6 is a diagram of a hardware structure of a third embodiment of the computer apparatus according to the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the description relating to "first", "second", etc. in the present invention is for descriptive purposes only and is not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between the embodiments may be combined with each other, but must be based on the realization of the technical solutions by a person skilled in the art, and when the technical solutions are contradictory to each other or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present invention.
Referring to fig. 1, a schematic diagram of an implementation environment of the embodiment of the invention is shown. The implementation environment includes: a user terminal 10 and a service terminal 12.
The user terminal 10 is an electronic device with network access function, and the device may be a smart phone, a tablet computer, a personal computer, or the like.
The user terminal 10 is installed with a program 11 that can access the server 12, and after the program 11 logs in to access the server 12 through an account and a password, the user can perform specific operations and inputs on the server 12.
The server 12 is a server, a server cluster formed by a plurality of servers, or a cloud computing center. The server 12 stores a program 13, the program 13 includes a front-end module and a back-end module, the front-end module and the back-end module can be called by an interface, and a user can perform specific operation and input on the program 13 after the program 11 logs in through an account and a password or accesses the program 13 of the server 12 through the account and the password.
In the present embodiment, the server 12 stores a plurality of databases and data tables. Different databases may obtain the data in the databases through the triggering instruction of the user 10.
In this embodiment, the database and data tables include, but are not limited to, a user attribute table and a product attribute table.
In other embodiments, the database may also be stored in different servers in the server 12 cluster, or in different network nodes connected via a network, or locally in the user segment 10.
The user terminal 10 and the service terminal 12 are connected through a network, which may include a plurality of network nodes, and the network may be the internet, a local area network, or a block chain network.
The knowledge graph-based recommendation method of the embodiment of the invention can be applied to the program 11 or the program 13 independently, can be applied to the program 11 and the program 13 in a distributed manner, or can be stored in a plurality of nodes of a network in a block chain manner.
Example one
According to the recommendation method based on the knowledge graph, probability calculation is carried out on multiple random jumps of nodes of the knowledge graph, the nodes can be started from a single node, all relation strength values from the node to other nodes are obtained through multiple calculations, then the nodes meeting the preset relation strength values are selected to generate the recommendation path, and the problem that accurate recommendation results cannot be obtained efficiently and at low cost is solved.
Referring to fig. 2, a knowledge graph based recommendation method of the present embodiment, where the knowledge graph includes a plurality of nodes, includes the following steps:
step S100, generating user attribute nodes of the knowledge graph according to a user attribute table, and generating product attribute nodes of the knowledge graph according to a product attribute table, wherein the user attribute table comprises product purchase history records of users, and the product attribute table comprises attribute information of corresponding products;
a knowledge graph is a graph-based data structure, consisting of nodes and edges, each node representing an "entity", and each edge being a "relationship" between entities.
In the process of establishing the knowledge graph, data are extracted from different data sources and then added into the knowledge graph according to a certain rule, wherein the data sources comprise structured data and unstructured data. And generating user attribute nodes of the knowledge graph according to the user attribute table, and generating product attribute nodes of the knowledge graph according to the product attribute table.
The user attribute table includes product purchase history of a user, and the product attribute table includes attribute information of a corresponding product.
Specifically, in the present embodiment, the knowledge graph is generated by extracting the user and the product history purchased by the user as data sources, as shown in fig. 3.
Nodes 1-14 are entities representing users, edges between nodes are relations between users, and the relations are established by whether products with the same or related attributes exist in the purchased product history records of the users or not.
After the association between the users is established according to the consumption habits of the users for purchasing the products and the knowledge graph is generated, the consumption data of other users having relevance with the users can be recommended to the specific users.
However, in the prior art, if only the shortest path between the nodes is adopted to measure the strength of the relationship between two points, the information is considered only from a local perspective, and even if the shortest path between the two points is long, if the paths existing between the two points are many, the nodes with strong relationship strength still conform to the recommendation condition and are not recommended, so that the recommended result is inaccurate.
If a full-path method is adopted to calculate all paths between two points, although the method is considered from the global perspective, for a large-scale map, more than one million paths can exist between the two points, and execution once has high time and space cost, and the method can only be used as query and cannot calculate the relation weight of any two points in the map at one time.
Step S200, determining a node to be analyzed in the plurality of nodes, setting a relation weight value between the node to be analyzed and a first-layer neighbor node as a, and randomly calculating a relation weight value I from any neighbor node of the node to be analyzed to a L-layer node of the node to be analyzed, where I = a- (L-1) × (a/6).
Wherein a is a preset value, for example, 1 or 100, and since the scheme of the embodiment of the present invention is to obtain the relationship weight between nodes, which is a contrast value in nature, any preset value a that is convenient for calculation can be implemented.
And L is more than or equal to 1, after the node to be analyzed is determined, the knowledge graph is in a tree structure, the node to be analyzed is a root node of the knowledge graph, a first layer neighbor node of the node to be analyzed is a layer 1 of a knowledge graph hierarchy, and a layer L node is a corresponding layer which extends from the root node to a leaf node.
The so-called tree structure is a data structure with hierarchical relationships among elements, and a logical relationship can be represented by an inverted tree. The root node is the topmost node of the tree, continues to be divided down into child nodes, and is a leaf node when the division continues until there are no more child nodes.
Specifically, a second layer neighbor node of the node to be analyzed, that is, a layer 2 of the knowledge graph hierarchy, and a node in the layer 2 is a child node of a first layer neighbor node of the root node, that is, an adjacent layer node of the first layer neighbor node, and is determined to be the second layer neighbor node.
For example, as shown in FIG. 3, node 1 is the root node, nodes 2,3,4, and 5 are first-level neighbor nodes of node 1, and nodes 6,7,8, 10, 11, 12, and 13 are second-level neighbor nodes of node 1.
When L =1, the node to be analyzed of the knowledge graph has only one layer of neighbor nodes, the relationship weights from the node to be analyzed to other nodes are endowed with the same weight value, namely the weights of the node to be analyzed of the knowledge graph and other nodes are all equal, and then the recommendation data of the node to be analyzed and other nodes with the same priority are directly generated.
When L is greater than 1, performing probability calculation by random jump in the neighbor nodes of the node to be analyzed, which is specifically described as follows:
in the embodiment, probability calculation is performed through multiple random jumps of the nodes of the knowledge graph, all relation strength values from the node to other nodes are obtained, and then the nodes meeting the preset relation strength values are selected to generate the recommendation paths, so that the problem that accurate recommendation results cannot be obtained efficiently and at low cost is solved.
Specifically, please refer to fig. 3 and 4, in step S200, a node to be analyzed in the plurality of nodes is determined, a relation weight value between the node to be analyzed and a first-layer neighbor node is set as a, and a relation weight value I from any neighbor node of the node to be analyzed to an lth-layer node of the node to be analyzed is randomly calculated, where I = a- (L-1) × (a/6) includes:
step S201, initializing the relation weight values from the node to be analyzed to other nodes;
in this embodiment, for example, node 1 is the determined node to be analyzed, initializing the relational weight l = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, of the node 1 to other nodes, the ith position represents the relationship weight of 1 to the ith node.
Step S202, the node to be analyzed and the first layer neighbor node are associated;
the adjacent nodes of the node to be analyzed are first-layer neighbor nodes, and in this embodiment, the nodes 2,3,4, and 5 are first-layer neighbor nodes of the node 1.
In other embodiments, if it is determined that the node 2 is a node to be analyzed, the nodes 1,6, and 7 are first-layer neighbor nodes of the node 2, if it is determined that the node 4 is a node to be analyzed, the nodes 1,8,9, and 14 are first-layer neighbor nodes of the node 4, if it is determined that the node 14 is a node to be analyzed, only the node 9 is a first-layer neighbor node of the node 14, and so on, when it is determined that any one of the nodes shown in fig. 3 is a node to be analyzed, the node position of the corresponding first-layer neighbor node is obtained by obtaining the neighbor node of the node to be analyzed as the first-layer neighbor node, and the node position is associated.
Step S203, assigning the relation weight from the node to be analyzed to the first layer neighbor node as a;
in the embodiment, since node 1 is the node to be analyzed, the neighboring nodes of node 1 are associated with nodes 2,3,4,5, and a is located at positions a of nodes 2,3,4, 5.
<xnotran> , a 1, I {1,1,1,1,0,0,0,0,0,0,0,0,0}. </xnotran> In other embodiments of the present invention, a may also be preset to other values, such as 100.
Step S204, randomly selecting any node in the first layer neighbor nodes, defining the node as a first node, defining the adjacent node of the first node as a second layer neighbor node, and associating the first node with the second layer neighbor node;
in this embodiment, the nodes 2,3,4, and 5 are first-layer neighbor nodes, and one node is randomly selected from the nodes 2,3,4, and 5 as the first node, for example, after the random selection, the node 4 is selected as the first node.
In this embodiment, the random selection of the first node is achieved by invoking a random selector, which has the principle of randomly selecting a piece of data among a large or known number of data by means of a random selection algorithm, for example, by adding a perturbation to an algorithm variable and subjecting the perturbation to a certain probability distribution (pseudo-random), by inputting the identity of the node 2,3,4,5, and then returning to obtain the corresponding random result.
In this embodiment, if the node 4 is randomly selected as the first node, the neighboring node (except for the associated node) associated with the node 4 is the node 8.
Step S205, the relation weight from the node to be analyzed to the second layer neighbor node is assigned as a- (a/6).
Since it is now associated with layer 2, the strength of the relationship decays as the path increases. As can be seen from the six degree relationship theory, when the relationship path reaches the sixth layer, the relationship strength can be approximated to 0, so the decrement coefficient of each layer is 1/6 ≈ 0.167, and the relationship weight I is updated as:
<xnotran> I = {1,1,1,1,0,0,1-0.167,0,0,0,0,0,0}, {1,1,1,1,0,0,0.833,0,0,0,0,0,0}. </xnotran>
In this embodiment, if any one of the second-layer neighbor nodes further has a neighbor node, the following steps are continuously executed, and if no neighbor node exists in any one of the second-layer neighbor nodes, the following steps are not executed, and the process goes to step S209.
For example, in this embodiment, if the node 8 further has the neighboring node 9, the following steps need to be executed, and if in step 204, the node 2 is randomly selected as the first node, the neighboring node associated with the node 2, the node 6 and the node 7, and the node 6 and the node 7 have no neighboring node, the step S209 is skipped to.
Correspondingly, if the node 2 is randomly selected as the first node and is associated with the neighbor node 6 and the node 7 of the node 2, the relationship weight value of the node 6 and the node 7 is obtained through calculation, and the correspondence I is as follows:
<xnotran> {1,1,1,1,0,1-0.167,1-0.167,0,0,0,0,0,0}, {1,1,1,1,0,0.833,0.833,0,0,0,0,0,0} </xnotran>
Step S206, when any node in the second layer neighbor nodes has a neighbor node, randomly selecting any node in the second layer neighbor nodes, defining the node as a second node, defining the neighbor node of the second node as a third layer neighbor node, and associating the second node and the third layer neighbor node;
for example, in this embodiment, since the node 8 has only one neighbor node 9, the node 9 is selected as the second node, the neighbor node of the node 9 is the node 14, and the node 14 is the third-layer neighbor node. In other embodiments, if the second node is another node and there is no neighbor node thereafter, it jumps to step S209.
Step S207, assigning a weight of the relationship from the node to be analyzed to the third-layer neighbor node as a-2 × a/6.
<xnotran> , 8 , 9, l {1,1,1,1,0,0,0.833,1-0.167-0.167,0,0,0,0,0}, {1,1,1,1,0,0,0.833,0.666,0,0,0,0,0}; </xnotran>
Step S208, when the third layer of neighbor nodes also have neighbor nodes, assigning the unassigned nodes to a- (L-1) × (a/6) from small to large according to the hierarchical sequence, wherein i is the hierarchical number of the current assigned nodes and the nodes to be analyzed;
since node 9 has neighbor nodes, it continues by randomly selecting neighbor nodes and then assigning their relation weights according to I = a- (L-1) × (a/6).
<xnotran> , , 9 14, 9 , 14, l {1,1,1,1,0,0,0.833,0.666,0,0,0,0,1-0.167-0.167-0.167}, 4 I = {1,1,1,1,0,0,0.833,0.666,0,0,0,0,0.499}; </xnotran>
Since the node 14 cannot be associated continuously at this time, the experiment is ended, the calculation is matched with {2,3,4,5,8,9,14}7 points, the weights are respectively corresponding to {1, 0.833,0.666 and 0.499}, the weights of the relationship among the other points are 0, and the assignment is ended.
In other embodiments, when there are neighbor nodes in the neighbor node at the L-th layer, and L is greater than or equal to 6, the value of 0 is assigned to the nodes at the 6 th layer and thereafter, because the relationship weight of the node is already approximately 0 at the 6 th layer according to the 6-degree spatial theory.
Step S209, if the neighbor nodes of different levels of the first node have completed the relationship weight assignment or the first node has no neighbor nodes, randomly selecting other nodes in the neighbor nodes of the first level, defining as new first nodes, and calculating the relationship weight values of the new first nodes and the neighbor nodes of different levels of the new first nodes.
E.g., by randomly selecting other ones of the first-level neighbor nodes, defining as new first nodes,
and if a plurality of relationship weight values exist between the node to be analyzed and other nodes, averaging the corresponding relationship weight values to be used as the final relationship weight values of the node to be analyzed and other nodes.
Specifically, according to the steps and the principle, other nodes except the first neighbor node in the neighbor nodes of the node to be analyzed are randomly selected, and the steps S201 to S208 are repeated; another weight combination may be obtained.
For example, if the node 2 is sampled at the neighbor node of the node 1 in the calculation, the node 2,3,4,5,6,7 will be hit finally, and correspondingly, if the node 2 is randomly selected as the first node, the neighbor node 6 and the node 7 associated to the node 2 are obtained by calculating the relationship weight value of the node 6 and the node 7, and the correspondence I is: <xnotran> {1,1,1,1,0,1-0.167,1-0.167,0,0,0,0,0,0}, {1,1,1,1,0,0.833,0.833,0,0,0,0,0,0} 2,3,4,5,6,7 {1,1,1,1,0.833,0.833 }); </xnotran>
<xnotran> , 1 {1,1,1,1,0.4165,0.4165,0.4165,0.333,0,0,0,0,0.2495}. </xnotran>
The relation weight value I1 obtained after the first random calculation is as follows:
{1,1,1,1,0,0,0.833,0.666,0,0,0,0,0.499};
the relationship weight value I2 obtained after the second random calculation is:
{1,1,1,1,0.833,0.833,0,0,0,0,0,0,0}
the final relationship weight I obtained after the averaging through the superposition calculation is:
{1,1,1,1,0.4165,0.4165,0.4165,0.333,0,0,0,0,0.2495};
specifically, since the nodes 2,3,4, and 5 are first-layer neighbor nodes and are assigned with the fixed value a, the relationship weight values of the nodes 2,3,4, and 5 and the node 1 are fixed no matter how many times the nodes are randomly calculated.
The relationship weight values of the nodes 6 and 7 after the first random calculation are 0, the relationship weight values of the nodes after the second random calculation are 0.833 and 0.4165 after the averaging, the relationship weight values of the nodes 8 and 14 after the first random calculation are 0.666 and 0.499 respectively, the relationship weight values of the nodes after the second random calculation are 0 and correspond to 0.333 and 0.2495 after the averaging.
In this embodiment, only 2 times of random calculation are set, and similarly, in other embodiments, the number of times of random calculation may be set to be greater than 2 times, and the relationship weight set from other nodes to the remaining nodes may be calculated by the same method.
In addition, if the results after two times of sampling are found, partial nodes still have no hits. By increasing the number of times of calculation, the probability of hitting the other nodes can be increased, so that the result is closer to the real situation.
For example, in the present embodiment, the node 10, the node 11, the node 12, and the node 13 do not hit, and in order to make the result more accurate, the number of computations may be increased to increase the probability of hitting the node 10, the node 11, the node 12, and the node 13.
Hit node 3 as the first node by the third random calculation, hit node 5 as the first node by the fourth random calculation, hit all the nodes finally after 4 random calculations,
the third randomly calculated relationship weight value I3 is:
{1,1,1,1,0,0,0,0,0.833,0.833,0,0,0};
the fourth randomly calculated relationship weight value I4 is:
{1,1,1,1,0,0,0,0,0,0,0.833,0.833,0}
the relation weight value after the average value of the corresponding 4-time superposition random calculation results is as follows:
{1,1,1,1,0.20825,0.20825,0.4165,0.1665,0.20825,0.20825,0.20825,0.20825,0.12475}。
step S300, selecting the nodes with the relation weight values from the nodes to be analyzed to other nodes larger than a preset value to generate recommended paths;
and step S400, generating recommendation data between the node to be analyzed and other nodes according to the recommendation path.
<xnotran> , , 2 , {1,1,1,1,0.4165,0.4165,0.4165,0.333,0,0,0,0,0.2495}; </xnotran> And recommending the product attribute node information in the recommended path to the user attribute node in the recommended path when the strength of relationship between the nodes is greater than 0.4, for example, recommending the user product purchase record of the corresponding node to other associated users. Correspondingly, if the weight value of the relationship between the node 2, the node 3, the node 4, the node 5, the node 7 and the node 7 is greater than 0.4, the recommendation data among the node 2, the node 3, the node 4, the node 5, the node 7, the node 8 and the node 1 is generated.
Specifically, in this embodiment, the product attribute node information in the recommended path is recommended to the user attribute node in the recommended path, for example, it is determined that the node to be analyzed is a product attribute node, that is, the node 1 is a product attribute node, that is, product purchase record information of a specific user, and in order to obtain a recommended user rule corresponding to the product, nodes having a relationship weight value greater than a preset value, for example, user attribute nodes in the nodes 2,3,4,5, 7, and 8, may be recommended.
<xnotran> 4 , {1,1,1,1,0.20825,0.20825,0.4165,0.1665,0.20825,0.20825,0.20825,0.20825,0.12475}, 0.2, 1,2,3,4,5,6,7,9, 10, 11, 12, 13 0.2, 1,2,3,4,5,6,7,9, 10, 11, 12, 13 1 . </xnotran>
In this embodiment, after generating the recommendation data among the plurality of nodes according to the recommendation path, step S400 further includes:
and uploading recommended data among the plurality of nodes generated by the recommended path to a block chain.
Generating recommendation data among the plurality of nodes based on the recommendation path to obtain corresponding digest information, specifically, generating the recommendation data among the plurality of nodes based on the recommendation path to obtain the digest information by performing hash processing, for example, using sha256s algorithm. Uploading the summary information to the blockchain can ensure the safety and the just transparency of the user. The user equipment can download the summary information from the blockchain so as to verify whether the recommendation data among the plurality of nodes generated by the recommendation path is tampered. The blockchain referred to in this example is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm, and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
According to the recommendation method based on the knowledge graph, probability calculation is carried out through multiple random jumps of nodes of the knowledge graph, all relation strength values from the node to other nodes can be obtained through multiple calculations from a single node, then the nodes meeting the preset relation strength values are selected to generate the recommendation path, and the problem that accurate recommendation results cannot be obtained efficiently and at low cost is solved.
Example two
Continuing to refer to FIG. 5, a block diagram of program modules of the knowledge-graph based recommender of the present invention is shown. In this embodiment, the knowledge-graph based recommendation device 20 may include or be divided into one or more program modules, which are stored in a storage medium and executed by one or more processors to implement the present invention and implement the above-described knowledge-graph based recommendation method. The program modules referred to in the embodiments of the present invention are a series of computer program instruction segments capable of performing specific functions, and are more suitable than the program itself for describing the execution process of the knowledge-graph based recommendation device 20 in the storage medium. The following description will specifically describe the functions of the program modules of the present embodiment:
a weight calculating module 202, configured to determine a node to be analyzed in the multiple nodes, set a relationship weight value between the node to be analyzed and a first-layer neighbor node as a, and randomly calculate a relationship weight value I from any neighbor node of the node to be analyzed to a L-layer node of the node to be analyzed, where I = a- (L-1) × (a/6);
the path searching module 204 is configured to select a node with a relation weight value from the node to be analyzed to another node greater than a preset value to generate a recommended path;
a recommendation output module 206, configured to generate recommendation data between the node to be analyzed and other nodes according to the recommendation path
EXAMPLE III
Fig. 6 is a schematic diagram of a hardware architecture of a computer device according to a third embodiment of the present invention. In the present embodiment, the computer device 2 is a device capable of automatically performing numerical calculation and/or information processing in accordance with a preset or stored instruction. The computer device 2 may be a rack server, a blade server, a tower server or a rack server (including an independent server or a server cluster composed of a plurality of servers), and the like. As shown in FIG. 6, the computer device 2 includes, but is not limited to, at least a memory 21, a processor 22, a network interface 23, and a knowledge-graph based recommender 20, which are communicatively coupled to each other via a system bus. Wherein:
in this embodiment, the memory 21 includes at least one type of computer-readable storage medium including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the storage 21 may be an internal storage unit of the computer device 2, such as a hard disk or a memory of the computer device 2. In other embodiments, the memory 21 may also be an external storage device of the computer device 2, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, provided on the computer device 2. Of course, the memory 21 may also comprise both internal and external memory units of the computer device 2. In this embodiment, the memory 21 is generally used for storing an operating system installed in the computer device 2 and various types of application software, such as the program codes of the knowledge-graph based recommendation apparatus 20 described in the above embodiments. Further, the memory 21 may also be used to temporarily store various types of data that have been output or are to be output.
The network interface 23 may comprise a wireless network interface or a wired network interface, and the network interface 23 is generally used for establishing a communication connection between the computer apparatus 2 and other electronic devices. For example, the network interface 23 is used to connect the computer device 2 to an external terminal through a network, establish a data transmission channel and a communication connection between the computer device 2 and the external terminal, and the like. The network may be a wireless or wired network such as an Intranet (Intranet), the Internet (Internet), a Global System of Mobile communication (GSM), wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, bluetooth (Bluetooth), wi-Fi, and the like.
It is noted that fig. 6 only shows the computer device 2 with components 20-23, but it is to be understood that not all shown components are required to be implemented, and that more or less components may be implemented instead.
In this embodiment, the knowledge-graph based recommendation device 20 stored in the memory 21 can also be divided into one or more program modules, which are stored in the memory 21 and executed by one or more processors (in this embodiment, the processor 22) to complete the present invention.
Example four
The present embodiments also provide a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App application mall, etc., on which a computer program is stored, which when executed by a processor, implements corresponding functions. The computer-readable storage medium of the present embodiment is used for storing the knowledge-graph based recommendation apparatus 20, and when executed by the processor, the computer-readable storage medium implements the knowledge-graph based recommendation method according to the above embodiments.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.
Claims (8)
1. A knowledge-graph based recommendation method, wherein the knowledge-graph comprises a plurality of nodes, the method comprising:
determining a node to be analyzed in the plurality of nodes, setting a relation weight value of the node to be analyzed and a first-layer neighbor node as a, and randomly calculating a relation weight value I from any neighbor node of the node to be analyzed to an L-th-layer node of the node to be analyzed, wherein I = a- (L-1) × (a/6);
selecting nodes with the relation weight values from the nodes to be analyzed to other nodes larger than a preset value to generate recommended paths;
generating recommendation data between the node to be analyzed and other nodes according to the recommendation path;
the determining a node to be analyzed in the plurality of nodes, setting a relation weight value between the node to be analyzed and a first-layer neighbor node as a, and randomly calculating a relation weight value I from any neighbor node of the node to be analyzed to an lth-layer node of the node to be analyzed includes:
initializing the relation weight values from the node to be analyzed to other nodes;
associating the node to be analyzed with the first-layer neighbor node;
assigning a value a to the relation weight from the node to be analyzed to the first-layer neighbor node;
randomly selecting any node in the first layer of neighbor nodes, defining the node as a first node, defining the neighbor node of the first node as a second layer of neighbor nodes, and associating the first node and the second layer of neighbor nodes;
assigning the relation weight from the node to be analyzed to the second-layer neighbor node as a- (a/6); wherein the knowledge-graph comprises user attribute nodes and product attribute nodes, the method further comprising:
generating user attribute nodes of the knowledge graph according to a user attribute table, and generating product attribute nodes of the knowledge graph according to a product attribute table, wherein the user attribute table comprises product purchase history records of users, and the product attribute table comprises attribute information of corresponding products; correspondingly, the generating of the recommendation data between the node to be analyzed and other nodes according to the recommendation path includes:
recommending the product attribute node information in the recommended path to the user attribute node in the recommended path.
2. The knowledge-graph-based recommendation method of claim 1, wherein after the assigning the relationship weight of the node to be analyzed to the second-layer neighbor node as a- (a/6), further comprising:
when any node in the second-layer neighbor nodes has a neighbor node, randomly selecting any node in the second-layer neighbor nodes to define the node as a second node, defining the neighbor node of the second node as a third-layer neighbor node, and associating the second node with the third-layer neighbor node;
assigning a relation weight from the node to be analyzed to the third-layer neighbor node as a-2 x (a/6);
and when the neighbor nodes exist in the L-th layer neighbor nodes and L is more than or equal to 6, the nodes of the 6 th layer and the later layers are assigned to be 0.
3. The knowledge-graph-based recommendation method according to claim 2, wherein before selecting the node with the relationship weight value from the node to be analyzed to other nodes larger than a preset value to generate a recommendation path, the method further comprises:
and if the neighbor nodes of different levels of the first node complete the relation weight assignment or the first node has no neighbor nodes, randomly selecting other nodes except the first node in the neighbor nodes of the first layer to define the other nodes as new first nodes, and calculating the relation weight values of the new first nodes and the new neighbor nodes of different levels of the first nodes.
4. The knowledge-graph-based recommendation method of claim 3, wherein before selecting the node with the relationship weight value larger than the preset value to generate the recommendation path, further comprising:
and if a plurality of relationship weight values exist between the node to be analyzed and other nodes, averaging the corresponding relationship weight values to be used as the final relationship weight values of the node to be analyzed and other nodes.
5. The knowledge-graph-based recommendation method of claim 4, further comprising, after generating the recommendation data between the plurality of nodes according to the recommendation path:
and uploading recommended data among the plurality of nodes generated according to the recommended path to a block chain.
6. A knowledge-graph based recommendation apparatus, the knowledge-graph comprising a plurality of nodes, the knowledge-graph based recommendation apparatus comprising:
a weight calculation module, configured to determine a node to be analyzed in the multiple nodes, set a relationship weight value between the node to be analyzed and a first-layer neighbor node as a, and randomly calculate a relationship weight value I from any neighbor node of the node to be analyzed to an lth-layer node of the node to be analyzed, where I = a- (L-1) × (a/6);
the path searching module is used for selecting the nodes with the relation weight values from the nodes to be analyzed to other nodes larger than a preset value to generate recommended paths;
the recommendation output module is used for generating recommendation data between the node to be analyzed and other nodes according to the recommendation path;
wherein the weight calculation module is specifically configured to:
initializing the relation weight values from the node to be analyzed to other nodes;
associating the node to be analyzed with the first-layer neighbor node;
assigning a value a to the relation weight from the node to be analyzed to the first-layer neighbor node;
randomly selecting any node in the first layer of neighbor nodes, defining the node as a first node, defining the neighbor node of the first node as a second layer of neighbor nodes, and associating the first node and the second layer of neighbor nodes;
assigning the relation weight from the node to be analyzed to the second-layer neighbor node as a- (a/6); wherein the knowledge-graph includes user attribute nodes and product attribute nodes, the weight calculation module is further configured to:
generating user attribute nodes of the knowledge graph according to a user attribute table, and generating product attribute nodes of the knowledge graph according to a product attribute table, wherein the user attribute table comprises product purchase history records of users, and the product attribute table comprises attribute information of corresponding products; correspondingly, the generating of the recommendation data between the node to be analyzed and other nodes according to the recommendation path includes:
and recommending the product attribute node information in the recommended path to the user attribute node in the recommended path.
7. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the knowledge-graph based recommendation method of any one of claims 1 to 5 are implemented by the processor when executing the computer program.
8. A computer-readable storage medium having stored thereon a computer program, characterized in that: the computer program when being executed by a processor performs the steps of the knowledge-graph based recommendation method of any one of claims 1 to 5.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010907984.7A CN111966912B (en) | 2020-09-02 | 2020-09-02 | Recommendation method and device based on knowledge graph, computer equipment and storage medium |
PCT/CN2021/109760 WO2022048368A1 (en) | 2020-09-02 | 2021-07-30 | Recommendation method and apparatus based on knowledge graph, and computer device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010907984.7A CN111966912B (en) | 2020-09-02 | 2020-09-02 | Recommendation method and device based on knowledge graph, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111966912A CN111966912A (en) | 2020-11-20 |
CN111966912B true CN111966912B (en) | 2023-03-10 |
Family
ID=73392258
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010907984.7A Active CN111966912B (en) | 2020-09-02 | 2020-09-02 | Recommendation method and device based on knowledge graph, computer equipment and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN111966912B (en) |
WO (1) | WO2022048368A1 (en) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111966912B (en) * | 2020-09-02 | 2023-03-10 | 深圳壹账通智能科技有限公司 | Recommendation method and device based on knowledge graph, computer equipment and storage medium |
CN115685765A (en) * | 2021-07-21 | 2023-02-03 | 青岛海信智慧生活科技股份有限公司 | Equipment linkage scheme recommendation method, equipment and medium |
CN114676321A (en) * | 2022-03-18 | 2022-06-28 | 国网电子商务有限公司 | Recommendation method and device based on graph calculation, storage medium and electronic equipment |
CN114697188B (en) * | 2022-03-28 | 2023-03-03 | 天津大学 | Internet of things equipment risk prediction analysis method based on network situation awareness |
CN116319518B (en) * | 2022-08-31 | 2024-02-20 | 王举范 | Information acquisition method and device based on shortest path of knowledge graph |
CN116089624B (en) * | 2022-11-17 | 2024-02-27 | 昆仑数智科技有限责任公司 | Knowledge graph-based data recommendation method, device and system |
CN117033775B (en) * | 2023-07-28 | 2024-03-19 | 广东工业大学 | Knowledge graph-based industrial software component recommendation method and system |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109871445A (en) * | 2019-01-23 | 2019-06-11 | 平安科技(深圳)有限公司 | Fraudulent user recognition methods, device, computer equipment and storage medium |
CN109947817A (en) * | 2019-03-01 | 2019-06-28 | 武汉达梦数据库有限公司 | A kind of Six Degrees relationship analysis method and system based on association map |
CN110210892A (en) * | 2019-05-05 | 2019-09-06 | 平安科技(深圳)有限公司 | Products Show method, apparatus, readable storage medium storing program for executing and program product |
CN110335112A (en) * | 2019-06-18 | 2019-10-15 | 中国平安财产保险股份有限公司 | A kind of Products Show method, apparatus and computer storage medium |
CN111429255A (en) * | 2020-03-19 | 2020-07-17 | 中国建设银行股份有限公司 | Risk assessment method, device, equipment and storage medium |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140136508A1 (en) * | 2012-11-09 | 2014-05-15 | Palo Alto Research Center Incorporated | Computer-Implemented System And Method For Providing Website Navigation Recommendations |
US9547823B2 (en) * | 2014-12-31 | 2017-01-17 | Verizon Patent And Licensing Inc. | Systems and methods of using a knowledge graph to provide a media content recommendation |
CN108804633B (en) * | 2018-06-01 | 2021-10-08 | 腾讯科技(深圳)有限公司 | Content recommendation method based on behavior semantic knowledge network |
CN111274495B (en) * | 2020-01-20 | 2023-08-25 | 平安科技(深圳)有限公司 | Data processing method, device, computer equipment and storage medium for user relationship strength |
CN111966912B (en) * | 2020-09-02 | 2023-03-10 | 深圳壹账通智能科技有限公司 | Recommendation method and device based on knowledge graph, computer equipment and storage medium |
-
2020
- 2020-09-02 CN CN202010907984.7A patent/CN111966912B/en active Active
-
2021
- 2021-07-30 WO PCT/CN2021/109760 patent/WO2022048368A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109871445A (en) * | 2019-01-23 | 2019-06-11 | 平安科技(深圳)有限公司 | Fraudulent user recognition methods, device, computer equipment and storage medium |
CN109947817A (en) * | 2019-03-01 | 2019-06-28 | 武汉达梦数据库有限公司 | A kind of Six Degrees relationship analysis method and system based on association map |
CN110210892A (en) * | 2019-05-05 | 2019-09-06 | 平安科技(深圳)有限公司 | Products Show method, apparatus, readable storage medium storing program for executing and program product |
CN110335112A (en) * | 2019-06-18 | 2019-10-15 | 中国平安财产保险股份有限公司 | A kind of Products Show method, apparatus and computer storage medium |
CN111429255A (en) * | 2020-03-19 | 2020-07-17 | 中国建设银行股份有限公司 | Risk assessment method, device, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN111966912A (en) | 2020-11-20 |
WO2022048368A1 (en) | 2022-03-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111966912B (en) | Recommendation method and device based on knowledge graph, computer equipment and storage medium | |
CN110866181B (en) | Resource recommendation method, device and storage medium | |
CN105590055B (en) | Method and device for identifying user credible behaviors in network interaction system | |
US8706716B2 (en) | Iterative and dynamic search of publicly available data based on augmentation of search terms and validation of data relevance | |
EP2782029A2 (en) | Re-ranking results in a search | |
CN109933617B (en) | Data processing method, data processing device, related equipment and related medium | |
CN107895038B (en) | Link prediction relation recommendation method and device | |
US8028000B2 (en) | Data storage structure | |
CN104424254A (en) | Method and device for obtaining similar object set and providing similar object set | |
WO2018227773A1 (en) | Place recommendation method and apparatus, computer device, and storage medium | |
CN112800286B (en) | User relationship chain construction method and device and electronic equipment | |
CN112800197A (en) | Method and device for determining target fault information | |
CN108984735B (en) | Label Word library updating method, apparatus and electronic equipment | |
US20200193295A1 (en) | Verifizierung und identifizierung eines neuronalen netzes | |
Bhattacharya et al. | LAWRA: a layered wrapper feature selection approach for network attack detection | |
CN111401959A (en) | Risk group prediction method and device, computer equipment and storage medium | |
JP6487820B2 (en) | Risk assessment device, risk assessment method, and risk assessment program | |
CN116519003A (en) | Path planning method and device, electronic equipment and storage medium | |
CN111666302A (en) | User ranking query method, device, equipment and storage medium | |
JPWO2011016281A1 (en) | Information processing apparatus and program for Bayesian network structure learning | |
KR20230159165A (en) | Method, computer device, and computer program to recommend similar product based on keyword | |
CN108984615B (en) | Data query method and system and storage medium | |
CN111986006A (en) | Product recommendation method and device based on knowledge graph, computer equipment and storage medium | |
CN113849538A (en) | Intelligent extraction method and system based on fuzzy search multiple options | |
CN113537806A (en) | Abnormal user identification method and device, electronic equipment and readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |