A cluster detection based knowledge representation learning method and system

By constructing a knowledge graph and using clique detection information and penalty weight coefficients to generate knowledge representation vectors, the problem of low distinguishability of entity vectors of the same type is solved, and better knowledge representation learning effect is achieved.

CN115080757BActive Publication Date: 2026-03-20EWELL TEHCNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-07
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Existing knowledge representation learning methods have low discriminative power for different entity vectors of the same type, making it difficult to effectively distinguish knowledge entities of the same type.

Method used

By constructing a knowledge graph, using clique detection information to add different negative sample labels to related knowledge nodes, and applying different penalty weight coefficients during the knowledge representation learning process, a knowledge representation vector is generated.

Benefits of technology

It improves the discriminative power of knowledge representation vectors, enabling different knowledge entity vectors of the same type to be effectively distinguished, which facilitates understanding and processing by both humans and computers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115080757B_ABST
    Figure CN115080757B_ABST
Patent Text Reader

Abstract

The application relates to a knowledge representation learning method based on group detection, wherein the method comprises the following steps: determining a target knowledge node and associated knowledge nodes, constructing a knowledge graph based on the target knowledge node and the associated knowledge nodes, processing the knowledge graph according to a preset rule to obtain group detection information corresponding to the target knowledge node, adding different negative sample labels to the associated knowledge nodes based on the group detection information, and applying different penalty weight coefficients to the associated knowledge nodes according to the negative sample labels in the process of knowledge representation learning of an algorithm model, and generating a knowledge representation vector. Through the application, the problem that the distinguishing degree of different entity vectors of the same type is low in knowledge representation learning is solved, and the distinguishing degree of the knowledge representation vector is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of knowledge graph, in particular to a knowledge representation method and system based on cluster detection. BACKGROUND

[0002] The knowledge graph represents all nouns such as persons, place names, book names, etc. and practicalities in the world as entities, and represents the internal connection between entities as relationships. Its role is to represent the massive knowledge in the database as a set of ternary relationships using relationships as a bridge between entities.

[0003] Knowledge representation learning is applied to knowledge graphs, which can map entities and relationships to vector spaces, thereby solving the sparsity problem caused by the huge amount of data in knowledge graphs. However, current knowledge representation learning methods are usually based on translation models. Such methods have too similar representation vectors for different entities of the same type, and the vector distinction between entities is not high.

[0004] At present, there is no effective solution to the problem of low vector distinction between different entities of the same type in knowledge representation learning in related technologies. SUMMARY

[0005] The embodiments of the present application provide a knowledge representation learning method and system based on cluster detection, computer equipment and computer readable storage medium, to at least solve the problem of low vector distinction between similar entities in related technologies.

[0006] In a first aspect, the embodiments of the present application provide a knowledge representation learning method based on cluster detection, the method comprising:

[0007] determining a target knowledge node and its associated knowledge nodes, and constructing a knowledge graph based on the target knowledge node and the associated knowledge nodes;

[0008] processing the knowledge graph according to a preset rule to obtain cluster detection information corresponding to the target knowledge node;

[0009] based on the cluster detection information, adding different negative sample labels to the associated knowledge nodes;

[0010] In the process of knowledge representation learning, the algorithm model applies different penalty weight coefficients to the associated knowledge nodes according to the negative sample labels, and generates knowledge representation vectors.

[0011] In some embodiments, the cluster detection information includes non-cluster nodes, co-cluster nodes and non-co-cluster nodes of the target knowledge node.

[0012] In some embodiments, the knowledge graph is processed according to a preset rule to obtain clique detection information corresponding to the target knowledge node, including:

[0013] A relation matrix corresponding to the knowledge graph is generated, and a row sum in the relation matrix is obtained;

[0014] According to the row sum, a non-clique node in the knowledge graph is determined, and the non-clique node is deleted from the knowledge graph to obtain a to-be-processed knowledge graph, wherein the row sum of the non-clique node is 1;

[0015] In the to-be-processed knowledge graph, a co-clique node and a non-co-clique node of the target knowledge node are obtained through a preset process;

[0016] Based on the information of the non-clique node, the information of the co-clique node, and the information of the non-co-clique node, clique detection information corresponding to the target knowledge node is generated.

[0017] In some embodiments, the preset process includes the following:

[0018] S1, a relation matrix corresponding to the to-be-processed knowledge graph is generated, and whether the to-be-processed knowledge graph includes a single-clique node is determined according to the relation matrix, if yes, S2 is sequentially executed, if no, S4 is executed;

[0019] S2, the single-clique node is obtained, and a first clique is formed based on the single-clique node and its directly connected nodes;

[0020] S3, it is determined whether the first clique is equivalent to the to-be-processed knowledge graph, if yes, S5 is executed,

[0021] if no, all single-clique nodes in the first clique are deleted from the to-be-processed knowledge graph, and S1 to S3 are executed in a loop to obtain at least one second clique, and a to-be-processed knowledge graph that does not include a single-clique node, and S4 is sequentially executed;

[0022] S4, in the to-be-processed knowledge graph, an object knowledge node with the smallest row sum is obtained, and a first subgraph and a second subgraph are constructed based on the object knowledge node and its connection relationship,

[0023] wherein the first subgraph includes co-clique nodes of the object knowledge node, and the second subgraph includes other knowledge nodes except the co-clique nodes of the object knowledge node;

[0024] S5, it is determined whether S5 is jumped from S4, if yes, the first subgraph is taken as the to-be-processed knowledge graph in S1, and S1-S5 are executed in a loop to obtain at least one third clique, and the second subgraph is saved in a memory space as a backup knowledge graph data,

[0025] If no, read the backup knowledge graph data from the memory space as the knowledge graph to be processed in S1, and execute S1-S5 cyclically to obtain at least one fourth clique;

[0026] If the backup knowledge graph data does not exist in the current memory space, the cycle is terminated;

[0027] S6, according to the first clique, the second clique, the third clique, and the fourth clique accumulated in S1-S5, obtaining the common clique nodes and the non-common clique nodes of the target knowledge node.

[0028] In some embodiments, by the relationship matrix, it is judged whether the knowledge graph to be processed includes a single clique node, comprising:

[0029] In the relationship matrix, the row sum corresponding to each knowledge node is obtained, and it is judged whether the row sum satisfies a preset equation relationship, if yes, a response signal that the knowledge node is a single clique node is output, wherein the preset equation relationship is as follows:

[0030] r p =n p *(n p -1)

[0031] Wherein, r p is the row sum of the knowledge node, and n p is the number of the remaining nodes in the clique with the knowledge node.

[0032] In some embodiments, the method further comprises:

[0033] adding a first negative sample label to the common clique nodes of the target knowledge node, and applying a first penalty weight parameter to the common clique nodes in the process of knowledge representation learning;

[0034] adding a second negative sample label to the non-common clique nodes of the target knowledge node, and applying a second penalty weight parameter to the non-common clique nodes in the process of knowledge representation learning

[0035] adding a third negative sample label to the non-clique nodes, and applying a third penalty weight parameter to the non-clique nodes in the process of knowledge representation learning,

[0036] Wherein, the third penalty weight parameter is greater than the second penalty weight parameter, and the second penalty weight parameter is greater than the first penalty weight parameter.

[0037] In some embodiments, after the algorithm model ends the knowledge representation learning, in the generated knowledge representation vector:

[0038] The knowledge representation vectors belonging to the same group are cohesive around the target knowledge node, and the knowledge representation vectors not belonging to the same group are discrete.

[0039] In a second aspect, an embodiment of the present application provides a knowledge representation learning system based on group detection, the system comprising: a construction module, a group detection information acquisition module, a label adding module, and a knowledge representation learning module, wherein:

[0040] The construction module is configured to determine a target knowledge node and associated knowledge nodes thereof, and construct a knowledge graph based on the target knowledge node and the associated knowledge nodes.

[0041] The group detection information acquisition module is configured to process the knowledge graph according to a preset rule to obtain group detection information corresponding to the target knowledge node.

[0042] The label adding module is configured to add different negative sample labels to the associated knowledge nodes based on the group detection information.

[0043] The knowledge representation learning module is configured to apply different penalty weight coefficients to the associated knowledge nodes according to the negative sample labels in a process of knowledge representation learning by an algorithm model, and generate knowledge representation vectors.

[0044] In a third aspect, an embodiment of the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the method of the first aspect when executing the computer program.

[0045] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium having a computer program stored thereon, and the program is executable by a processor to implement the method of the first aspect.

[0046] Compared with the related art, the knowledge representation learning method based on group detection provided by the embodiment of the present application determines a target knowledge node and associated knowledge nodes thereof, constructs a knowledge graph based on the target knowledge node and the associated knowledge nodes, processes the knowledge graph according to a preset rule to obtain group detection information corresponding to the target knowledge node, adds different negative sample labels to the associated knowledge nodes based on the group detection information, and applies different penalty weight coefficients to the associated knowledge nodes according to the negative sample labels in a process of knowledge representation learning by an algorithm model, and generates knowledge representation vectors. The embodiment of the present application solves the problem of low distinguishability of different entity vectors of the same type in the related art, and separates or gathers the knowledge representation vectors by using the group detection information, thereby improving the distinguishability of the knowledge representation vectors. BRIEF DESCRIPTION OF DRAWINGS

[0047] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the present application and together with the description serve to explain the present application. In the drawings:

[0048] Figure 1 is a schematic diagram of a group node and its connection relationship according to an embodiment of the present application;

[0049] Figure 2 is a schematic diagram of an application environment of a knowledge representation learning method based on group detection according to an embodiment of the present application;

[0050] Figure 3 is a flowchart of a knowledge representation learning method based on group detection according to an embodiment of the present application;

[0051] Figure 4 is a flowchart of obtaining group detection information according to a preset rule according to an embodiment of the present application;

[0052] Figure 5 is a schematic diagram of a to-be-processed knowledge graph according to an embodiment of the present application;

[0053] Figure 6 is a schematic diagram of another to-be-processed knowledge graph according to an embodiment of the present application;

[0054] Figure 7 is a schematic diagram of a to-be-processed knowledge graph not including a single-group node according to an embodiment of the present application;

[0055] Figure 8 is a schematic diagram of a first subgraph and a second subgraph according to an embodiment of the present application;

[0056] Figure 9 is a structural block diagram of a knowledge representation learning system based on group detection according to an embodiment of the present application;

[0057] Figure 10 is a schematic diagram of an internal structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0058] In order to make the objects, technical solutions and advantages of the present application clearer, the present application is described and explained below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present application.

[0059] It is apparent that the drawings in the following description merely show some examples or embodiments of the present application, and the present application can be applied to other similar situations without creative labor by those skilled in the art based on these drawings. In addition, it can be understood that, although the efforts made in the development process can be complex and lengthy, some design, manufacture or production changes based on the technical content disclosed in the present application are only routine technical means for those skilled in the art related to the content disclosed in the present application, and should not be understood as insufficient disclosure of the content disclosed in the present application.

[0060] Reference to "an embodiment" in this application means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily mutually exclusive of one another. It is explicitly contemplated that embodiments described herein can be combined with other embodiments in a non- conflicting manner.

[0061] Unless otherwise defined, technical terms or scientific terms used in the present application should be understood as their common meanings to those skilled in the art. The terms "a", "an", "one", "this", and similar terms in the present application do not represent quantity limitation, but can represent singular or plural. The terms "include", "contain", "have", and any variations thereof in the present application are intended to cover non-exclusive inclusion; for example, a process, method, system, product or device including a series of steps or modules (units) is not limited to the listed steps or units, but can also include steps or units not listed, or can also include other steps or units inherent to the process, method, product or device. The terms "connect", "connect", "couple" and similar terms in the present application are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. The term "multiple" in the present application means two or more. The association between the associated objects is described by the term "and / or", which means that there can be three relationships, for example, "A and / or B" can mean that A exists alone, A and B exist together, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects. The terms "first", "second", "third" and the like in the present application are merely to distinguish similar objects, and do not represent a specific order for the objects.

[0062] In this document, it is understood that the terms involved can be technical means or other summary technical terms for implementing part of the present application, for example, the terms can include:

[0063] Knowledge graph: Knowledge graph is essentially a knowledge base called semantic network, i.e., a knowledge base of directed graph structure. In simple terms, knowledge graph is a data structure composed of entities, relationships and attributes.

[0064] Representation learning: representing the object to be described as a low-dimensional dense vector, also known as distributed representation, can effectively solve the data sparsity problem and facilitate operation and calculation in a low-dimensional semantic space to improve efficiency.

[0065] Knowledge representation learning: applying "representation learning" to knowledge graph (KG) is knowledge representation learning.

[0066] Group matrix: the relationship between nodes in a knowledge graph is represented as a matrix obtained in the form of a square matrix, wherein if there is a relationship between node i and node j, the matrix element ij is 1, otherwise 0, and the diagonal element is usually 0.

[0067] Clique: a complete subgraph of a directed graph, including at least 3 elements, and each pair of nodes in the clique has a relationship connection.

[0068] Non-clique node: a node that does not belong to any clique.

[0069] Uniclique node: a node that belongs to only one clique.

[0070] Multiclique node: a node that belongs to multiple cliques.

[0071] Co-clique: two nodes at least simultaneously belong to a clique.

[0072] Figure 1 According to an embodiment of the present application, a schematic diagram of a clique node and its connection relationship is shown in FIG. 1, wherein the nodes and the cliques to which they belong are represented as follows: Figure 1

[0073] Clique A: nodes 1, 2 and 3 form a clique.

[0074] Clique B: nodes 2, 3, 4 and 5 form a clique.

[0075] Non-clique node: node 6 or node 7.

[0076] Uniclique node: node 1 in clique A, node 4 and node 5 in clique B.

[0077] Multiclique node: node 2 or node 3 belongs to both clique A and clique B.

[0078] ​Co-clique: nodes 1, 2, nodes 1, 3, and nodes 2, 3 all exist in clique A, and the two node relationships are called co-clique.

[0079] The knowledge representation learning method based on clique detection provided in the application can be applied in an application environment as shown in the figure. Figure 2 Figure 2 The figure is a schematic diagram of an application environment of a knowledge representation learning method based on clique detection according to an embodiment of the application. As shown in the figure, the server 21 can be composed of one or more servers, and the server stores knowledge entities of various fields and forms a knowledge graph based on the knowledge entities. Further, in the server 21, an algorithm model can be used to vectorize each knowledge entity in the knowledge graph, thereby solving the problem of data sparsity and facilitating understanding and processing by humans and computers. In the process of knowledge representation learning, the user can operate the terminal device 20 to set the rules and parameters of knowledge representation learning, thereby obtaining a knowledge representation vector with better effect. Figure 2 It should be noted that the terminal device 20 in the application can be a smart phone, a notebook computer, a desktop computer, or the like, and the server 21 can be a single server or a cluster composed of multiple servers.

[0080] The application provides a knowledge representation learning method based on clique detection,

[0081] The figure is a flowchart of a knowledge representation learning method based on clique detection according to an embodiment of the application. As shown in the figure, the flow includes the following steps: Figure 3 Figure 3

[0082] S301, determining a target knowledge node and its associated knowledge nodes, and constructing a knowledge graph based on the target knowledge node and the associated knowledge nodes;

[0083] The target knowledge node can be any knowledge node in the knowledge graph, and the associated knowledge nodes include knowledge nodes directly connected and indirectly connected to the target knowledge node.

[0084] Further, after determining the target knowledge node and the associated knowledge nodes, the knowledge graph can be constructed in combination with the connection relationship between the nodes. The specific way of constructing the knowledge graph is a conventional technical means commonly possessed by those skilled in the art, and will not be described in detail in this embodiment.

[0085] S302, processing the knowledge graph according to a preset rule to obtain clique detection information corresponding to the target knowledge node;

[0086] In this embodiment, the obtained clique detection information is described in a simple way as follows: which nodes in the current knowledge graph are non-clique nodes, which nodes are co-clique nodes with the target node, and which nodes are non-co-clique nodes with the target node. ​​​

[0087] It should be noted that the target knowledge node is an abstract description for ease of writing. In practical applications, the target node can be any node in the knowledge graph. That is, for all nodes in the knowledge graph, it is necessary to obtain their corresponding clique detection information.

[0088] Furthermore, the aforementioned preset rules are not limited to a specific method. As long as the clique detection information in the knowledge graph can be obtained through such rules, they can be applied to the technical solution of this application.

[0089] S303, based on clique detection information, adds different negative sample labels to associated knowledge nodes;

[0090] As explained in step S303, the clique detection information specifically includes non-clique nodes, co-clique nodes, and non-co-clique nodes. Therefore, in this step, different negative sample labels can be added based on the above-mentioned different types of node information.

[0091] S304, during the knowledge representation learning process, the algorithm model applies different penalty weight coefficients to the associated knowledge nodes based on the negative sample labels and generates knowledge representation vectors.

[0092] Corresponding to step S303, during the knowledge representation learning process, different penalty weight parameters can be applied to each node by referring to the different negative sample labels on various types of nodes.

[0093] Because the penalty weight parameters of each node are different, the relative distances between the vector representations of each knowledge node obtained after the knowledge representation learning is also different.

[0094] Compared to the unimproved solution, the knowledge representation learning method in this embodiment increases the distance between vectors that do not belong to the same clique around the current node, while the node vectors that belong to the same clique become more cohesive. This effectively distinguishes different knowledge entity vectors of the same type, making it easier for humans or computers to understand and process them.

[0095] Through the above steps S301 to S304, compared with related technologies, which introduce the probabilities of head and tail in real business data as reference values ​​in the translation model, and introduce the attribute information of entities in head and tail as reference values, this application does not require any modification to head and tail. With less attribute information and less additional probability information, it introduces clique detection information to participate in knowledge representation learning, thereby effectively distinguishing different knowledge entities of the same type. While saving resource costs and improving efficiency, it is also convenient for computer and user operation.

[0096] In some of these embodiments, Figure 4is a flowchart of obtaining a clique detection information according to a preset rule, as shown in Figure 4 The flowchart includes the following steps:

[0097] S401, generating a relationship matrix corresponding to the knowledge graph, and obtaining row sums in the relationship matrix;

[0098] In the relationship matrix, if there is a relationship between node i and node j, then the matrix element ij is 1, otherwise it is 0; further, the row sum is the sum of all values in the row where any node is located.

[0099] S402, determining a non-clique node in the knowledge graph according to the row sum, deleting the non-clique node from the knowledge graph, and obtaining a to-be-processed knowledge graph, wherein the row sum of the non-clique node is 1;

[0100] Referring to the above term introduction part, a clique should include at least 3 nodes, which can be understood here that if the row sum of a node is 1, it means that the node is connected to only one other node, so the node is a non-clique node;

[0101] It should be noted that for a non-clique node, since its connection relationship is fixed and it does not belong to any clique, it is not necessary to involve the non-clique node in the subsequent determination of co-clique nodes and non-co-clique nodes.

[0102] S403, obtaining co-clique nodes and non-co-clique nodes of a target knowledge node in the to-be-processed knowledge graph through a preset process;

[0103] It should be noted that, like the nature of the preset rule, the above preset process is not limited to a specific way, as long as the co-clique nodes and non-co-clique nodes of a node in the knowledge graph can be obtained through the process, it can be applied to the technical solution of the present application.

[0104] S404, generating clique detection information corresponding to the target knowledge node based on the information of the non-clique node, the information of the co-clique node, and the information of the non-co-clique node.

[0105] Correspondingly, the information of the co-clique node corresponding to each node in the knowledge graph, the information of the non-co-clique node of each node, and the non-clique node in the graph are combined into clique detection information.

[0106] In some embodiments, the preset process includes:

[0107] S1, generating a relationship matrix corresponding to the to-be-processed knowledge graph, and determining whether the to-be-processed knowledge graph includes a single-clique node according to the relationship matrix, if yes, sequentially executing S2, if no, jumping to execute S4;

[0108] S2, acquire a single-group node, and based on the single-group node and its directly connected nodes, a first clique is formed;

[0109] S3, determine whether the first clique is identical to the to-be-processed knowledge graph, if yes, jump to S5,

[0110] if no, delete all single-group nodes in the first clique from the to-be-processed knowledge graph, and perform S1-S3 cyclically to obtain at least one second clique, and the to-be-processed knowledge graph excluding the single-group nodes, and sequentially perform S4;

[0111] The purpose of steps S1-S3 is to continuously acquire all single-group nodes and the information of the groups in which the single-group nodes exist in the to-be-processed knowledge graph which is updated continuously in a cyclic manner, wherein, each time step S2 is performed, a single-group node and a first clique are obtained, and when the program is cyclically executed, multiple single-group nodes and multiple first cliques are obtained.

[0112] Further, when the above cyclic process is applied in an actual business scenario, the number of first cliques and second cliques obtained for different knowledge graphs is not necessarily one, specifically, the number of groups can be one or N, which is not limited in the embodiment.

[0113] S4, in the to-be-processed knowledge graph, acquire a row and a minimum object knowledge node, and based on the object knowledge node and its connection relationship, a first subgraph and a second subgraph are constructed, the first subgraph is constructed in a similar manner to the first clique in step S2, and thus the embodiment will not be described again.

[0114] The first subgraph includes the co-group node of the object knowledge node, and the second subgraph includes other knowledge nodes other than the co-group node of the object knowledge node.

[0115] S5, determine whether to jump from S4 to S5, if yes, the first subgraph is taken as the to-be-processed knowledge graph in S1, and S1-S5 are cyclically executed to obtain at least one third clique, and the second subgraph is saved in the memory space as backup knowledge graph data,

[0116] if no, the backup knowledge graph data is read from the memory space and taken as the to-be-processed knowledge graph in S1, and S1-S5 are cyclically executed to obtain at least one fourth clique;

[0117] Correspondingly, when the cyclic process of steps S4-S5 is applied in an actual business scenario, the number of third cliques and fourth cliques obtained for different knowledge graphs is also not necessarily one, specifically, the number of groups can be one or N, which is not limited in the embodiment.

[0118] If the standby knowledge graph data does not exist in the current memory space, the loop is terminated.

[0119] S6, according to S1-S5, the first clique, the second clique, the third clique, the fourth clique, the common group nodes and the non-common group nodes of the target knowledge node are obtained.

[0120] In some embodiments, whether the single group node is included in the knowledge graph to be processed is determined by the relationship matrix, comprising:

[0121] In the relationship matrix, the row sum corresponding to each knowledge node is obtained, and it is determined whether the row sum satisfies a preset equation relationship. If yes, a signal that the knowledge node is a single group node is outputted, wherein the preset equation relationship is as follows:

[0122] r p =n p *(n p -1)

[0123] Wherein, r p is the row sum of the target knowledge node, and n p is the number of nodes in the common group with the target knowledge node.

[0124] Specifically, in order to facilitate understanding of the technical scheme of the present application, the following embodiments can be used for illustration:

[0125] The currently selected target node is P6, the nodes directly connected and indirectly connected with node P6 are obtained, and a graph G as shown in Figure 5 is formed, wherein the graph G={P1, P2, P3, P4, P5, P6, P7, P8};

[0126] Step 1: calculate the relationship matrix M corresponding to the knowledge graph, and the row sum r(n) of the relationship matrix M, and the relationship matrix M and the row sum are represented as:

[0127]

[0128] Wherein, r(P8)=1, node P8 is a non-group node, delete node P8, P8 does not participate in the subsequent steps; further, since r(P1)=2, n(P1)=2, therefore, node P1 satisfies the above preset equation relationship: r p =n p *(n p -1), that is, P1 is a single group node, and there is a single group node in the current knowledge graph, so step 2 is executed in sequence.

[0129] Step 2: The first cluster C1 is composed of the single cluster node P1 and its directly connected nodes, the cluster C1 is composed of nodes 1, 2, and 3, C1 = {P1, P2, P3}, wherein the single cluster node C'1 = {P1}, and step 3 is continued to be executed;

[0130] Step 3: Since the first cluster C1 ≠ graph G, it indicates that the graph G has multiple clusters, and thus the single cluster node P1 in the graph G needs to be deleted to obtain a new graph G1 and continue to split, wherein the G1 is as shown in Figure 6 G1 = {P2, P3, P4, P5, P6, P7}; using the graph G1 as a to-be-processed knowledge graph, steps 1 to 3 are repeatedly executed to obtain a graph G2 not including a single cluster node, and a second cluster C2 = {P2, P3, P4}, wherein the graph G2 is as shown in Figure 7 ;

[0131] The relationship matrix of the to-be-processed knowledge graph G2 after deleting all single cluster nodes is represented as:

[0132]

[0133] According to the above relationship matrix, it can be obtained that the current to-be-processed knowledge graph does not include a single cluster node, and thus step 4 can be executed to further obtain cluster node information and non-cluster node information.

[0134] Step 4: In the to-be-processed knowledge graph of step 3 or the passed, the node P3 with the smallest row sum is selected, a first subgraph G(P3) = {P3, P4, P5, P6} composed of the node P3 and its cluster nodes, a second subgraph G(-P3) = {P4, P5, P6, P7}, and further, step 5 is sequentially executed; wherein the first subgraph and the second subgraph are as shown in Figure 8 ;

[0135] Step 5: The first subgraph G(P3) is taken as the to-be-processed knowledge graph in step 1 to continue splitting to obtain a third cluster C3 = {P3, P4, P6} and a fourth cluster C4 = {P3, P5, P6}, and meanwhile, the second subgraph is stored to a storage;

[0136] At this time, since the storage is not empty, the second subgraph G(-P3) is taken out from the storage, and continues to split through steps 1 to 3 to obtain a fifth cluster C5 = {P4, P6, P7} and a sixth cluster C6 = {P5, P6, P7}.

[0137] Through the above algorithm, a non-cluster node and six clusters are obtained, which are C1 = {P1, P2, P3}, C2 = {P2, P3, P4}, C3 = {P3, P4, P6}, C4 = {P3, P5, P6}, C5 = {P4, P6, P7}, and C6 = {P5, P6, P7}.

[0138] It can be understood that according to these groups, it can be determined which nodes are the co-group nodes of the target node P1 and which nodes are the non-co-group nodes of the target node P1.

[0139] In some embodiments, a first negative sample label is added to the co-group nodes of the target knowledge node, and a first penalty weight parameter is applied to the co-group nodes of the target knowledge node in the process of knowledge representation learning.

[0140] A second negative sample label is added to the non-co-group nodes of the target knowledge node, and a second penalty weight parameter is applied to the non-co-group nodes of the target knowledge node in the process of knowledge representation learning.

[0141] A third negative sample label is added to the non-group nodes, and a third penalty weight parameter is applied to the non-group nodes in the process of knowledge representation learning.

[0142] The third penalty weight parameter is greater than the second penalty weight parameter, and the second penalty weight parameter is greater than the first penalty weight parameter.

[0143] Specific examples are as follows:

[0144] First, the co-group nodes of the node P6 are obtained.

[0145] Since the groups in which the node P6 is located are C3={P3, P4, P6}, C4={P3, P5, P6}, C5={P4, P6, P7}, and C6={P5, P6, P7}, according to the above information, it can be seen that the nodes that need to add the first negative sample label (Ec1) are {P3, P4, P5, P7}.

[0146] Second, the nodes that do not belong to the same group as the node P6 are obtained.

[0147] Since the groups in which the node P6 is located are C1={P1, P2, P3} and C2={P2, P3, P4}, the nodes P3 and P4 directly connected to the node P6 are removed, and then the nodes that need to add the second negative sample label (Ec2) are {P1, P2}.

[0148] Finally, the non-group nodes that need to add the third negative sample label (Eo) are {P8}.

[0149] In some embodiments, after the algorithm model ends the knowledge representation learning, in the generated knowledge representation vector: the target knowledge node is surrounded by the knowledge representation vector belonging to the same group, and the knowledge representation vector not belonging to the same group is discrete, so that different entities under the same type can be better distinguished.

[0150] Further, taking Trans E as an example, before the improvement, the loss function of Trans E is as follows:

[0151]

[0152] S′ (h,l,t) ={(h′,l,t)|h′∈E}∪{(h,l,t′)|t′∈E}

[0153] By applying the technical solution of the present application, the improved new loss function is as follows:

[0154]

[0155] S′ (h,l,t) ={(h′,l,t)|h′∈E}∪{(h,l,t′)|t′∈E}

[0156]

[0157]

[0158]

[0159] β>α>1

[0160] In the formula, each character in the formula is explained as follows:

[0161] l: relationship vector;

[0162] h, t: head and tail node vectors of positive samples;

[0163] h', t': randomly generated head and tail node vectors of negative samples;

[0164] h c1 , t c1 : common cluster nodes as head and tail node vectors of negative samples;

[0165] h c2 , t c2 : non-common cluster nodes as head and tail node vectors of negative samples;

[0166] h o , t o : non-cluster nodes as head and tail node vectors of negative samples;

[0167] S: positive sample set;

[0168] S': negative sample set;

[0169] E: all node set;

[0170] E c1 : common cluster node set;

[0171] E c2: set of non-clique nodes

[0172] E o : set of non-clique nodes

[0173] γ: distance hyper-parameter

[0174] α: non-clique node weight coefficient

[0175] β: non-clique node weight coefficient

[0176] d(x): distance formula, which can use L1 Manhattan distance formula or L2 Euclidean distance formula

[0177] [x] + : positive value function, x>0 is x, otherwise 0.

[0178] It should be noted that the steps shown in the above process or the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from here.

[0179] The embodiment also provides a knowledge representation learning system based on clique detection, which is used to implement the above-mentioned embodiments and preferred embodiments, and will not be repeated here. As used below, the terms "module", "unit", "sub-unit" and the like can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, hardware, or a combination of software and hardware implementations are also possible and contemplated.

[0180] Figure 9 is a structural block diagram of a knowledge representation learning system based on clique detection according to the embodiments of the present application, as shown in Figure 9 , the system comprises a construction module 90, a clique detection information acquisition module 91, a label adding module 92 and a knowledge representation learning module 93, wherein

[0181] The construction module 90 is used to determine the target knowledge node and its associated knowledge nodes, and construct a knowledge graph based on the target knowledge node and the associated knowledge nodes;

[0182] The clique detection information acquisition module 91 is used to process the knowledge graph according to a preset rule to obtain clique detection information corresponding to the target knowledge node;

[0183] The label adding module 92 is used to add different negative sample labels to the associated knowledge nodes based on the clique detection information;

[0184] The knowledge representation learning module 93, in the process of knowledge representation learning of the algorithm model, applies different penalty weight coefficients to the associated knowledge nodes according to the negative sample labels, and generates a knowledge representation vector.

[0185] In an embodiment, a computer device is provided, which can be a terminal. The computer device comprises a processor, a memory, a network interface, a display screen and an input device connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The network interface of the computer device is configured to communicate with external terminals through network connections. The computer program is executed by the processor to implement a knowledge representation learning method based on group detection. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball or touchpad arranged on the shell of the computer device, or an external keyboard, touchpad or mouse, etc.

[0186] In an embodiment, Figure 10 is a schematic diagram of the internal structure of an electronic device according to an embodiment of the present application, as Figure 10 shown, an electronic device is provided, which can be a server, and the internal structure diagram thereof can be as Figure 10 shown. The electronic device comprises a processor, a network interface, an internal memory and a non-volatile memory connected through an internal bus, wherein the non-volatile memory stores an operating system, a computer program and a database. The processor is configured to provide computing and control capabilities, the network interface is configured to communicate with external terminals through network connections, the internal memory is configured to provide an environment for the operating system and the computer program to run, the computer program is executed by the processor to implement a knowledge representation learning method based on group detection, and the database is configured to store data.

[0187] Those skilled in the art can understand that Figure 10 the structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device can comprise more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0188] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when executed, can include the processes of the above-mentioned embodiments of each method. Any reference to memory, storage, database or other medium used in each embodiment provided by the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0189] The above embodiments only express several embodiments of the present application, and the description is more specific and detailed, but it cannot be understood as a limitation on the scope of the patent. It should be noted that for those skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the scope of the present application. Therefore, the scope of protection of the patent of the present application should be subject to the appended claims.

Claims

1. A knowledge representation learning method based on clique detection, characterized in that, The method includes: Identify the target knowledge nodes and their associated knowledge nodes, and construct a knowledge graph based on the target knowledge nodes and associated knowledge nodes; The knowledge graph is processed according to preset rules to obtain clique detection information corresponding to the target knowledge node. The clique detection information includes: non-clique nodes, co-clique nodes of the target knowledge node, and non-co-clique nodes. Specifically, the processing of the knowledge graph according to preset rules to obtain clique detection information corresponding to the target knowledge node includes: Generate the relation matrix corresponding to the knowledge graph, and obtain the row sum in the relation matrix; Based on the row sum, the non-clique nodes in the knowledge graph are determined, and these non-clique nodes are deleted from the knowledge graph to obtain the knowledge graph to be processed, wherein the row sum of the non-clique nodes is 1; In the knowledge graph to be processed, the co-clique nodes and non-co-clique nodes of the target knowledge node are obtained through a preset process; Based on the information of the non-cluster nodes, the information of the cocluster nodes, and the information of the non-cocluster nodes, cluster detection information corresponding to the target knowledge node is generated; Based on the cluster detection information, different negative sample labels are added to the associated knowledge nodes; During the knowledge representation learning process, the algorithm model applies different penalty weight coefficients to the associated knowledge nodes based on the negative sample labels and generates knowledge representation vectors.

2. The method according to claim 1, characterized in that, The preset process includes the following: S1. Generate the relation matrix corresponding to the knowledge graph to be processed. Based on the relation matrix, determine whether the knowledge graph to be processed includes a single cluster node. If yes, execute S2 sequentially. If no, jump to execute S4. S2, obtain the single-cluster node, and form a first clique based on the single-cluster node and its directly connected nodes; S3, determine whether the first clique is equivalent to the knowledge graph to be processed. If yes, jump to S5. If no, delete all single-cluster nodes in the first clique from the knowledge graph to be processed, and repeat S1 to S3 to obtain at least one second clique and a knowledge graph to be processed that does not include single-cluster nodes, and then execute S4 in sequence. S4. In the knowledge graph to be processed, obtain the object knowledge node with the smallest row sum, and construct a first subgraph and a second subgraph based on the object knowledge node and its connection relationship. The first subgraph includes the common cluster nodes of the object knowledge nodes, and the second subgraph includes other knowledge nodes besides the common cluster nodes of the object knowledge nodes. S5: Determine if it's a jump from S4 to S5. If so, use the first subgraph as the knowledge graph to be processed in S1, and loop through S1-S5 to obtain at least one third clique. Save the second subgraph in memory as backup knowledge graph data. If not, read the backup knowledge graph data from the memory space and use it as the knowledge graph to be processed in S1, and execute S1-S5 in a loop to obtain at least one fourth clique; If the backup knowledge graph data does not exist in the current memory space, the loop terminates; S6, based on the first clique, second clique, third clique, and fourth clique accumulated in S1-S5, obtain the coclique nodes and non-coclique nodes of the target knowledge node.

3. The method according to claim 2, characterized in that, Using the relation matrix, it is determined whether the knowledge graph to be processed includes single-cluster nodes, including: In the relation matrix, the row sum corresponding to each knowledge node is obtained, and it is determined whether the row sum satisfies a preset equation. If so, a response signal indicating that the knowledge node is a single-cluster node is output. The preset equation is as follows: in, It is the row sum of knowledge nodes. It is the number of the remaining nodes that co-occur with the knowledge node.

4. The method according to claim 1, characterized in that, The method further includes: For the co-clique nodes of the target knowledge node, a first negative sample label is added, and a first penalty weight parameter is applied to them during the knowledge representation learning process; For non-clique nodes of the target knowledge node, a second negative sample label is added, and a second penalty weight parameter is applied to them during the knowledge representation learning process. For the non-clique nodes, a third negative sample label is added, and a third penalty weight parameter is applied to them during the knowledge representation learning process. Wherein, the third penalty weight parameter is greater than the second penalty weight parameter, and the second penalty weight parameter is greater than the first penalty weight parameter.

5. The method according to claim 1, characterized in that, After the knowledge representation learning is completed, the algorithm model generates the following knowledge representation vectors: The knowledge representation vectors surrounding the target knowledge node that belong to the same group are cohesive, while those that do not belong to the same group are discrete.

6. A knowledge representation learning system based on clique detection, characterized in that, The system includes: a construction module, a clique detection information acquisition module, a tag addition module, and a knowledge representation learning module, wherein; The construction module is used to determine the target knowledge node and its associated knowledge node, and to construct a knowledge graph based on the target knowledge node and the associated knowledge node; The clique detection information acquisition module is used to process the knowledge graph according to preset rules to obtain clique detection information corresponding to the target knowledge node. The clique detection information includes: non-clique nodes, co-clique nodes and non-co-clique nodes of the target knowledge node; processing the knowledge graph according to preset rules to obtain clique detection information corresponding to the target knowledge node specifically includes: Generate the relation matrix corresponding to the knowledge graph, and obtain the row sum in the relation matrix; Based on the row sum, the non-clique nodes in the knowledge graph are determined, and these non-clique nodes are deleted from the knowledge graph to obtain the knowledge graph to be processed, wherein the row sum of the non-clique nodes is 1; In the knowledge graph to be processed, the co-clique nodes and non-co-clique nodes of the target knowledge node are obtained through a preset process; Based on the information of the non-cluster nodes, the information of the cocluster nodes, and the information of the non-cocluster nodes, cluster detection information corresponding to the target knowledge node is generated; The labeling module is used to add different negative sample labels to the associated knowledge nodes based on the clique detection information; The knowledge representation learning module is used to apply different penalty weight coefficients to the associated knowledge nodes based on the negative sample labels during the knowledge representation learning process of the algorithm model, and generate knowledge representation vectors.

7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Knowledge graph embedding training method and related device

    CN112685573A