CN117251583A - Text enhanced knowledge graph representation learning method and system based on local graph structure - Google Patents
Text enhanced knowledge graph representation learning method and system based on local graph structure Download PDFInfo
- Publication number
- CN117251583A CN117251583A CN202311544608.6A CN202311544608A CN117251583A CN 117251583 A CN117251583 A CN 117251583A CN 202311544608 A CN202311544608 A CN 202311544608A CN 117251583 A CN117251583 A CN 117251583A
- Authority
- CN
- China
- Prior art keywords
- vector
- input
- text
- word
- knowledge graph
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 32
- 239000013598 vector Substances 0.000 claims abstract description 181
- 230000006870 function Effects 0.000 claims abstract description 38
- 238000012549 training Methods 0.000 claims abstract description 11
- 238000004364 calculation method Methods 0.000 claims description 39
- 238000012545 processing Methods 0.000 claims description 16
- 239000011159 matrix material Substances 0.000 claims description 12
- 230000011218 segmentation Effects 0.000 claims description 12
- 238000011176 pooling Methods 0.000 claims description 5
- 238000000605 extraction Methods 0.000 claims description 4
- 230000009286 beneficial effect Effects 0.000 abstract description 3
- 238000010586 diagram Methods 0.000 abstract description 2
- 230000008569 process Effects 0.000 description 9
- 230000007246 mechanism Effects 0.000 description 5
- 230000002776 aggregation Effects 0.000 description 3
- 238000004220 aggregation Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 238000005070 sampling Methods 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 239000002585 base Substances 0.000 description 1
- 230000015556 catabolic process Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000012512 characterization method Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 238000006731 degradation reaction Methods 0.000 description 1
- 230000002708 enhancing effect Effects 0.000 description 1
- 239000012458 free base Substances 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000003058 natural language processing Methods 0.000 description 1
- 230000000153 supplemental effect Effects 0.000 description 1
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/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
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/25—Fusion techniques
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/279—Recognition of textual entities
- G06F40/289—Phrasal analysis, e.g. finite state techniques or chunking
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/30—Semantic analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/02—Knowledge representation; Symbolic representation
- G06N5/022—Knowledge engineering; Knowledge acquisition
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/70—Reducing energy consumption in communication networks in wireless communication networks
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- Artificial Intelligence (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Evolutionary Computation (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computing Systems (AREA)
- Software Systems (AREA)
- Mathematical Physics (AREA)
- Databases & Information Systems (AREA)
- Animal Behavior & Ethology (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Evolutionary Biology (AREA)
- Machine Translation (AREA)
Abstract
The invention provides a text enhanced knowledge graph representation learning method based on a local graph structure, which comprises the following steps: s1: acquiring a knowledge graph of a local graph structure, and calculating to acquire a first input vector and a second input vector through the knowledge graph and an input triplet; s2: constructing a learning model, and training a first input vector and a second input vector through the learning model to obtain a first prediction vector and a second prediction vector; s3: constructing a scoring function through the first prediction vector and the second prediction vector, and calculating through the scoring function to obtain a loss function; s4: repeating the steps S1-S3 until the loss function is smaller than a preset value, and obtaining a trained learning model. The learning model constructed by the invention fuses the text coding and the local diagram structure information of the knowledge graph, thereby being beneficial to simultaneously acquiring the contextualization and the structured knowledge; by integrating the u-hop neighbor entity into the input vector, the problem of insufficient structural information in the text-based method is solved.
Description
Technical Field
The invention relates to the technical field of knowledge maps, in particular to a text enhanced knowledge map representation learning method and system based on a local map structure.
Background
In recent years, knowledge patterns (KGs) have been widely used in various natural language processing fields. Significant efficacy has been demonstrated in search engines, knowledge questions and answers, recommendation systems, and other tasks. Various types of knowledge bases such as Freebase, wordNet, NELL have been created for storing structural information of human knowledge. Knowledge maps are mainly composed of two elements, which are described as (subject entities, relationships, guest entities) for storing knowledge. While representation learning of the knowledge-graph aims at mapping entities and relationships to a continuous, low-dimensional vector space, which facilitates the computation of the inference process between entities.
In order to obtain a high-level representation of a knowledge graph, the concept of projecting entities and relationships inherent in the knowledge graph onto different points in the vector space has been proposed in recent years. The former knowledge graph representation learning method is mainly a graph embedding method, and aims to acquire representations of elements in the graph in the form of low-dimensional vectors. But this approach ignores the context and text information that may be helpful in enhancing entity characterization learning. This deficiency makes them particularly vulnerable to the challenges presented by the imperfection of the drawing. These limitations greatly impair their ability to efficiently generalize and represent high quality.
For this reason, many studies have employed text encoding methods to obtain a representation. The text-based strategy utilizes supplemental input signals and contextual representations of natural language text associated with knowledge triples to enable missing component prediction in knowledge-graph representation learning. The text may contain text attributes of the entities and relationships, including their names or descriptions. By pre-training the language model, the text encoder can be seamlessly generalized to new graph elements and is not affected by the challenges presented by graph imperfection. However, the existing text-based knowledge graph representation learning method still has the problems of lack of structural knowledge and excessive reliance on semantic information due to insufficient efficacy of a text encoder in acquiring structural insights. This will affect the accuracy and performance of the representation learning.
Disclosure of Invention
In order to solve the technical problems, the invention provides a text enhanced knowledge graph representation learning method based on a local graph structure, which comprises the following steps:
s1: obtaining a knowledge graph of a local graph structure, and obtaining a first input vector V through calculation of the knowledge graph and an input triplet sr And a second input vector V o ;
S2: constructing a learning model, and obtaining a first input vector V through the learning model sr And a second input vector V o Training to obtain a first predictive vector e sr And a second predictive vector e o ;
S3: by a first predictive vector e sr And a second predictive vector e o Constructing a scoring function, and calculating to obtain a loss function through the scoring function;
s4: and repeating the steps S1-S3 until the loss function is smaller than a preset value, obtaining a trained learning model, and carrying out a link prediction task through the trained learning model.
Preferably, step S1 specifically includes:
s11: obtaining a knowledge graph of a local graph structure,/>Representing a set of all entities->Representing a set of all relationships->Representing the correct triplet set; by passing through/>Obtaining an input triplet (s, r, o), wherein s represents a subject entity embedding, r represents a relationship embedding, and o represents a guest entity embedding;
s12: obtaining a hop neighbor list L of a subject entity embedded in s s And text description T of subject entity s Obtaining a jump neighbor list L of an object entity with the object entity embedded in o o Textual description T of a guest entity o ;
S13: acquisition of L s U-hop neighbor entity L of middle body entity s [u]Will s, r, L s [u]And T s Combining to obtain a first input vector V sr ;
S14: acquisition of L o U-hop neighbor entity L of middle guest entity o [u]O, L o [u]And T o Combining to obtain a second input vector V o 。
Preferably:
first input vector V sr The calculation formula of (2) is as follows:
V sr =s+L s [u]+r+T s
second input vector V o The calculation formula of (2) is as follows:
V o =o+L o [u]+T o
preferably, step S2 specifically includes:
s21: to the first input vector V sr And a second input vector V o Input learning model for V sr And V o Word segmentation processing is carried out to obtain word vectors, and a first hidden layer vector is obtained through calculation of attention, relative position distance and semantic information among the word vectorsAnd a second hidden layer vector->;
S22: by text encoder pairsAnd->Performing feature extraction forward propagation to obtain a first language model vector H sr And a second language model vector H o ;
S23: will H sr And H o Vector processing is carried out through pooling and regularization, and a first prediction vector e with unified dimension is obtained sr And a second predictive vector e o 。
Preferably, step S21 specifically includes:
s211: for V sr Word segmentation processing is carried out to obtain a first word vector set:
wherein token represents word segmentation processing, n represents the total number of first word vectors,representing an nth first word vector;
for V o Performing word segmentation processing to obtain a second word vector set:
where m represents the total number of second word vectors,representing an mth second word vector;
s212: the attention among the word vectors is obtained through calculation, and the calculation formula is as follows:
wherein H represents a semantic information hiding state associated with the word vector; q (Q) s 、K s And V s Respectively through projection matrix W qs 、W ks And W is vs Generated semantic vector matrix, K p And Q p Respectively through projection matrix W kp And W is qp A generated relative position vector matrix;
s213: the relative position distance is calculated and obtained, and the calculation formula is as follows:
wherein a and b are labels of a word vector, D (a, b) represents a relative position distance from label a to label b, and k represents a maximum relative position distance;
s214: calculating to obtain attention vector A from tag a to tag b a,b The calculation formula is as follows:
wherein,attention information representing semantics to semantics, +.>Represents Q s Line a, < >>Represent K s In the row b of (c),attention information representing semantics to relative position, < ->Represent K p Line D (a, b), +.>Attention information representing relative position to semantics, < ->Representation ofQ p Line D (a, b);
s215: constructing attention operation attention through attention vectors among all labels, and carrying out attention operation on all word vectors to obtain a first hidden layer vectorAnd a second hidden layer vector->The calculation formula is as follows:
。
preferably, the scoring function in step S3The expression of (2) is:
wherein d edu Representing the euclidean distance of the first predictive vector from the second predictive vector,representing cosine similarity of the first predictive vector and the second predictive vector,/and the like>Representing a reorder fraction obtained by reordering the predicted entities,/->Is the Euclidean distance weight.
A text-enhanced knowledge-graph representation learning system based on a local graph structure, comprising:
the input vector acquisition module is used for acquiring a knowledge graph of the local graph structure and acquiring a first input vector V through calculation of the knowledge graph and an input triplet sr And a second input vector V o ;
Predictive vector acquisitionA module for constructing a learning model for the first input vector V sr And a second input vector V o Training to obtain a first predictive vector e sr And a second predictive vector e o ;
A loss function calculation module for passing through the first prediction vector e sr And a second predictive vector e o Constructing a scoring function, and calculating to obtain a loss function through the scoring function;
and the link prediction module is used for repeatedly training the learning model until the loss function is smaller than a preset value, obtaining a trained learning model, and carrying out a link prediction task through the trained learning model.
The invention has the following beneficial effects:
the learning model constructed by the invention fuses the text coding and the local diagram structure information of the knowledge graph, thereby being beneficial to simultaneously acquiring the contextualization and the structured knowledge; the problem of insufficient structural information in a text-based method is solved by integrating the u-hop neighbor entity into the input vector; a structure enhancement mechanism combining the relative position distance is provided to offset prediction deviation caused by semantic difference, so that the finally obtained trained learning model can perform more accurate link prediction task.
Drawings
FIG. 1 is a flow chart of a method according to an embodiment of the present invention;
the achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Referring to fig. 1, the invention provides a text enhanced knowledge graph representation learning method based on a local graph structure, which comprises the following steps:
s1: obtaining a knowledge graph of a local graph structure, and obtaining a first input vector V through calculation of the knowledge graph and an input triplet sr And a second input vector V o ;
S2: construction of learning modelModel, first input vector V through learning model sr And a second input vector V o Training to obtain a first predictive vector e sr And a second predictive vector e o ;
S3: by a first predictive vector e sr And a second predictive vector e o Constructing a scoring function, and calculating to obtain a loss function through the scoring function;
s4: and repeating the steps S1-S3 until the loss function is smaller than a preset value, obtaining a trained learning model, and carrying out a link prediction task through the trained learning model.
Further, the step S1 specifically includes:
s11: obtaining a knowledge graph of a local graph structure,/>Representing a set of all entities->Representing a set of all relationships->Representing the correct triplet set; by->Obtaining an input triplet (s, r, o), wherein s represents a subject entity embedding, r represents a relationship embedding, and o represents a guest entity embedding;
s12: obtaining a hop neighbor list L of a subject entity embedded in s s And text description T of subject entity s Obtaining a jump neighbor list L of an object entity with the object entity embedded in o o Textual description T of a guest entity o ;
S13: acquisition of L s U-hop neighbor entity L of middle body entity s [u]Will s, r, L s [u]And T s Combining to obtain a first input vector V sr ;
S14: acquisition of L o Chinese objectU-hop neighbor entity L of entity o [u]O, L o [u]And T o Combining to obtain a second input vector V o 。
Specifically, the hop neighbor list L is obtained s And L o When the method is used, the subject entity s and the object entity o in the input triples (s, r, o) are excluded from the neighbor list; this is because in one triplet (s, r, o), for the subject entity s and the guest entity o, they are 1-hop neighbors of each other; thus, if the subject entity s is merged to the u-hop neighbor entity L of the guest entity o o [u]Potentially causing a risk of tag leakage in the predicted outcome and vice versa.
Further:
first input vector V sr The calculation formula of (2) is as follows:
V sr =s+L s [u]+r+T s
second input vector V o The calculation formula of (2) is as follows:
V o =o+L o [u]+T o
specifically, when the hop count u of the u-hop neighbor entity is selected, u=1 is generally selected as the hop count, so that excessive neighbor nodes caused by excessive hop count selection can be avoided, and the acquired neighbor entity information dilutes the information of the original entity and causes the performance degradation of the model.
Further, a text encoder is adopted in the process of the step S2, and a specific decoupling attention mechanism is combined, namely, the attention calculation in the original self-attention mechanism is decoupled and divided into two parts of semantic information and relative position confidence, and the attention bias is calculated respectively, so that the relative position information among all the labels is fused into the text encoder;
the step S2 specifically comprises the following steps:
s21: to the first input vector V sr And a second input vector V o Input learning model for V sr And V o Word segmentation processing is carried out to obtain word vectors, and a first hidden layer vector is obtained through calculation of attention, relative position distance and semantic information among the word vectorsAnd a second hidden layer vector->;
S22: by text encoder pairsAnd->Performing feature extraction forward propagation to obtain a first language model vector H sr And a second language model vector H o ;
S23: will H sr And H o Vector processing is carried out through pooling and regularization, and a first prediction vector e with unified dimension is obtained sr And a second predictive vector e o 。
Furthermore, in the embodiment of the invention, the text encoder end-to-end architecture integrating the relative position information, wherein in the input stage of the encoder, semantic information among original labels is utilized, the relative position information obtained by combining the relative position coding is utilized, and 5 attention offset vector matrixes are obtained through linear change and expressed as follows: k (K) p ,K s ,Q p ,Q s ,V s . And then the five attention bias information are added through a multi-head attention mechanism to calculate, so that the relative position information and the semantic information are successfully fused. And then performing text coding through forward propagation and aggregation and regularization operations of the encoder, finally, fusing absolute position information among tags, and transmitting the information to a next layer of encoder to perform the same coding operation, wherein the whole framework consists of N layers of encoder structures. Through the calculation of the encoder, the invention strengthens the extraction of the knowledge of the graph structure by fusing the relative position information, and lightens the prediction deviation caused by semantic ambiguity which is caused by only containing semantic information through a decoupled attention mechanism in the encoder, and the structure has obvious improvement on the performance of connection prediction;
the step S21 specifically includes:
S211: for V sr Word segmentation processing is carried out to obtain a first word vector set:
wherein token represents word segmentation processing, n represents the total number of first word vectors,representing an nth first word vector;
for V o Performing word segmentation processing to obtain a second word vector set:
where m represents the total number of second word vectors,representing an mth second word vector;
s212: the attention among the word vectors is obtained through calculation, and the calculation formula is as follows:
wherein H represents a semantic information hiding state associated with the word vector; q (Q) s 、K s And V s Respectively through projection matrix W qs 、W ks And W is vs Generated semantic vector matrix, K p And Q p Respectively through projection matrix W kp And W is qp A generated relative position vector matrix;
s213: the relative position distance is calculated and obtained, and the calculation formula is as follows:
wherein a and b are labels of a word vector, D (a, b) represents a relative position distance from label a to label b, and k represents a maximum relative position distance;
s214: calculating to obtain attention vector A from tag a to tag b a,b The calculation formula is as follows:
wherein,attention information representing semantics to semantics, +.>Represents Q s Line a, < >>Represent K s Line b, < >>Attention information representing semantics to relative position, < ->Represent K p Line D (a, b), +.>Attention information representing relative position to semantics, < ->Represents Q p Line D (a, b);
s215: constructing attention operation attention through attention vectors among all labels, and carrying out attention operation on all word vectors to obtain a first hidden layer vectorAnd a second hidden layer vector->The calculation formula is as follows:
。
furthermore, the invention adopts a double encoder structure, and utilizes the forward propagation, aggregation and regularization processes of the text encoder to extract information, and the first language model vector H in the step S22 sr And a second language model vector H o The generation process of (2) is as follows:
where the encoder represents the forward propagation and aggregation operations of the text encoder.
Furthermore, when vector processing is performed on the language model vectors, we firstly adopt an average pooling technology to pool the two vectors, reduce the dimension while retaining the main features, and then regularize the vectors through an L2 regularization technology to ensure that the dimensions of the two predicted vectors are uniform, and the first predicted vector e in step S23 sr And a second predictive vector e o The generation process of (2) is as follows:
wherein,representing pooling and regularization operations.
Furthermore, in order to obtain a more accurate triplet prediction result, the invention combines Euclidean distance on the basis of cosine function and introduces a reordering score, so that the strategy can ensure that the similarity score between two prediction vectors can be accurately calculated;
scoring function in step S3The expression of (2) is:
wherein,d edu representing the euclidean distance of the first predictive vector from the second predictive vector,representing cosine similarity of the first predictive vector and the second predictive vector,/and the like>Representing a reorder fraction obtained by reordering the predicted entities,/->Is the Euclidean distance weight.
Specifically, in order to obtain the spatial similarity of two prediction vectors more accurately, euclidean distance score is introduced, and is calculated as follows:
wherein, given an n-dimensional predictive vector e sr And e o ,And->Representing the projection of each of these two vectors along the respective dimensions, the Euclidean distance is:
in order to control the weights of Euclidean distances in the overall similarity score, we are in the scoring functionThe parameter controlling the Euclidean distance weight is also introduced>In addition, in order to enhance the local graph structure information and optimize the prediction performance, a direct reordering strategy is employed.This is because entities that are closer in distance are expected to have stronger relevance than entities that are farther apart;
the calculation formula of (2) is as follows:
the calculation formula of (2) is as follows:
wherein o is i Representing the calculated predicted guest entity if predicted guest entity o i U-hop neighbor list L of its corresponding subject entity s [u]In (c), then increasing a score assigned to the candidate entity. The scoring function can comprehensively calculate the scores of the two prediction vectors, and plays an important role in improving the prediction performance.
Further, in step S3, the loss function selects an InfoNCE loss function, which is expressed as follows:
wherein,representing additional intervals added during the calculation, +.>Temperature factor indicative of the negative influence of control difficulties during calculation +.>A score representing the negative sampling triples, D being the total number of negative sampling triples;
a text-enhanced knowledge-graph representation learning system based on a local graph structure, comprising:
the input vector acquisition module is used for acquiring a knowledge graph of the local graph structure and acquiring a first input vector V through calculation of the knowledge graph and an input triplet sr And a second input vector V o ;
A predictive vector acquisition module for constructing a learning model by which the first input vector V is subjected to sr And a second input vector V o Training to obtain a first predictive vector e sr And a second predictive vector e o ;
A loss function calculation module for passing through the first prediction vector e sr And a second predictive vector e o Constructing a scoring function, and calculating to obtain a loss function through the scoring function;
and the link prediction module is used for repeatedly training the learning model until the loss function is smaller than a preset value, obtaining a trained learning model, and carrying out a link prediction task through the trained learning model.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the terms first, second, third, etc. do not denote any order, but rather the terms first, second, third, etc. are used to interpret the terms as labels.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.
Claims (7)
1. A text enhanced knowledge graph representation learning method based on a local graph structure is characterized by comprising the following steps:
s1: obtaining a knowledge graph of a local graph structure, and obtaining a first input vector V through calculation of the knowledge graph and an input triplet sr And a second input vector V o ;
S2: constructing a learning model, and obtaining a first input vector V through the learning model sr And a second input vector V o Training to obtain a first predictive vector e sr And a second predictive vector e o ;
S3: by a first predictive vector e sr And a second predictive vector e o Constructing a scoring function, and calculating to obtain a loss function through the scoring function;
s4: and repeating the steps S1-S3 until the loss function is smaller than a preset value, obtaining a trained learning model, and carrying out a link prediction task through the trained learning model.
2. The text-enhanced knowledge graph representation learning method based on the partial graph structure according to claim 1, wherein the step S1 is specifically:
s11: obtaining a knowledge graph of a local graph structure,/>Representing a set of all entities->Representing a set of all relationships->Representing the correct triplet set; by->Obtaining an input triplet (s, r, o), wherein s represents a subject entity embedding, r represents a relationship embedding, and o represents a guest entity embedding;
s12: obtaining a hop neighbor list L of a subject entity embedded in s s And text description T of subject entity s Obtaining a jump neighbor list L of an object entity with the object entity embedded in o o Textual description T of a guest entity o ;
S13: acquisition of L s U-hop neighbor entity L of middle body entity s [u]Will s, r, L s [u]And T s Combining to obtain a first input vector V sr ;
S14: acquisition of L o U-hop neighbor entity L of middle guest entity o [u]O, L o [u]And T o Combining to obtain a second input vector V o 。
3. The text-enhanced knowledge-graph representation learning method based on the partial graph structure according to claim 2, wherein:
first input vector V sr The calculation formula of (2) is as follows:
V sr =s+L s [u]+r+T s
second input vector V o The calculation formula of (2) is as follows:
V o =o+L o [u]+T o 。
4. the text-enhanced knowledge graph representation learning method based on the partial graph structure according to claim 1, wherein the step S2 is specifically:
s21: to the first input vector V sr And a second input vector V o Input learningModel of V sr And V o Word segmentation processing is carried out to obtain word vectors, and a first hidden layer vector is obtained through calculation of attention, relative position distance and semantic information among the word vectorsAnd a second hidden layer vector->;
S22: by text encoder pairsAnd->Performing feature extraction forward propagation to obtain a first language model vector H sr And a second language model vector H o ;
S23: will H sr And H o Vector processing is carried out through pooling and regularization, and a first prediction vector e with unified dimension is obtained sr And a second predictive vector e o 。
5. The text-enhanced knowledge graph representation learning method based on the partial graph structure according to claim 4, wherein the step S21 is specifically:
s211: for V sr Word segmentation processing is carried out to obtain a first word vector set:
wherein token represents word segmentation processing, n represents the total number of first word vectors,representing an nth first word vector;
for V o Performing word segmentation processing to obtain a second word vector set:
where m represents the total number of second word vectors,representing an mth second word vector;
s212: the attention among the word vectors is obtained through calculation, and the calculation formula is as follows:
wherein H represents a semantic information hiding state associated with the word vector; q (Q) s 、K s And V s Respectively through projection matrix W qs 、W ks And W is vs Generated semantic vector matrix, K p And Q p Respectively through projection matrix W kp And W is qp A generated relative position vector matrix;
s213: the relative position distance is calculated and obtained, and the calculation formula is as follows:
wherein a and b are labels of a word vector, D (a, b) represents a relative position distance from label a to label b, and k represents a maximum relative position distance;
s214: calculating to obtain attention vector A from tag a to tag b a,b The calculation formula is as follows:
wherein,representation semanticsAttention information to semantics, ++>Represents Q s Line a, < >>Represent K s In the row b of (c),attention information representing semantics to relative position, < ->Represent K p Line D (a, b), +.>Attention information representing relative position to semantics, < ->Represents Q p Line D (a, b);
s215: constructing attention operation attention through attention vectors among all labels, and carrying out attention operation on all word vectors to obtain a first hidden layer vectorAnd a second hidden layer vector->The calculation formula is as follows:
。
6. the text-enhanced knowledge graph representation learning method based on the partial graph structure according to claim 1, wherein the scoring function in step S3The expression of (2) is:
wherein d edu Representing the euclidean distance of the first predictive vector from the second predictive vector,representing cosine similarity of the first predictive vector and the second predictive vector,/and the like>Representing a reorder fraction obtained by reordering the predicted entities,/->Is the Euclidean distance weight.
7. A text-enhanced knowledge graph representation learning system based on a local graph structure, comprising:
the input vector acquisition module is used for acquiring a knowledge graph of the local graph structure and acquiring a first input vector V through calculation of the knowledge graph and an input triplet sr And a second input vector V o ;
A predictive vector acquisition module for constructing a learning model by which the first input vector V is subjected to sr And a second input vector V o Training to obtain a first predictive vector e sr And a second predictive vector e o ;
A loss function calculation module for passing through the first prediction vector e sr And a second predictive vector e o Constructing a scoring function, and calculating to obtain a loss function through the scoring function;
and the link prediction module is used for repeatedly training the learning model until the loss function is smaller than a preset value, obtaining a trained learning model, and carrying out a link prediction task through the trained learning model.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311544608.6A CN117251583B (en) | 2023-11-20 | 2023-11-20 | Text enhanced knowledge graph representation learning method and system based on local graph structure |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311544608.6A CN117251583B (en) | 2023-11-20 | 2023-11-20 | Text enhanced knowledge graph representation learning method and system based on local graph structure |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117251583A true CN117251583A (en) | 2023-12-19 |
CN117251583B CN117251583B (en) | 2024-01-26 |
Family
ID=89135505
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311544608.6A Active CN117251583B (en) | 2023-11-20 | 2023-11-20 | Text enhanced knowledge graph representation learning method and system based on local graph structure |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117251583B (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110334219A (en) * | 2019-07-12 | 2019-10-15 | 电子科技大学 | The knowledge mapping for incorporating text semantic feature based on attention mechanism indicates learning method |
CN111191044A (en) * | 2019-12-25 | 2020-05-22 | 湖北大学 | Knowledge extraction and fusion method based on big data |
CN112035672A (en) * | 2020-07-23 | 2020-12-04 | 深圳技术大学 | Knowledge graph complementing method, device, equipment and storage medium |
CN113051408A (en) * | 2021-03-30 | 2021-06-29 | 电子科技大学 | Sparse knowledge graph reasoning method based on information enhancement |
WO2022011681A1 (en) * | 2020-07-17 | 2022-01-20 | 国防科技大学 | Method for fusing knowledge graph based on iterative completion |
US20220164683A1 (en) * | 2020-11-25 | 2022-05-26 | Fmr Llc | Generating a domain-specific knowledge graph from unstructured computer text |
CN116186216A (en) * | 2022-12-30 | 2023-05-30 | 福州大学 | Question generation method and system based on knowledge enhancement and double-graph interaction |
CN116415661A (en) * | 2023-03-20 | 2023-07-11 | 上海大学 | Generalized relation prediction method integrating subgraph enhancement and relation semantics and application |
-
2023
- 2023-11-20 CN CN202311544608.6A patent/CN117251583B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110334219A (en) * | 2019-07-12 | 2019-10-15 | 电子科技大学 | The knowledge mapping for incorporating text semantic feature based on attention mechanism indicates learning method |
CN111191044A (en) * | 2019-12-25 | 2020-05-22 | 湖北大学 | Knowledge extraction and fusion method based on big data |
WO2022011681A1 (en) * | 2020-07-17 | 2022-01-20 | 国防科技大学 | Method for fusing knowledge graph based on iterative completion |
CN112035672A (en) * | 2020-07-23 | 2020-12-04 | 深圳技术大学 | Knowledge graph complementing method, device, equipment and storage medium |
US20220164683A1 (en) * | 2020-11-25 | 2022-05-26 | Fmr Llc | Generating a domain-specific knowledge graph from unstructured computer text |
CN113051408A (en) * | 2021-03-30 | 2021-06-29 | 电子科技大学 | Sparse knowledge graph reasoning method based on information enhancement |
CN116186216A (en) * | 2022-12-30 | 2023-05-30 | 福州大学 | Question generation method and system based on knowledge enhancement and double-graph interaction |
CN116415661A (en) * | 2023-03-20 | 2023-07-11 | 上海大学 | Generalized relation prediction method integrating subgraph enhancement and relation semantics and application |
Non-Patent Citations (3)
Title |
---|
LI Z: ":learning knowledge graph embedding with heterogeneous relation attention networks:bing", IEEE * |
李志飞 等: "基于表示学习的知识图谱推理研究综述", 计算机科学 * |
黄培馨;赵翔;方阳;朱慧明;肖卫东;: "融合对抗训练的端到端知识三元组联合抽取", 计算机研究与发展, no. 12 * |
Also Published As
Publication number | Publication date |
---|---|
CN117251583B (en) | 2024-01-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111985369B (en) | Course field multi-modal document classification method based on cross-modal attention convolution neural network | |
CN110781683B (en) | Entity relation joint extraction method | |
CN110516095B (en) | Semantic migration-based weak supervision deep hash social image retrieval method and system | |
CN111666406B (en) | Short text classification prediction method based on word and label combination of self-attention | |
CN113313232B (en) | Functional brain network classification method based on pre-training and graph neural network | |
CN112818676A (en) | Medical entity relationship joint extraction method | |
CN112015868A (en) | Question-answering method based on knowledge graph completion | |
Ling et al. | Solving optimization problems through fully convolutional networks: An application to the traveling salesman problem | |
CN114648635B (en) | Multi-label image classification method fusing strong correlation among labels | |
CN113297369A (en) | Intelligent question-answering system based on knowledge graph subgraph retrieval | |
CN112766507B (en) | Complex problem knowledge base question-answering method based on embedded and candidate sub-graph pruning | |
CN113239153B (en) | Text and image mutual retrieval method based on example masking | |
CN116932722A (en) | Cross-modal data fusion-based medical visual question-answering method and system | |
CN114612767A (en) | Scene graph-based image understanding and expressing method, system and storage medium | |
CN113065409A (en) | Unsupervised pedestrian re-identification method based on camera distribution difference alignment constraint | |
CN111259938B (en) | Manifold learning and gradient lifting model-based image multi-label classification method | |
CN116187349A (en) | Visual question-answering method based on scene graph relation information enhancement | |
CN113642602B (en) | Multi-label image classification method based on global and local label relation | |
CN117954081A (en) | Intelligent medical inquiry method and system based on graph transducer | |
CN113240033A (en) | Visual relation detection method and device based on scene graph high-order semantic structure | |
CN117251583B (en) | Text enhanced knowledge graph representation learning method and system based on local graph structure | |
CN116681128A (en) | Neural network model training method and device with noisy multi-label data | |
CN116310545A (en) | Cross-domain tongue image classification method based on depth layering optimal transmission | |
CN114741487B (en) | Image-text retrieval method and system based on image-text semantic embedding | |
CN115496991A (en) | Reference expression understanding method based on multi-scale cross-modal feature fusion |
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 |