WO2021068468A1 - 知识图谱的向量表示生成方法、装置及设备 - Google Patents

知识图谱的向量表示生成方法、装置及设备 Download PDF

Info

Publication number
WO2021068468A1
WO2021068468A1 PCT/CN2020/083547 CN2020083547W WO2021068468A1 WO 2021068468 A1 WO2021068468 A1 WO 2021068468A1 CN 2020083547 W CN2020083547 W CN 2020083547W WO 2021068468 A1 WO2021068468 A1 WO 2021068468A1
Authority
WO
WIPO (PCT)
Prior art keywords
knowledge graph
context
vector representation
entity
context type
Prior art date
Application number
PCT/CN2020/083547
Other languages
English (en)
French (fr)
Inventor
王泉
黄苹苹
王海峰
姜文斌
吕雅娟
朱勇
吴华
Original Assignee
北京百度网讯科技有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 北京百度网讯科技有限公司 filed Critical 北京百度网讯科技有限公司
Priority to US17/043,227 priority Critical patent/US11995560B2/en
Priority to JP2021515601A priority patent/JP7262571B2/ja
Priority to EP20767703.0A priority patent/EP4044045A4/en
Priority to KR1020207036656A priority patent/KR102604959B1/ko
Publication of WO2021068468A1 publication Critical patent/WO2021068468A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/02Knowledge representation; Symbolic representation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/31Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/31Indexing; Data structures therefor; Storage structures
    • G06F16/316Indexing structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3347Query execution using vector based model
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9017Indexing; Data structures therefor; Storage structures using directory or table look-up
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/906Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/042Knowledge-based neural networks; Logical representations of neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/02Knowledge representation; Symbolic representation
    • G06N5/022Knowledge engineering; Knowledge acquisition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities

Definitions

  • This application relates to the field of computer technology, in particular to the field of artificial intelligence technology, and proposes a method, device and equipment for generating a vector representation of a knowledge graph.
  • Knowledge graph is a knowledge base with a directed graph structure that describes the world's real knowledge.
  • the goal of knowledge graph representation is to represent the entities/relationships of discrete symbols in the knowledge graph as vectors:
  • vector representation can retain the structural aspects of entities in the knowledge graph.
  • knowledge graphs are all applied and functioned in the form of vectors.
  • This application aims to solve one of the technical problems in the related technology at least to a certain extent.
  • the first purpose of this application is to propose a vector representation generation method of a knowledge graph, so as to realize a more refined semantic representation of entities in a context, and further improve the accuracy of knowledge graph representation learning.
  • the second purpose of this application is to provide a vector representation generating device for knowledge graphs.
  • the third purpose of this application is to propose an electronic device.
  • the fourth purpose of this application is to provide a computer-readable storage medium.
  • the embodiment of the first aspect of the present application proposes a method for generating a vector representation of a knowledge graph, including:
  • a vector representation corresponding to the multiple entity nodes is generated through a context model.
  • An embodiment of the second aspect of the present application proposes a vector representation generating device for a knowledge graph, including:
  • a processing module for obtaining the context type and context data corresponding to the knowledge graph
  • a generating module is used to generate vector representations corresponding to the multiple entity nodes through a context model according to the context data and the context type.
  • An embodiment of the third aspect of the present application proposes an electronic device, including at least one processor, and a memory communicatively connected with the at least one processor; wherein the memory stores a memory that can be executed by the at least one processor. Instructions, the instructions are executed by the at least one processor, so that the at least one processor can execute the vector representation generation method of the knowledge graph as described in the embodiment of the first aspect.
  • the embodiment of the fourth aspect of the present application proposes a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the vector representation generation of the knowledge graph as described in the embodiment of the first aspect method.
  • An embodiment in the above application has the following advantages or beneficial effects: since the knowledge graph is obtained, the context type and context data corresponding to the knowledge graph are obtained. Furthermore, vector representations corresponding to multiple entity nodes are generated through the context model according to the context data and context types. As a result, the context of the entity is considered when generating the vector representation of the entity. If the context of the entity is different, the vector representation obtained will be different, which improves the vector representation’s ability to model complex relationships and improve the representation ability. Sufficient, to achieve a more refined semantic representation of the entity in the context, thereby further improving the accuracy of the knowledge graph representation learning.
  • FIG. 1 is a schematic flowchart of a method for generating a vector representation of a knowledge graph provided by an embodiment of the application;
  • FIG. 2 is a schematic flowchart of another method for generating a vector representation of a knowledge graph provided by an embodiment of the application;
  • FIG. 3 is a schematic diagram of a knowledge graph provided by an embodiment of this application.
  • FIG. 4 is a schematic diagram of another knowledge graph provided by an embodiment of this application.
  • FIG. 5 is a schematic flowchart of another method for generating a vector representation of a knowledge graph provided by an embodiment of the application
  • Fig. 6 is a schematic diagram of another knowledge graph provided by an embodiment of the application.
  • Fig. 7 is a schematic flow chart of a context model of training sequence structure provided by an embodiment of the application.
  • Figure 8 is a schematic diagram of a sequence structure context model
  • FIG. 9 is a schematic flowchart of a training sub-graph context model provided by an embodiment of this application.
  • Figure 10 is a schematic diagram of the sub-picture context model
  • FIG. 11 is a schematic structural diagram of a vector representation generating device for a knowledge graph provided by an embodiment of this application.
  • FIG. 12 is a schematic structural diagram of another vector representation generating device of a knowledge graph provided by an embodiment of this application.
  • Fig. 13 shows a block diagram of an exemplary electronic device suitable for implementing the embodiments of the present application.
  • Fig. 1 is a schematic flowchart of a method for generating a vector representation of a knowledge graph provided by an embodiment of the application. As shown in Fig. 1, the method includes:
  • Step 101 Obtain a knowledge graph, where the knowledge graph includes multiple entity nodes.
  • the knowledge graph when learning the knowledge graph representation, it is necessary to obtain the vector representation of the knowledge graph, for example, the entity/relationship of the discrete symbols in the knowledge graph is represented by a continuous vector.
  • the knowledge graph when generating the vector representation of the knowledge graph, the knowledge graph may be obtained first.
  • the knowledge graph includes multiple entity nodes and edges between entity nodes.
  • the knowledge graph includes entity nodes "person A” and "occupation B”, and an edge connecting the two entity nodes, indicating that the entities have a relationship "holding a position”.
  • Step 102 Acquire the context type and context data corresponding to the knowledge graph.
  • the context type corresponding to the knowledge graph can be obtained, and then the context data of the knowledge graph can be determined according to the context type.
  • the context type includes sequence structure context type and sub-picture context type.
  • the number of multiple entity nodes in the knowledge graph is obtained; if the knowledge graph includes two entity nodes, the context type corresponding to the knowledge graph is judged to be the sequence structure context type; if the knowledge graph includes If there are more than two entity nodes, it is judged that the context type corresponding to the knowledge graph is the subgraph context type.
  • a corresponding method is selected according to different context types to determine the context data of the knowledge graph.
  • entity nodes and edges between entity nodes in the knowledge graph can be added to the context data.
  • the target entity node in the knowledge graph can be determined, and the entity nodes and edges within the preset range centered on the target entity node in the knowledge graph can be added to the context data.
  • Step 103 Generate vector representations corresponding to multiple entity nodes through the context model according to the context data and the context type.
  • the context model corresponding to the context type can be pre-trained, where the context model input is context data, and the output is vector representation. Furthermore, by inputting context data into the context model, vector representations corresponding to multiple entity nodes in the knowledge graph are generated.
  • the sequence structure context model is called to generate the vector representations corresponding to multiple entity nodes according to the context data; if the context type is a subgraph context type, then call The sub-graph structure context model generates vector representations corresponding to multiple entity nodes based on the context data.
  • the context of a map element refers to a connected structure composed of the map element and other map elements.
  • the vector representations corresponding to multiple entity nodes are generated through the context model according to the context data and context types. Therefore, for the same entity, the context of the entity is different, and the obtained representation vector is different. For example, for the entity character A in the knowledge graph, the vector representations generated in different contexts are different. Therefore, when generating the vector representation of multiple entity nodes in the knowledge graph, the context of the entity is taken into account, and the vector representation's ability to model complex relationships (such as one-to-many and many-to-many) is improved. More fully.
  • the vector representation generating method of the knowledge graph in the embodiment of the present application obtains the knowledge graph, and then obtains the context type and context data corresponding to the knowledge graph. Furthermore, vector representations corresponding to multiple entity nodes are generated through the context model according to the context data and context types. As a result, the context of the entity is considered when generating the vector representation of the entity. If the context of the entity is different, the vector representation obtained will be different, which improves the vector representation’s ability to model complex relationships and improve the representation ability. Sufficient, to achieve a more refined semantic representation of the entity in the context, thereby further improving the accuracy of the knowledge graph representation learning.
  • Fig. 2 is a schematic flowchart of another method for generating a vector representation of a knowledge graph provided by an embodiment of the application. As shown in Fig. 2, the method includes:
  • Step 201 Obtain a knowledge graph, where the knowledge graph includes multiple entity nodes.
  • Step 202 Obtain the number of multiple entity nodes in the knowledge graph. If the knowledge graph includes two entity nodes, then determine that the context type corresponding to the knowledge graph is a sequence structure context type.
  • the knowledge graph includes two entity nodes, that is, after the context type is determined as the sequence structure context type, the number of edges between the two entity nodes can be further determined.
  • obtain the number of edges between two entity nodes If the number of edges between two entity nodes is equal to 1, then determine that the context type corresponding to the knowledge graph is the edge structure context type; if one of the two entity nodes is If the number of edges is greater than 1, it is judged that the context type corresponding to the knowledge graph is the path structure context type.
  • the knowledge graph includes entity nodes "person A” and "occupation B”, and the edge "holding a position” connecting the two entity nodes, then the context type is determined to be the edge structure context type.
  • the knowledge graph includes the entity nodes “person A” and “English”, and the edge “daughter”, “living country”, and “official language” connecting the two entity nodes in turn, then the context type is determined It is the context type of path structure.
  • Step 203 Obtain context data corresponding to the knowledge graph.
  • the context type of the knowledge graph includes the edge structure context type and the path structure context type, and the context data corresponding to the knowledge graph is obtained according to the context type of the knowledge graph.
  • the context type is an edge structure context type
  • the triples corresponding to the knowledge graph are all added to the context data.
  • the corresponding triples (person A, position, occupation B) are added to the context data.
  • the context type is the path structure context type
  • the path corresponding to the knowledge graph is obtained
  • the path data of the path is obtained by way of path sampling
  • the entity nodes in the path data and the knowledge graph are added to the context data.
  • the path data “daughter”, “country of life”, “official language” and the entity node "person A” and "English” are added to the context data.
  • a corresponding amount of path data can be obtained through random walk sampling based on the edges in the knowledge graph.
  • Step 204 Generate vector representations corresponding to multiple entity nodes through the sequence structure context model according to the context data.
  • the context type corresponding to the knowledge graph is the sequence structure context type.
  • the context data is input into the pre-trained sequence structure context model for processing, and multiple entities are generated The vector representation of the node.
  • the vector representation generation method of the knowledge graph of the embodiment of the present application can obtain the corresponding context data for the knowledge graph of the sequence structure context type, and then generate the vector representation of multiple entity nodes in the knowledge graph according to the context data, and generate knowledge
  • the vector representation of multiple entity nodes in the graph spectrum takes into account the context of the entity, the representation ability is more adequate.
  • FIG. 5 is a schematic flowchart of another method for generating a vector representation of a knowledge graph provided by an embodiment of the application. As shown in FIG. 5, the method includes:
  • Step 501 Obtain a knowledge graph, where the knowledge graph includes multiple entity nodes.
  • Step 502 Obtain the number of multiple entity nodes in the knowledge graph. If the knowledge graph includes more than two entity nodes, determine that the context type corresponding to the knowledge graph is the sub-graph context type.
  • the knowledge graph includes entity nodes "person A”, “person B”, “person C”, “person D”, and edges "daughter” and "wife”. Then the context type is determined as subgraph context Types of.
  • Step 503 Obtain context data corresponding to the knowledge graph.
  • the context data is obtained in the following manner.
  • S1 generate a set of entity nodes corresponding to the knowledge graph;
  • S2 extract the first initial entity node from the set of entity nodes, and generate a wandering radius d;
  • S3, take the first initial entity node as the center, and take the wandering radius d at Walk on the knowledge graph to determine the d-order subgraph centered on the first initial entity node, and add the d-order subgraph centered on the first initial entity node to the context data;
  • S4 repeat the steps S2 and S3 until the entity node in the entity node set completes the extraction.
  • the wandering radius d can be generated by randomly sampling from a preset range (for example, 1-Dmax). After determining the d-order subgraph centered on the first initial entity node, the edges in the subgraph can also be completed.
  • Step 504 Generate vector representations corresponding to multiple entity nodes through the sub-graph context type according to the context data.
  • the context type corresponding to the knowledge graph is the sub-graph context type.
  • the context data is input into the pre-trained sub-graph context model for processing to generate multiple entities The vector representation of the node.
  • the vector representation generation method of the knowledge graph of the embodiment of the present application can obtain the corresponding context data for the knowledge graph of the sub-graph context type, and then generate the vector representation of multiple entity nodes in the knowledge graph according to the context data, and generate knowledge
  • the vector representation of multiple entity nodes in the graph spectrum takes into account the context of the entity, the representation ability is more adequate.
  • FIG. 7 is a schematic flowchart of a context model of a training sequence structure provided by an embodiment of the application, as shown in FIG. 7, including:
  • Step 701 Obtain a sample knowledge graph.
  • the sample knowledge graph includes entity nodes and edges.
  • a sample knowledge graph when training the sequence structure context model, can be obtained, where the sample knowledge graph includes entity nodes and edges.
  • a knowledge graph whose context type is a sequence structure context type can be obtained as a sample knowledge graph.
  • Step 702 Obtain the first vector representation of the entity nodes and edges in the sample knowledge graph and the second vector representation of the position information of the entity nodes and edges in the sample knowledge graph through a table lookup operation.
  • the vector representation of the entity node and the vector representation of the edge are obtained through a table look-up operation as the first vector representation.
  • the vector representation corresponding to the position information of the entity node in the sequence and the vector representation corresponding to the position information of the edge in the sequence are obtained through a table lookup operation, as the second vector representation.
  • Step 703 Input the first vector representation and the second vector representation into a preset model for processing, and obtain a third vector representation corresponding to each entity node in the sample knowledge graph.
  • both the physical node and the edge are used as the input of the preset model, for example, the first vector representation and the second vector representation corresponding to the physical node/edge are added as the input of the preset model.
  • the preset model is a self-attention model (Transformer), and Both are input to the preset model, processed by the L-layer self-attention model, and the third vector representation is determined according to the vector representation output by the L-th layer, that is, the third vector representation of each entity node in the context
  • Step 704 Perform entity classification prediction according to the third vector representation, adjust the processing parameters of the preset model according to the prediction result, and train the sequence structure context model.
  • the third vector representation is processed according to the forward neural network (FFNN) and the softmax function to obtain the probability distribution of each prediction result Furthermore, by maximizing the probability value of the actual result corresponding to the entity node, the parameter optimization of the model is performed.
  • FFNN forward neural network
  • the entity node is "English"
  • the obtained prediction results include English, French, Japanese, etc.
  • the probability of English in the prediction results is maximized, thereby training the sequence structure context model.
  • the entity nodes "person A”, “English”, and “daughter”, "country of life” and “official language” are taken as the input of the preset model.
  • the occlusion position is the location of the entity node "English”.
  • the L-layer self-attention model is processed, the third vector representation of the occlusion position output is obtained.
  • the probability distribution of each prediction result is obtained, and the entity is maximized
  • the probability value of the actual result corresponding to the node is optimized for the parameter of the model.
  • the occlusion position is further set to the position of the entity node "Person A" for training.
  • the occluded physical node is predicted by the preset model, and the prediction result is compared with the actual result, and the parameters of the preset model are adjusted according to the comparison result until the prediction result is consistent with the actual result , So as to realize the context model of training sequence structure.
  • the sequence structure context model can be trained, so that the sequence structure context model input is context data, and the output is the vector representation corresponding to the entity node.
  • FIG. 9 is a schematic diagram of a process of training a subgraph context model provided by an embodiment of the application, as shown in FIG. 9, including:
  • Step 901 Obtain a sample knowledge graph.
  • the sample knowledge graph includes entity nodes and edges.
  • a sample knowledge graph when training the sequence structure context model, can be obtained, where the sample knowledge graph includes entity nodes and edges.
  • a knowledge graph whose context type is a sub-graph context type can be obtained as a sample knowledge graph.
  • Step 902 Obtain the node vector of the entity node in the sample knowledge graph through a table lookup operation, input the node vector into a preset model for processing, and obtain a fourth vector representation corresponding to each entity node in the sample knowledge graph.
  • the entity node is used as the input of the preset model, that is, the node vector of the entity node in the sample knowledge graph is obtained through a table lookup operation, and the node vector is input into the preset model for processing, and each entity node in the sample knowledge graph is obtained The corresponding fourth vector representation.
  • the preset model is a self-attention model (Transformer), and the node vectors are all input to the preset model, processed by the L-level self-attention model (Transformer), and are represented according to the vector output of the L-th Determine the fourth vector representation, that is, the fourth vector representation of each entity node in the context
  • the correlation matrix between entities is obtained, and the reachability of the attention calculation from each entity node to other entity nodes is controlled according to the correlation matrix. In this way, it is possible to support data with a sub-picture structure.
  • step 1 Set the number of model heads to the number R of relation categories in the knowledge graph, and obtain the vector representation of Query(Q)/Kery(K)/Value(V) under each side relation:
  • l is the current number of layers
  • r is the r-th head
  • H is the input node vector of the layer
  • I the weight parameter of the corresponding weight matrix under the r-th head of the l-th layer.
  • Step 2 Calculate the attention value of each node to other nodes.
  • the correlation matrix A r between the entity nodes under a specific relationship r to control the attention of each node to other entity nodes
  • D a is the dimension parameter of the attention vector (for example, a common value is 64).
  • a r is the incidence matrix between the entity nodes in the subgraph under the relation r, and each element takes the value 0 or 1, Indicates that the i-th entity node in the subgraph can be connected to the j-th entity node through the relationship r, that is, the triplet of (node i, r, node j) is established; otherwise
  • Step 903 Perform entity classification prediction according to the fourth vector representation, adjust the processing parameters of the preset model according to the prediction result, and train the sub-graph structure context model.
  • the fourth vector representation is processed according to the forward neural network (FFNN) and the softmax function to obtain the probability distribution of each prediction result Furthermore, by maximizing the probability value of the actual result corresponding to the entity node, the parameter optimization of the model is performed.
  • FFNN forward neural network
  • the entity node is "English"
  • the obtained prediction results include English, French, Japanese, etc., by adjusting the model parameters to maximize the probability of English in the prediction result, thereby training the sub-graph context model.
  • the entity nodes "Character A”, “Character B”, “Character C” and “Character D” are taken as the input of the preset model, and the occlusion position is determined Is the location of the entity node "person A”, processed by the L-layer self-attention model, obtains the fourth vector representation of the occlusion position output, and obtains the probability distribution of each prediction result according to the fourth vector representation, by maximizing the actual value corresponding to the entity node The probability value of the result, the parameter optimization of the model.
  • the occlusion position is further set to the position of the entity node "Person B" for training.
  • the sub-graph context model can be trained so that the input of the sub-graph context model is context data and the output is the vector representation corresponding to the entity node, which can support the data of the sub-graph structure.
  • sequence structure context model and sub-graph context model can share tables corresponding to table lookup operations. Therefore, different context data will have a common influence on entity representation learning, so that entities can fully learn various context data.
  • the present application also proposes a vector representation generating device of a knowledge graph.
  • FIG. 11 is a schematic structural diagram of an apparatus for generating a vector representation of a knowledge graph provided by an embodiment of the application. As shown in FIG. 11, the apparatus includes: an acquisition module 10, a processing module 20, and a generating module 30.
  • the obtaining module 10 is used to obtain a knowledge graph, where the knowledge graph includes multiple entity nodes.
  • the processing module 20 is used to obtain the context type and context data corresponding to the knowledge graph.
  • the generating module 30 is used to generate vector representations corresponding to multiple entity nodes through the context model according to the context data and the context type.
  • the processing module 20 is specifically configured to: obtain the number of the multiple entity nodes in the knowledge graph; if the knowledge graph includes two entity nodes, determine that the context type corresponding to the knowledge graph is a sequence structure Context type; if the knowledge graph includes more than two entity nodes, it is determined that the context type corresponding to the knowledge graph is the subgraph context type.
  • the context type corresponding to the knowledge graph is a subgraph context type
  • the processing module 20 is specifically configured to: S1, generate a set of entity nodes corresponding to the knowledge graph; S2, extract the second entity node set from the set of entities An initial physical node and generate a wandering radius d; S3, taking the first initial physical node as the center, and wandering on the knowledge graph with the wandering radius d to determine the first initial physical node A subgraph of order d centered on the entity node, and the subgraph of order d centered on the first initial entity node is added to the context data; S4, repeating the steps S2 and S3 until the The entity node in the entity node set is extracted.
  • the context type corresponding to the knowledge graph is an edge structure context type
  • the processing module 20 is specifically configured to add all triples corresponding to the knowledge graph into the context data.
  • the context type corresponding to the knowledge graph is a path structure context type
  • the processing module 20 is specifically configured to: obtain the path corresponding to the knowledge graph; obtain the path data of the path by way of path sampling, and combine the path data and the knowledge graph The entity node in the access context data.
  • the context model includes a sequence structure context model and a subgraph structure context model
  • the generating module 30 is specifically configured to: if the context type is a sequence structure context type, call the sequence structure context model according to The context data generates vector representations corresponding to the multiple entity nodes; if the context type is a sub-graph context type, the sub-graph structure context model is called to generate the multiple The vector representation corresponding to each entity node.
  • the device shown in FIG. 12 further includes: a judgment module 40, a first training module 50, and a second training module 60.
  • the judgment module 40 is used to obtain the number of edges between two entity nodes if the context type corresponding to the knowledge graph is a sequence structure context type; if the number of edges between two entity nodes is equal to 1, then judge The context type corresponding to the knowledge graph is the edge structure context type; if the number of edges between two entity nodes is greater than 1, the context type corresponding to the knowledge graph is judged to be the path structure context type.
  • the first training module 50 is configured to obtain a sample knowledge graph, the sample knowledge graph includes entity nodes and edges; obtain the first vector representation of the entity nodes and edges in the sample knowledge graph through a table lookup operation, and the sample knowledge
  • the second vector representation of the position information of the entity nodes and edges in the graph; the first vector representation and the second vector representation are input into a preset model for processing, and the first vector representation corresponding to each entity node in the sample knowledge graph is obtained Three-vector representation; performing entity classification prediction according to the third vector representation, adjusting the processing parameters of the preset model according to the prediction result, and training the sequence structure context model.
  • the second training module 60 is configured to obtain a sample knowledge graph, the sample knowledge graph including entity nodes and edges; obtain the node vector of the entity node in the sample knowledge graph through a table look-up operation, and input the node vector into a preset model Processing to obtain a fourth vector representation corresponding to each entity node in the sample knowledge graph, where an association matrix is obtained, and the accessibility of attention calculation from each entity node to other entity nodes is controlled according to the association matrix; Perform entity classification prediction according to the fourth vector representation, adjust the processing parameters of the preset model according to the prediction result, and train the sub-picture structure context model.
  • the vector representation generating device of the knowledge graph of the embodiment of the present application obtains the knowledge graph to obtain the context type and context data corresponding to the knowledge graph. Furthermore, vector representations corresponding to multiple entity nodes are generated through the context model according to the context data and context types. As a result, the context of the entity is considered when generating the vector representation of the entity. If the context of the entity is different, the vector representation obtained will be different, which improves the vector representation’s ability to model complex relationships and improve the representation ability. Sufficient, to achieve a more refined semantic representation of the entity in the context, thereby further improving the accuracy of the knowledge graph representation learning.
  • the present application also proposes a computer program product, which when the instructions in the computer program product are executed by a processor, realizes the vector representation generation method of the knowledge graph as described in any of the foregoing embodiments.
  • the present application also provides an electronic device and a readable storage medium.
  • FIG. 13 it is a block diagram of an electronic device of a method for generating a vector representation of a knowledge graph according to an embodiment of the application.
  • Electronic devices are intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers.
  • Electronic devices can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices.
  • the components shown herein, their connections and relationships, and their functions are merely examples, and are not intended to limit the implementation of the application described and/or required herein.
  • the electronic device includes: one or more processors 1301, memory 1302, and interfaces for connecting various components, including a high-speed interface and a low-speed interface.
  • the various components are connected to each other using different buses, and can be installed on a common motherboard or installed in other ways as needed.
  • the processor may process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of the GUI on an external input/output device (such as a display device coupled to an interface).
  • an external input/output device such as a display device coupled to an interface.
  • multiple processors and/or multiple buses can be used with multiple memories and multiple memories.
  • multiple electronic devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system).
  • one processor 1301 is taken as an example.
  • the memory 1302 is the non-transitory computer-readable storage medium provided by this application.
  • the memory stores instructions executable by at least one processor, so that the at least one processor executes the vector representation generation method of the knowledge graph provided in this application.
  • the non-transitory computer-readable storage medium of the present application stores computer instructions, and the computer instructions are used to make the computer execute the vector representation generation method of the knowledge graph provided by the present application.
  • the memory 1302 as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as the program instructions/modules corresponding to the vector representation generation method of the knowledge graph in the embodiment of the present application (For example, the acquisition module 10, the processing module 20, and the generating module 30 shown in FIG. 11).
  • the processor 1301 executes various functional applications and data processing of the server by running non-transitory software programs, instructions, and modules stored in the memory 1302, that is, realizes the vector representation generation method of the knowledge graph in the foregoing method embodiment.
  • the memory 1302 may include a program storage area and a data storage area.
  • the program storage area may store an operating system and an application program required by at least one function; the data storage area may store data created according to the use of the electronic device, and the like.
  • the memory 1302 may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices.
  • the memory 1302 may optionally include memories remotely provided with respect to the processor 1301, and these remote memories may be connected to the electronic device through a network. Examples of the aforementioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
  • the electronic device of the method for generating the vector representation of the knowledge graph may further include: an input device 1303 and an output device 1304.
  • the processor 1301, the memory 1302, the input device 1303, and the output device 1304 may be connected by a bus or other methods. In FIG. 13, the connection by a bus is taken as an example.
  • the input device 1303 can receive input digital or character information, and generate key signal input related to the user settings and function control of the electronic device, such as touch screen, keypad, mouse, track pad, touch pad, indicator stick, one or more Input devices such as mouse buttons, trackballs, joysticks, etc.
  • the output device 1304 may include a display device, an auxiliary lighting device (for example, LED), a tactile feedback device (for example, a vibration motor), and the like.
  • the display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display, and a plasma display. In some embodiments, the display device may be a touch screen.
  • Various implementations of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: being implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, the programmable processor It can be a dedicated or general-purpose programmable processor that can receive data and instructions from the storage system, at least one input device, and at least one output device, and transmit the data and instructions to the storage system, the at least one input device, and the at least one output device. An output device.
  • machine-readable medium and “computer-readable medium” refer to any computer program product, device, and/or device used to provide machine instructions and/or data to a programmable processor ( For example, magnetic disks, optical disks, memory, programmable logic devices (PLD)), including machine-readable media that receive machine instructions as machine-readable signals.
  • machine-readable signal refers to any signal used to provide machine instructions and/or data to a programmable processor.
  • the systems and techniques described here can be implemented on a computer that has: a display device for displaying information to the user (for example, a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) ); and a keyboard and a pointing device (for example, a mouse or a trackball) through which the user can provide input to the computer.
  • a display device for displaying information to the user
  • LCD liquid crystal display
  • keyboard and a pointing device for example, a mouse or a trackball
  • Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (for example, visual feedback, auditory feedback, or tactile feedback); and can be in any form (including Acoustic input, voice input, or tactile input) to receive input from the user.
  • the systems and technologies described herein can be implemented in a computing system that includes back-end components (for example, as a data server), or a computing system that includes middleware components (for example, an application server), or a computing system that includes front-end components (for example, A user computer with a graphical user interface or a web browser, through which the user can interact with the implementation of the system and technology described herein), or includes such back-end components, middleware components, Or any combination of front-end components in a computing system.
  • the components of the system can be connected to each other through any form or medium of digital data communication (for example, a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), and the Internet.
  • the computer system can include clients and servers.
  • the client and server are generally far away from each other and usually interact through a communication network.
  • the relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other.
  • the position of the obtained candidate frame is more accurate, which solves the problem that the accuracy of obtaining candidate frames for generating the vector representation of the dense scene knowledge graph needs to be improved, thereby improving the accuracy of generating the vector representation of the knowledge graph .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • Computational Linguistics (AREA)
  • Artificial Intelligence (AREA)
  • Mathematical Physics (AREA)
  • Evolutionary Computation (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Molecular Biology (AREA)
  • Biophysics (AREA)
  • Biomedical Technology (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Animal Behavior & Ethology (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Machine Translation (AREA)

Abstract

一种知识图谱的向量表示生成方法、装置及设备,涉及人工智能技术领域,具体实现方案为:获取知识图谱,其中,知识图谱包括多个实体节点(101);获取知识图谱对应的语境类型和语境数据(102);以及根据语境数据和语境类型通过语境模型生成多个实体节点对应的向量表示(103)。由此,实现了实体在语境中的更精细化的语义表示,从而进一步提高了知识图谱表示学习的准确性。

Description

知识图谱的向量表示生成方法、装置及设备
相关申请的交叉引用
本申请要求北京百度网讯科技有限公司于2019年10月08日提交的、发明名称为“知识图谱的向量表示生成方法、装置及设备”的、中国专利申请号“201910950874.6”的优先权。
技术领域
本申请涉及计算机技术领域,尤其涉及人工智能技术领域,提出一种知识图谱的向量表示生成方法、装置及设备。
背景技术
知识图谱是描述世界现实知识的有向图结构的知识库,知识图谱表示学习的目标是将知识图谱中离散符号的实体/关系以向量表示:向量表示一方面能保留实体在知识图谱中结构方面的关键信息,另一方面便于应用任务对知识图谱的利用。目前在信息抽取、问答、阅读理解等任务中,知识图谱都是以向量形式被应用并发挥作用。
相关技术中的知识图谱表示学习,对图谱元素(包括实体和关系)学习到静态的、固定的向量表示,表示能力受限,准确度有待提高。
发明内容
本申请旨在至少在一定程度上解决相关技术中的技术问题之一。
为此,本申请的第一个目的在于提出一种知识图谱的向量表示生成方法,以实现实体在语境中的更精细化的语义表示,进一步提高了知识图谱表示学习的准确性。
本申请的第二个目的在于提出一种知识图谱的向量表示生成装置。
本申请的第三个目的在于提出一种电子设备。
本申请的第四个目的在于提出一种计算机可读存储介质。
本申请第一方面实施例提出了一种知识图谱的向量表示生成方法,包括:
获取知识图谱,其中,所述知识图谱包括多个实体节点;
获取所述知识图谱对应的语境类型和语境数据;以及
根据所述语境数据和所述语境类型通过语境模型生成所述多个实体节点对应的向量表示。
本申请第二方面实施例提出了一种知识图谱的向量表示生成装置,包括:
获取模块,用于获取知识图谱,其中,所述知识图谱包括多个实体节点;
处理模块,用于获取所述知识图谱对应的语境类型和语境数据;以及
生成模块,用于根据所述语境数据和所述语境类型通过语境模型生成所述多个实体节点对应的向量表示。
本申请第三方面实施例提出了一种电子设备,包括至少一个处理器,以及与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如第一方面实施例所述的知识图谱 的向量表示生成方法。
本申请第四方面实施例提出了一种存储有计算机指令的非瞬时计算机可读存储介质,所述计算机指令用于使所述计算机执行如第一方面实施例所述的知识图谱的向量表示生成方法。
上述申请中的一个实施例具有如下优点或有益效果:由于采用了获取知识图谱,进而获取知识图谱对应的语境类型和语境数据。进一步根据语境数据和语境类型通过语境模型生成多个实体节点对应的向量表示。由此,在生成实体的向量表示时考虑了实体所处的语境,实体所处的语境不同,则其获得的向量表示不同,提高了向量表示对复杂关系的建模能力,表示能力更充分,实现了实体在语境中的更精细化的语义表示,从而进一步提高了知识图谱表示学习的准确性。
上述可选方式所具有的其他效果将在下文中结合具体实施例加以说明。
附图说明
附图用于更好地理解本方案,不构成对本申请的限定。其中:
图1为本申请实施例所提供的一种知识图谱的向量表示生成方法的流程示意图;
图2为本申请实施例所提供的另一种知识图谱的向量表示生成方法的流程示意图;
图3为本申请实施例所提供的一种知识图谱示意图;
图4为本申请实施例所提供的另一种知识图谱示意图;
图5为本申请实施例所提供的另一种知识图谱的向量表示生成方法的流程示意图;
图6为本申请实施例所提供的另一种知识图谱示意图;
图7为本申请实施例所提供的一种训练序列结构语境模型的流程示意图;
图8为序列结构语境模型示意图;
图9为本申请实施例所提供的一种训练子图语境模型的流程示意图;
图10为子图语境模型示意图;
图11为本申请实施例所提供的一种知识图谱的向量表示生成装置的结构示意图;
图12为本申请实施例所提供的另一种知识图谱的向量表示生成装置的结构示意图;
图13示出了适于用来实现本申请实施例的示例性电子设备的框图。
具体实施方式
以下结合附图对本申请的示范性实施例做出说明,其中包括本申请实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本申请的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。
图1为本申请实施例所提供的一种知识图谱的向量表示生成方法的流程示意图,如图1所示,该方法包括:
步骤101,获取知识图谱,其中,知识图谱包括多个实体节点。
在实际应用中,在进行知识图谱表示学习时,需要获取知识图谱的向量表示,例如将知识图谱中离散符号的实体/关系以连续向量表示出来。本 实施例中,在生成知识图谱的向量表示时,可以先获取知识图谱。
可选地,知识图谱包括多个实体节点和实体节点之间的边。作为一种示例,知识图谱包括实体节点“人物A”和“职业B”,以及连接两个实体节点的边,表示实体之间具有关系“担任职位”。
步骤102,获取知识图谱对应的语境类型和语境数据。
本实施例中,可以获取知识图谱对应的语境类型,进而根据语境类型确定知识图谱的语境数据。其中,语境类型包括序列结构语境类型、子图语境类型。
下面对获取知识图谱对应的语境类型进行说明。
作为一种示例,获取知识图谱之中多个实体节点的数量;如果知识图谱之中包括两个实体节点,则判断知识图谱对应的语境类型为序列结构语境类型;如果知识图谱之中包括两个以上实体节点,则判断知识图谱对应的语境类型为子图语境类型。
本实施例中,在确定知识图谱对应的语境类型后,根据不同的语境类型选择对应的方式确定知识图谱的语境数据。
作为一种示例,对于序列结构语境类型的知识图谱,可以将知识图谱中的实体节点以及实体节点之间的边加入语境数据。
作为另一种示例,对于子图语境类型的知识图谱,可以确定知识图谱中的目标实体节点,并将知识图谱中以目标实体节点为中心的预设范围内的实体节点和边加入语境数据。
步骤103,根据语境数据和语境类型通过语境模型生成多个实体节点对应的向量表示。
本实施例中,可以预先训练与语境类型对应的语境模型,其中,语境 模型输入为语境数据,输出为向量表示。进而,通过将语境数据输入到语境模型中,生成知识图谱中多个实体节点对应的向量表示。
作为一种示例,如果语境类型为序列结构语境类型,则调用序列结构语境模型根据语境数据生成多个实体节点对应的向量表示;如果语境类型为子图语境类型,则调用子图结构语境模型根据语境数据生成多个实体节点对应的向量表示。
可以理解的是,相关技术中对图谱元素(包括实体节点和边)学习到静态的、固定的向量表示,例如对于同一实体,其对应的向量表示相同,而忽略了图谱元素的语境。其中,图谱元素的语境,是指该图谱元素与其他图谱元素组成的一个联通的结构。本实施例中,通过获取知识图谱对应的语境类型和语境数据,根据语境数据和语境类型通过语境模型生成多个实体节点对应的向量表示。由此,对于同一实体,实体所处的语境不同,获得的表示向量不同。例如,对于知识图谱中的实体人物A,其在不同语境中生成的向量表示不同。由此,在生成知识图谱中多个实体节点的向量表示时,考虑到了实体所处的语境,提高了向量表示对复杂关系(例如一对多、多对多)的建模能力,表示能力更充分。
本申请实施例的知识图谱的向量表示生成方法,通过获取知识图谱,进而获取知识图谱对应的语境类型和语境数据。进一步根据语境数据和语境类型通过语境模型生成多个实体节点对应的向量表示。由此,在生成实体的向量表示时考虑了实体所处的语境,实体所处的语境不同,则其获得的向量表示不同,提高了向量表示对复杂关系的建模能力,表示能力更充分,实现了实体在语境中的更精细化的语义表示,从而进一步提高了知识图谱表示学习的准确性。
基于上述实施例,下面以序列结构语境类型为例进行说明。
图2为本申请实施例所提供的另一种知识图谱的向量表示生成方法的流程示意图,如图2所示,该方法包括:
步骤201,获取知识图谱,其中,知识图谱包括多个实体节点。
步骤202,获取知识图谱之中多个实体节点的数量,如果知识图谱之中包括两个实体节点,则判断知识图谱对应的语境类型为序列结构语境类型。
本实施例中,知识图谱包括两个实体节点,即确定语境类型为序列结构语境类型后,还可以进一步确定两个实体节点之间边的数量。可选地,获取两个实体节点之间边的数量,如果两个实体节点之间边的数量等于1,则判断知识图谱对应的语境类型为边结构语境类型;如果两个实体节点之间边的数量大于1,则判断知识图谱对应的语境类型为路径结构语境类型。
作为一种示例,参照图3,知识图谱包括实体节点“人物A”和“职业B”,以及连接两个实体节点的边“担任职位”,则确定语境类型为边结构语境类型。
作为另一种示例,参照图4,知识图谱包括实体节点“人物A”和“英语”,以及依次连接两个实体节点的边“女儿”“生活国家”“官方语言”,则确定语境类型为路径结构语境类型。
步骤203,获取知识图谱对应的语境数据。
本实施例中,知识图谱的语境类型包括边结构语境类型和路径结构语境类型,根据知识图谱的语境类型获取知识图谱对应的语境数据。
作为一种示例,语境类型为边结构语境类型,则将知识图谱对应的三元组均加入语境数据。例如图3所示的知识图谱,将对应的三元组(人物A,担任职位,职业B)加入语境数据。
作为另一种示例,语境类型为路径结构语境类型,则获取知识图谱对应的路径,采用路径采样的方式获取路径的路径数据,并将路径数据和知识图谱之中的实体节点加入语境数据。例如图4所示的知识图谱,将路径数据“女儿”“生活国家”“官方语言”和实体节点“人物A”“英语”加入语境数据。可选地,可以基于知识图谱中的边,通过随机游走采样获得相应数量的路径数据。
步骤204,根据语境数据通过序列结构语境模型生成多个实体节点对应的向量表示。
本实施例中,知识图谱对应的语境类型为序列结构语境类型,则在获取知识图谱的语境数据后,将语境数据输入预先训练的序列结构语境模型进行处理,生成多个实体节点对应的向量表示。
本申请实施例的知识图谱的向量表示生成方法,能够对于序列结构语境类型的知识图谱获取对应的语境数据,进而根据语境数据生成知识图谱中多个实体节点的向量表示,在生成知识图谱中多个实体节点的向量表示时,考虑到了实体所处的语境,表示能力更充分。
基于上述实施例,下面以子图语境类型为例进行说明。
图5为本申请实施例所提供的另一种知识图谱的向量表示生成方法的流程示意图,如图5所示,该方法包括:
步骤501,获取知识图谱,其中,知识图谱包括多个实体节点。
步骤502,获取知识图谱之中多个实体节点的数量,如果知识图谱之中包括两个以上实体节点,则判断知识图谱对应的语境类型为子图语境类型。
作为一种示例,参照图6,知识图谱包括实体节点“人物A”“人物B”“人物C”“人物D”,以及边“女儿”“妻子”,则确定语境类型为子图语境类型。
步骤503,获取知识图谱对应的语境数据。
本实施例中,通过如下方式获取语境数据。
S1、生成知识图谱对应的实体节点集合;S2、从实体节点集合之中提取第一初始实体节点,并生成游走半径d;S3、以第一初始实体节点为中心,以游走半径d在知识图谱之上进行游走,以确定以第一初始实体节点为中心的d阶子图,并将以第一初始实体节点为中心的d阶子图添加至语境数据;S4、重复执行步骤S2和S3直至实体节点集合之中的实体节点完成提取。
可选地,可以通过从预设范围(例如1-Dmax)内随机采样的方式生成游走半径d。在确定以第一初始实体节点为中心的d阶子图后,还可以补全该子图中的边。
步骤504,根据语境数据通过子图语境类型生成多个实体节点对应的向量表示。
本实施例中,知识图谱对应的语境类型为子图语境类型,则在获取知识图谱的语境数据后,将语境数据输入预先训练的子图语境模型进行处理,生成多个实体节点对应的向量表示。
本申请实施例的知识图谱的向量表示生成方法,能够对于子图语境类型的知识图谱获取对应的语境数据,进而根据语境数据生成知识图谱中多个实体节点的向量表示,在生成知识图谱中多个实体节点的向量表示时,考虑到了实体所处的语境,表示能力更充分。
基于上述实施例,下面对训练序列结构语境模型进行说明。
图7为本申请实施例所提供的一种训练序列结构语境模型的流程示意图,如图7所示,包括:
步骤701,获取样本知识图谱,样本知识图谱包括实体节点和边。
本实施例中,在训练序列结构语境模型时,可以获取样本知识图谱,其 中,样本知识图谱包括实体节点和边。例如,可以获取语境类型为序列结构语境类型的知识图谱作为样本知识图谱。
步骤702,通过查表操作获取样本知识图谱中实体节点和边的第一向量表示,以及样本知识图谱中实体节点和边的位置信息的第二向量表示。
本实施例中,通过查表操作获取实体节点的向量表示,以及边的向量表示,作为第一向量表示。以及,通过查表操作获取实体节点在序列中的位置信息对应的向量表示,以及边在序列中的位置信息对应的向量表示,作为第二向量表示。
步骤703,将第一向量表示和第二向量表示输入预设模型进行处理,获取样本知识图谱中每个实体节点对应的第三向量表示。
本实施例中,将实体节点和边均作为预设模型的输入,例如将实体节点/边对应的第一向量表示和第二向量表示相加,作为预设模型的输入。
Figure PCTCN2020083547-appb-000001
其中,
Figure PCTCN2020083547-appb-000002
是通过查表操作获得的实体/边的向量表示(该表的值可在模型训练中不断优化更新),
Figure PCTCN2020083547-appb-000003
是通过查表操作获得的实体/边在序列中的位置信息得到的向量表示,
Figure PCTCN2020083547-appb-000004
为第i个输入。
在本申请的一个实施例中,预设模型为自注意力模型(Transformer),将
Figure PCTCN2020083547-appb-000005
均输入预设模型,经过L层自注意力模型处理,根据第L层输出的向量表示确定第三向量表示,即该语境中每个实体节点的第三向量表示
Figure PCTCN2020083547-appb-000006
Figure PCTCN2020083547-appb-000007
需要说明的是,根据Transformer模型进行计算获取向量表示的具体实现方式可以根据相关技术实现,此处不再赘述。
步骤704,根据第三向量表示进行实体分类预测,根据预测结果调整预设模型的处理参数,训练序列结构语境模型。
本实施例中,在获取实体节点的第三向量表示后,根据前向神经网络(FFNN)和softmax函数对第三向量表示进行处理,获得各预测结果的概率分布
Figure PCTCN2020083547-appb-000008
进而,通过最大化实体节点对应的实际结果的概率值,进行模型的参数优化。
作为一种示例,实体节点为“英语”,获得的各预测结果包括英语、法语、日语等,通过调整模型参数,使得预测结果中英语的概率最大,从而训练序列结构语境模型。
作为一种示例,参照图8,以图4所示的知识图谱为例,将实体节点“人物A”“英语”、以及边“女儿”“生活国家”“官方语言”作为预设模型的输入,并确定遮挡位置为实体节点“英语”所在位置,经过L层自注意力模型处理,获取遮挡位置输出的第三向量表示,根据第三向量表示获得各预测结果的概率分布,通过最大化实体节点对应的实际结果的概率值,进行模型的参数优化。进一步将遮挡位置设置为实体节点“人物A”所在位置进行训练。
由此,通过遮挡语境中的一个实体节点,通过预设模型预测遮挡的实体节点,并将预测结果与实际结果进行比较,根据比较结果调整预设模型的参数,直至预测结果与实际结果一致,从而实现训练序列结构语境模型。
本申请实施例中,能够训练序列结构语境模型,使序列结构语境模型输入为语境数据,输出为实体节点对应的向量表示。
基于上述实施例,下面对训练子图语境模型进行说明。
图9为本申请实施例所提供的一种训练子图语境模型的流程示意图,如图9所示,包括:
步骤901,获取样本知识图谱,样本知识图谱包括实体节点和边。
本实施例中,在训练序列结构语境模型时,可以获取样本知识图谱,其 中,样本知识图谱包括实体节点和边。例如,可以获取语境类型为子图语境类型的知识图谱作为样本知识图谱。
步骤902,通过查表操作获取样本知识图谱中实体节点的节点向量,将节点向量输入预设模型进行处理,获取样本知识图谱中每个实体节点对应的第四向量表示。
本实施例中,将实体节点作为预设模型的输入,即通过查表操作获取样本知识图谱中实体节点的节点向量,将节点向量输入预设模型进行处理,获取样本知识图谱中每个实体节点对应的第四向量表示。
即,
Figure PCTCN2020083547-appb-000009
Figure PCTCN2020083547-appb-000010
为节点向量,
Figure PCTCN2020083547-appb-000011
为第i个输入。需要说明的是,前述实施例中对获取第一向量表示的解释说明,同样适用于本实施例中获取节点向量,此处不再赘述。
在本申请的一个实施例中,预设模型为自注意力模型(Transformer),将节点向量均输入预设模型,经过L层自注意力模型(Transformer)处理,根据第L层输出的向量表示确定第四向量表示,即该语境中每个实体节点的第四向量表示
Figure PCTCN2020083547-appb-000012
Figure PCTCN2020083547-appb-000013
其中,获取实体间的关联矩阵,根据关联矩阵控制每个实体节点到其他实体节点的注意力计算的可达性。由此,能够支持子图结构的数据。
作为一种示例,步骤1:将模型head个数设置为知识图谱中关系类别的个数R,获得每个边关系下的Query(Q)/Kery(K)/Value(V)向量表示:
Figure PCTCN2020083547-appb-000014
其中,l为当前的层数,r表示第r个head,H为该层的输入节点向量,
Figure PCTCN2020083547-appb-000015
Figure PCTCN2020083547-appb-000016
是相应的权重矩阵在第l层第r个head下的权重参数,上述权重参数在模型中学习得到。
步骤2:计算每个节点对其他节点的注意力值(attention),在计算attention时,使用特定关系r下实体节点之间的关联矩阵A r,来控制每个节点到其他实体节点的注意力计算的可达性,即:
Figure PCTCN2020083547-appb-000017
其中D a是注意力向量的维度参数(例如常见值为64)。A r是关系r下子图中各实体节点之间的关联矩阵,其每个元素取值为0或1,
Figure PCTCN2020083547-appb-000018
表示在子图中第i个实体节点可以通过关系r与第j个实体节点联通,即(节点i,r,节点j)三元组成立;否则
Figure PCTCN2020083547-appb-000019
步骤903,根据第四向量表示进行实体分类预测,根据预测结果调整预设模型的处理参数,训练子图结构语境模型。
本实施例中,在获取实体节点的第四向量表示后,根据前向神经网络(FFNN)和softmax函数对第四向量表示进行处理,获得各预测结果的概率分布
Figure PCTCN2020083547-appb-000020
进而,通过最大化实体节点对应的实际结果的概率值,进行模型的参数优化。
作为一种示例,实体节点为“英语”,获得的各预测结果包括英语、法语、日语等,通过调整模型参数,使得预测结果中英语的概率最大,从而训练子图语境模型。
作为一种示例,参照图10,以图6所示的知识图谱为例,将实体节点“人 物A”“人物B”“人物C”“人物D”作为预设模型的输入,并确定遮挡位置为实体节点“人物A”所在位置,经过L层自注意力模型处理,获取遮挡位置输出的第四向量表示,根据第四向量表示获得各预测结果的概率分布,通过最大化实体节点对应的实际结果的概率值,进行模型的参数优化。进一步将遮挡位置设置为实体节点“人物B”所在位置进行训练。
本申请实施例中,能够训练子图语境模型,使子图语境模型输入为语境数据,输出为实体节点对应的向量表示,能够支持子图结构的数据。
需要说明的是,上述序列结构语境模型和子图语境模型,可以共享查表操作对应的表,因而不同语境数据对实体表示学习会共同影响,从而实体能够充分学习各种语境数据。
为了实现上述实施例,本申请还提出一种知识图谱的向量表示生成装置。
图11为本申请实施例所提供的一种知识图谱的向量表示生成装置的结构示意图,如图11所示,该装置包括:获取模块10,处理模块20,生成模块30。
其中,获取模块10,用于获取知识图谱,其中,知识图谱包括多个实体节点。
处理模块20,用于获取知识图谱对应的语境类型和语境数据。
生成模块30,用于根据语境数据和语境类型通过语境模型生成多个实体节点对应的向量表示。
可选地,处理模块20具体用于:获取知识图谱之中所述多个实体节点的数量;如果知识图谱之中包括两个实体节点,则判断所述知识图谱对应的语境类型为序列结构语境类型;如果知识图谱之中包括两个以上实体节 点,则判断所述知识图谱对应的语境类型为子图语境类型。
可选地,知识图谱对应的语境类型为子图语境类型,处理模块20具体用于:S1、生成所述知识图谱对应的实体节点集合;S2、从所述实体节点集合之中提取第一初始实体节点,并生成游走半径d;S3、以所述第一初始实体节点为中心,以所述游走半径d在所述知识图谱之上进行游走以确定以所述第一初始实体节点为中心的d阶子图,并将所述以所述第一初始实体节点为中心的d阶子图添加至所述语境数据;S4、重复执行所述步骤S2和S3直至所述实体节点集合之中的实体节点完成提取。
可选地,知识图谱对应的语境类型为边结构语境类型,处理模块20具体用于:将知识图谱对应的三元组均加入所述语境数据。
可选地,知识图谱对应的语境类型为路径结构语境类型,处理模块20具体用于:获取知识图谱对应的路径;采用路径采样的方式获取路径的路径数据,并将路径数据和知识图谱之中的实体节点接入语境数据。
可选地,语境模型包括序列结构语境模型和子图结构语境模型,生成模块30具体用于:如果所述语境类型为序列结构语境类型,则调用所述序列结构语境模型根据所述语境数据生成所述多个实体节点对应的向量表示;如果所述语境类型为子图语境类型,则调用所述子图结构语境模型根据所述语境数据生成所述多个实体节点对应的向量表示。
在图11的基础上,图12所示的装置还包括:判断模块40,第一训练模块50,第二训练模块60。
其中,判断模块40,用于如果判断知识图谱对应的语境类型为序列结构语境类型,获取两个实体节点之间边的数量;如果两个实体节点之间边的数量等于1,则判断知识图谱对应的语境类型为边结构语境类型;如果 两个实体节点之间边的数量大于1,则判断知识图谱对应的语境类型为路径结构语境类型。
第一训练模块50,用于获取样本知识图谱,所述样本知识图谱包括实体节点和边;通过查表操作获取所述样本知识图谱中实体节点和边的第一向量表示,以及所述样本知识图谱中实体节点和边的位置信息的第二向量表示;将所述第一向量表示和所述第二向量表示输入预设模型进行处理,获取所述样本知识图谱中每个实体节点对应的第三向量表示;根据所述第三向量表示进行实体分类预测,根据预测结果调整所述预设模型的处理参数,训练所述序列结构语境模型。
第二训练模块60,用于获取样本知识图谱,所述样本知识图谱包括实体节点和边;通过查表操作获取所述样本知识图谱中实体节点的节点向量,将所述节点向量输入预设模型进行处理,获取所述样本知识图谱中每个实体节点对应的第四向量表示,其中,获取关联矩阵,根据所述关联矩阵控制每个实体节点到其他实体节点的注意力计算的可达性;根据所述第四向量表示进行实体分类预测,根据预测结果调整所述预设模型的处理参数,训练所述子图结构语境模型。
需要说明的是,前述实施例对知识图谱的向量表示生成方法的解释说明同样适用于本实施例的知识图谱的向量表示生成装置,此处不再赘述。
本申请实施例的知识图谱的向量表示生成装置,通过获取知识图谱,进而获取知识图谱对应的语境类型和语境数据。进一步根据语境数据和语境类型通过语境模型生成多个实体节点对应的向量表示。由此,在生成实体的向量表示时考虑了实体所处的语境,实体所处的语境不同,则其获得的向量表示不同,提高了向量表示对复杂关系的建模能力,表示能力更充 分,实现了实体在语境中的更精细化的语义表示,从而进一步提高了知识图谱表示学习的准确性。
为了实现上述实施例,本申请还提出一种计算机程序产品,当计算机程序产品中的指令被处理器执行时实现如前述任一实施例所述的知识图谱的向量表示生成方法。
根据本申请的实施例,本申请还提供了一种电子设备和一种可读存储介质。
如图13所示,是根据本申请实施例的知识图谱的向量表示生成方法的电子设备的框图。电子设备旨在表示各种形式的数字计算机,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、和其它适合的计算机。电子设备还可以表示各种形式的移动装置,诸如,个人数字处理、蜂窝电话、智能电话、可穿戴设备和其它类似的计算装置。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本申请的实现。
如图13所示,该电子设备包括:一个或多个处理器1301、存储器1302,以及用于连接各部件的接口,包括高速接口和低速接口。各个部件利用不同的总线互相连接,并且可以被安装在公共主板上或者根据需要以其它方式安装。处理器可以对在电子设备内执行的指令进行处理,包括存储在存储器中或者存储器上以在外部输入/输出装置(诸如,耦合至接口的显示设备)上显示GUI的图形信息的指令。在其它实施方式中,若需要,可以将多个处理器和/或多条总线与多个存储器和多个存储器一起使用。同样,可以连接多个电子设备,各个设备提供部分必要的操作(例如,作为服务器阵列、一组刀片式服务器、或者多处理器系统)。图13中以一个处理器 1301为例。
存储器1302即为本申请所提供的非瞬时计算机可读存储介质。其中,所述存储器存储有可由至少一个处理器执行的指令,以使所述至少一个处理器执行本申请所提供的知识图谱的向量表示生成方法。本申请的非瞬时计算机可读存储介质存储计算机指令,该计算机指令用于使计算机执行本申请所提供的知识图谱的向量表示生成方法。
存储器1302作为一种非瞬时计算机可读存储介质,可用于存储非瞬时软件程序、非瞬时计算机可执行程序以及模块,如本申请实施例中的知识图谱的向量表示生成方法对应的程序指令/模块(例如,附图11所示的获取模块10,处理模块20,生成模块30)。处理器1301通过运行存储在存储器1302中的非瞬时软件程序、指令以及模块,从而执行服务器的各种功能应用以及数据处理,即实现上述方法实施例中的知识图谱的向量表示生成方法。
存储器1302可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储根据电子设备的使用所创建的数据等。此外,存储器1302可以包括高速随机存取存储器,还可以包括非瞬时存储器,例如至少一个磁盘存储器件、闪存器件、或其他非瞬时固态存储器件。在一些实施例中,存储器1302可选包括相对于处理器1301远程设置的存储器,这些远程存储器可以通过网络连接至电子设备。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
知识图谱的向量表示生成方法的电子设备还可以包括:输入装置1303和输出装置1304。处理器1301、存储器1302、输入装置1303和输出装置 1304可以通过总线或者其他方式连接,图13中以通过总线连接为例。
输入装置1303可接收输入的数字或字符信息,以及产生与电子设备的用户设置以及功能控制有关的键信号输入,例如触摸屏、小键盘、鼠标、轨迹板、触摸板、指示杆、一个或者多个鼠标按钮、轨迹球、操纵杆等输入装置。输出装置1304可以包括显示设备、辅助照明装置(例如,LED)和触觉反馈装置(例如,振动电机)等。该显示设备可以包括但不限于,液晶显示器(LCD)、发光二极管(LED)显示器和等离子体显示器。在一些实施方式中,显示设备可以是触摸屏。
此处描述的系统和技术的各种实施方式可以在数字电子电路系统、集成电路系统、专用ASIC(专用集成电路)、计算机硬件、固件、软件、和/或它们的组合中实现。这些各种实施方式可以包括:实施在一个或者多个计算机程序中,该一个或者多个计算机程序可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、和至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、和该至少一个输出装置。
这些计算程序(也称作程序、软件、软件应用、或者代码)包括可编程处理器的机器指令,并且可以利用高级过程和/或面向对象的编程语言、和/或汇编/机器语言来实施这些计算程序。如本文使用的,术语“机器可读介质”和“计算机可读介质”指的是用于将机器指令和/或数据提供给可编程处理器的任何计算机程序产品、设备、和/或装置(例如,磁盘、光盘、存储器、可编程逻辑装置(PLD)),包括,接收作为机器可读信号的机器指令的机器可读介质。术语“机器可读信号”指的是用于将机器指令和/ 或数据提供给可编程处理器的任何信号。
为了提供与用户的交互,可以在计算机上实施此处描述的系统和技术,该计算机具有:用于向用户显示信息的显示装置(例如,CRT(阴极射线管)或者LCD(液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给计算机。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。
可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(LAN)、广域网(WAN)和互联网。
计算机系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。
根据本申请实施例的技术方案,获取的候选框位置更加准确,解决了密集场景知识图谱的向量表示生成获取候选框的准确度有待提高的问题,从而提高了知识图谱的向量表示生成的准确度。
应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本发申请中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本申请公开的技术方案所期望的结果,本文在此不进行限制。
上述具体实施方式,并不构成对本申请保护范围的限制。本领域技术人员应该明白的是,根据设计要求和其他因素,可以进行各种修改、组合、子组合和替代。任何在本申请的精神和原则之内所作的修改、等同替换和改进等,均应包含在本申请保护范围之内。

Claims (20)

  1. 一种知识图谱的向量表示生成方法,其特征在于,包括:
    获取知识图谱,其中,所述知识图谱包括多个实体节点;
    获取所述知识图谱对应的语境类型和语境数据;以及
    根据所述语境数据和所述语境类型通过语境模型生成所述多个实体节点对应的向量表示。
  2. 如权利要求1所述的知识图谱的向量表示生成方法,其特征在于,所述获取所述知识图谱对应的语境类型,包括:
    获取所述知识图谱之中所述多个实体节点的数量;
    如果所述知识图谱之中包括两个实体节点,则判断所述知识图谱对应的语境类型为序列结构语境类型;
    如果所述知识图谱之中包括两个以上实体节点,则判断所述知识图谱对应的语境类型为子图语境类型。
  3. 如权利要求2所述的知识图谱的向量表示生成方法,其特征在于,如果判断所述知识图谱对应的语境类型为序列结构语境类型,则还包括:
    获取所述两个实体节点之间边的数量;
    如果所述两个实体节点之间边的数量等于1,则判断所述知识图谱对应的语境类型为边结构语境类型;
    如果所述两个实体节点之间边的数量大于1,则判断所述知识图谱对应的语境类型为路径结构语境类型。
  4. 如权利要求2所述的知识图谱的向量表示生成方法,其特征在于,所述知识图谱对应的语境类型为子图语境类型,则所述获取所述知识图谱 对应的语境数据,包括:
    S1、生成所述知识图谱对应的实体节点集合;
    S2、从所述实体节点集合之中提取第一初始实体节点,并生成游走半径d;
    S3、以所述第一初始实体节点为中心,以所述游走半径d在所述知识图谱之上进行游走以确定以所述第一初始实体节点为中心的d阶子图,并将所述以所述第一初始实体节点为中心的d阶子图添加至所述语境数据;
    S4、重复执行所述步骤S2和S3直至所述实体节点集合之中的实体节点完成提取。
  5. 如权利要求3所述的知识图谱的向量表示生成方法,其特征在于,所述知识图谱对应的语境类型为边结构语境类型,则所述获取所述知识图谱对应的语境数据,包括:
    将所述知识图谱对应的三元组均加入所述语境数据。
  6. 如权利要求3所述的知识图谱的向量表示生成方法,其特征在于,所述知识图谱对应的语境类型为路径结构语境类型,则所述获取所述知识图谱对应的语境数据,包括:
    获取所述知识图谱对应的路径;
    采用路径采样的方式获取所述路径的路径数据,并将所述路径数据和所述知识图谱之中的实体节点接入所述语境数据。
  7. 如权利要求2所述的知识图谱的向量表示生成方法,其特征在于,所述语境模型包括序列结构语境模型和子图结构语境模型,所述根据所述语境数据和所述语境类型通过语境模型生成所述多个实体节点对应的向量表示,包括:
    如果所述语境类型为序列结构语境类型,则调用所述序列结构语境模型根据所述语境数据生成所述多个实体节点对应的向量表示;
    如果所述语境类型为子图语境类型,则调用所述子图结构语境模型根据所述语境数据生成所述多个实体节点对应的向量表示。
  8. 如权利要求7所述的知识图谱的向量表示生成方法,其特征在于,所述序列结构语境模型通过以下步骤训练得到:
    获取样本知识图谱,所述样本知识图谱包括实体节点和边;
    通过查表操作获取所述样本知识图谱中实体节点和边的第一向量表示,以及所述样本知识图谱中实体节点和边的位置信息的第二向量表示;
    将所述第一向量表示和所述第二向量表示输入预设模型进行处理,获取所述样本知识图谱中每个实体节点对应的第三向量表示;
    根据所述第三向量表示进行实体分类预测,根据预测结果调整所述预设模型的处理参数,训练所述序列结构语境模型。
  9. 如权利要求7所述的知识图谱的向量表示生成方法,其特征在于,所述子图结构语境模型通过以下步骤训练得到:
    获取样本知识图谱,所述样本知识图谱包括实体节点和边;
    通过查表操作获取所述样本知识图谱中实体节点的节点向量,将所述节点向量输入预设模型进行处理,获取所述样本知识图谱中每个实体节点对应的第四向量表示,
    其中,获取关联矩阵,根据所述关联矩阵控制每个实体节点到其他实体节点的注意力计算的可达性;
    根据所述第四向量表示进行实体分类预测,根据预测结果调整所述预设模型的处理参数,训练所述子图结构语境模型。
  10. 一种知识图谱的向量表示生成装置,其特征在于,包括:
    获取模块,用于获取知识图谱,其中,所述知识图谱包括多个实体节点;
    处理模块,用于获取所述知识图谱对应的语境类型和语境数据;以及
    生成模块,用于根据所述语境数据和所述语境类型通过语境模型生成所述多个实体节点对应的向量表示。
  11. 如权利要求10所述的知识图谱的向量表示生成装置,其特征在于,所述处理模块具体用于:
    获取所述知识图谱之中所述多个实体节点的数量;
    如果所述知识图谱之中包括两个实体节点,则判断所述知识图谱对应的语境类型为序列结构语境类型;
    如果所述知识图谱之中包括两个以上实体节点,则判断所述知识图谱对应的语境类型为子图语境类型。
  12. 如权利要求11所述的知识图谱的向量表示生成装置,其特征在于,还包括:
    判断模块,用于如果判断所述知识图谱对应的语境类型为序列结构语境类型,获取所述两个实体节点之间边的数量;
    如果所述两个实体节点之间边的数量等于1,则判断所述知识图谱对应的语境类型为边结构语境类型;
    如果所述两个实体节点之间边的数量大于1,则判断所述知识图谱对应的语境类型为路径结构语境类型。
  13. 如权利要求11所述的知识图谱的向量表示生成装置,其特征在于,所述知识图谱对应的语境类型为子图语境类型,所述处理模块具体用于:
    S1、生成所述知识图谱对应的实体节点集合;
    S2、从所述实体节点集合之中提取第一初始实体节点,并生成游走半径d;
    S3、以所述第一初始实体节点为中心,以所述游走半径d在所述知识图谱之上进行游走以确定以所述第一初始实体节点为中心的d阶子图,并将所述以所述第一初始实体节点为中心的d阶子图添加至所述语境数据;
    S4、重复执行所述步骤S2和S3直至所述实体节点集合之中的实体节点完成提取。
  14. 如权利要求12所述的知识图谱的向量表示生成装置,其特征在于,所述知识图谱对应的语境类型为边结构语境类型,所述处理模块具体用于:
    将所述知识图谱对应的三元组均加入所述语境数据。
  15. 如权利要求12所述的知识图谱的向量表示生成装置,其特征在于,所述知识图谱对应的语境类型为路径结构语境类型,所述处理模块具体用于:
    获取所述知识图谱对应的路径;
    采用路径采样的方式获取所述路径的路径数据,并将所述路径数据和所述知识图谱之中的实体节点接入所述语境数据。
  16. 如权利要求11所述的知识图谱的向量表示生成装置,其特征在于,所述语境模型包括序列结构语境模型和子图结构语境模型,所述生成模块具体用于:
    如果所述语境类型为序列结构语境类型,则调用所述序列结构语境模型根据所述语境数据生成所述多个实体节点对应的向量表示;
    如果所述语境类型为子图语境类型,则调用所述子图结构语境模型根 据所述语境数据生成所述多个实体节点对应的向量表示。
  17. 如权利要求16所述的知识图谱的向量表示生成装置,其特征在于,还包括:
    第一训练模块,用于获取样本知识图谱,所述样本知识图谱包括实体节点和边;
    通过查表操作获取所述样本知识图谱中实体节点和边的第一向量表示,以及所述样本知识图谱中实体节点和边的位置信息的第二向量表示;
    将所述第一向量表示和所述第二向量表示输入预设模型进行处理,获取所述样本知识图谱中每个实体节点对应的第三向量表示;
    根据所述第三向量表示进行实体分类预测,根据预测结果调整所述预设模型的处理参数,训练所述序列结构语境模型。
  18. 如权利要求16所述的知识图谱的向量表示生成装置,其特征在于,还包括:
    第二训练模块,用于获取样本知识图谱,所述样本知识图谱包括实体节点和边;
    通过查表操作获取所述样本知识图谱中实体节点的节点向量,将所述节点向量输入预设模型进行处理,获取所述样本知识图谱中每个实体节点对应的第四向量表示,
    其中,获取关联矩阵,根据所述关联矩阵控制每个实体节点到其他实体节点的注意力计算的可达性;
    根据所述第四向量表示进行实体分类预测,根据预测结果调整所述预设模型的处理参数,训练所述子图结构语境模型。
  19. 一种电子设备,其特征在于,包括:
    至少一个处理器;以及
    与所述至少一个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行权利要求1-9中任一项所述的知识图谱的向量表示生成方法。
  20. 一种存储有计算机指令的非瞬时计算机可读存储介质,其特征在于,所述计算机指令用于使所述计算机执行权利要求1-9中任一项所述的知识图谱的向量表示生成方法。
PCT/CN2020/083547 2019-10-08 2020-04-07 知识图谱的向量表示生成方法、装置及设备 WO2021068468A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
US17/043,227 US11995560B2 (en) 2019-10-08 2020-04-07 Method and apparatus for generating vector representation of knowledge graph
JP2021515601A JP7262571B2 (ja) 2019-10-08 2020-04-07 知識グラフのベクトル表現生成方法、装置及び電子機器
EP20767703.0A EP4044045A4 (en) 2019-10-08 2020-04-07 METHOD, DEVICE AND DEVICE FOR VECTOR REPRESENTATION GENERATION FOR A KNOWLEDGE GRAPH
KR1020207036656A KR102604959B1 (ko) 2019-10-08 2020-04-07 지식 그래프의 벡터 표시 생성 방법, 장치 및 기기

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910950874.6A CN110795569B (zh) 2019-10-08 2019-10-08 知识图谱的向量表示生成方法、装置及设备
CN201910950874.6 2019-10-08

Publications (1)

Publication Number Publication Date
WO2021068468A1 true WO2021068468A1 (zh) 2021-04-15

Family

ID=69440099

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/083547 WO2021068468A1 (zh) 2019-10-08 2020-04-07 知识图谱的向量表示生成方法、装置及设备

Country Status (6)

Country Link
US (1) US11995560B2 (zh)
EP (1) EP4044045A4 (zh)
JP (1) JP7262571B2 (zh)
KR (1) KR102604959B1 (zh)
CN (1) CN110795569B (zh)
WO (1) WO2021068468A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113569773A (zh) * 2021-08-02 2021-10-29 南京信息工程大学 基于知识图谱和Softmax回归的干扰信号识别方法
CN113590777A (zh) * 2021-06-30 2021-11-02 北京百度网讯科技有限公司 文本信息处理方法、装置、电子设备和存储介质
CN113673249A (zh) * 2021-08-25 2021-11-19 北京三快在线科技有限公司 实体识别方法、装置、设备及存储介质

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110795569B (zh) 2019-10-08 2021-06-15 北京百度网讯科技有限公司 知识图谱的向量表示生成方法、装置及设备
CN111626044B (zh) * 2020-05-14 2023-06-30 北京字节跳动网络技术有限公司 文本生成方法、装置、电子设备及计算机可读存储介质
CN111737484A (zh) * 2020-05-15 2020-10-02 浙江工业大学 一种基于联合学习的警情知识图谱构建方法
CN112052680B (zh) * 2020-10-14 2023-01-10 腾讯科技(深圳)有限公司 问题生成方法、装置、设备及存储介质
CN112580716B (zh) * 2020-12-16 2023-07-11 北京百度网讯科技有限公司 图谱中边类型的识别方法、装置、设备及存储介质
CN112948592A (zh) * 2021-02-26 2021-06-11 平安科技(深圳)有限公司 基于人工智能的订单分级方法、装置、设备及存储介质
CN114817424A (zh) * 2022-05-27 2022-07-29 中译语通信息科技(上海)有限公司 一种基于语境信息的图表征方法和系统
CN118132681B (zh) * 2024-04-30 2024-09-13 支付宝(杭州)信息技术有限公司 医疗知识图谱查询中对多个查询结果的排序方法和装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108959328A (zh) * 2017-05-27 2018-12-07 株式会社理光 知识图谱的处理方法、装置及电子设备
CN109739995A (zh) * 2018-12-21 2019-05-10 中国银联股份有限公司 一种信息处理方法及装置
CN110147414A (zh) * 2019-05-23 2019-08-20 北京金山数字娱乐科技有限公司 一种知识图谱的实体表征方法及装置
CN110795569A (zh) * 2019-10-08 2020-02-14 北京百度网讯科技有限公司 知识图谱的向量表示生成方法、装置及设备

Family Cites Families (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5830784B2 (ja) * 2011-06-23 2015-12-09 サイバーアイ・エンタテインメント株式会社 画像認識システムを組込んだ関連性検索によるインタレスト・グラフ収集システム
CN106339401A (zh) * 2015-07-16 2017-01-18 富士通株式会社 确定实体之间的关系的方法和设备
CN106227794B (zh) * 2016-07-20 2019-09-17 北京航空航天大学 时态图数据中动态属性数据的存储方法和装置
US10515400B2 (en) * 2016-09-08 2019-12-24 Adobe Inc. Learning vector-space representations of items for recommendations using word embedding models
US10482336B2 (en) * 2016-10-07 2019-11-19 Noblis, Inc. Face recognition and image search system using sparse feature vectors, compact binary vectors, and sub-linear search
US11176188B2 (en) * 2017-01-11 2021-11-16 Siemens Healthcare Gmbh Visualization framework based on document representation learning
KR101914853B1 (ko) * 2017-02-08 2018-11-02 경북대학교 산학협력단 논리적 속성이 반영된 지식 그래프 임베딩 방법 및 시스템, 이를 수행하기 위한 기록매체
US20180232443A1 (en) * 2017-02-16 2018-08-16 Globality, Inc. Intelligent matching system with ontology-aided relation extraction
US11481603B1 (en) * 2017-05-19 2022-10-25 Wells Fargo Bank, N.A. System for deep learning using knowledge graphs
US11176325B2 (en) 2017-06-26 2021-11-16 International Business Machines Corporation Adaptive evaluation of meta-relationships in semantic graphs
CN108052625B (zh) * 2017-12-18 2020-05-19 清华大学 一种实体精细分类方法
US11042922B2 (en) * 2018-01-03 2021-06-22 Nec Corporation Method and system for multimodal recommendations
CN108153901B (zh) * 2018-01-16 2022-04-19 北京百度网讯科技有限公司 基于知识图谱的信息推送方法和装置
US11797838B2 (en) 2018-03-13 2023-10-24 Pinterest, Inc. Efficient convolutional network for recommender systems
CN108920527A (zh) * 2018-06-07 2018-11-30 桂林电子科技大学 一种基于知识图谱的个性化推荐方法
CN109189882A (zh) * 2018-08-08 2019-01-11 北京百度网讯科技有限公司 序列内容的回答类型识别方法、装置、服务器和存储介质
CN109165278B (zh) * 2018-09-07 2021-11-09 桂林电子科技大学 一种基于实体和关系结构信息的知识图谱表示学习方法
CN109271516B (zh) * 2018-09-26 2020-09-15 清华大学 一种知识图谱中实体类型分类方法及系统
CN112740238A (zh) 2018-09-28 2021-04-30 三菱电机株式会社 推理装置、推理方法和推理程序
CN109902145B (zh) * 2019-01-18 2021-04-20 中国科学院信息工程研究所 一种基于注意力机制的实体关系联合抽取方法和系统
US10902203B2 (en) * 2019-04-23 2021-01-26 Oracle International Corporation Named entity disambiguation using entity distance in a knowledge graph

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108959328A (zh) * 2017-05-27 2018-12-07 株式会社理光 知识图谱的处理方法、装置及电子设备
CN109739995A (zh) * 2018-12-21 2019-05-10 中国银联股份有限公司 一种信息处理方法及装置
CN110147414A (zh) * 2019-05-23 2019-08-20 北京金山数字娱乐科技有限公司 一种知识图谱的实体表征方法及装置
CN110795569A (zh) * 2019-10-08 2020-02-14 北京百度网讯科技有限公司 知识图谱的向量表示生成方法、装置及设备

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
CHANG LIANG; ZHU MANLI; GU TIANLONG; BIN CHENZHONG; QIAN JUNYAN; ZHANG JI: "Knowledge Graph Embedding by Dynamic Translation", IEEE ACCESS, IEEE, USA, vol. 5, 1 January 1900 (1900-01-01), USA, pages 20898 - 20907, XP011672194, DOI: 10.1109/ACCESS.2017.2759139 *
FANG, YANG: "A Revised Translation-Based Method for Knowledge Graph Representation", JOURNAL OF COMPUTER RESEARCH AND DEVELOPMENT, vol. 55, no. 1, 1 January 2018 (2018-01-01), pages 139 - 150, XP055798897, DOI: 10.7544/issn1000-1239.2018.20160723 *
See also references of EP4044045A4 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113590777A (zh) * 2021-06-30 2021-11-02 北京百度网讯科技有限公司 文本信息处理方法、装置、电子设备和存储介质
CN113569773A (zh) * 2021-08-02 2021-10-29 南京信息工程大学 基于知识图谱和Softmax回归的干扰信号识别方法
CN113569773B (zh) * 2021-08-02 2023-09-15 南京信息工程大学 基于知识图谱和Softmax回归的干扰信号识别方法
CN113673249A (zh) * 2021-08-25 2021-11-19 北京三快在线科技有限公司 实体识别方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN110795569A (zh) 2020-02-14
US11995560B2 (en) 2024-05-28
KR20210043493A (ko) 2021-04-21
KR102604959B1 (ko) 2023-11-22
JP2022505015A (ja) 2022-01-14
JP7262571B2 (ja) 2023-04-21
CN110795569B (zh) 2021-06-15
EP4044045A4 (en) 2023-07-19
EP4044045A1 (en) 2022-08-17
US20230103430A1 (en) 2023-04-06

Similar Documents

Publication Publication Date Title
WO2021068468A1 (zh) 知识图谱的向量表示生成方法、装置及设备
US20210397947A1 (en) Method and apparatus for generating model for representing heterogeneous graph node
JP7127106B2 (ja) 質問応答処理、言語モデルの訓練方法、装置、機器および記憶媒体
US11899710B2 (en) Image recognition method, electronic device and storage medium
KR102677454B1 (ko) 이벤트 아규먼트 추출 방법, 장치, 및 전자 기기
US11928432B2 (en) Multi-modal pre-training model acquisition method, electronic device and storage medium
WO2021218124A1 (zh) 用于检测车辆的方法和装置
WO2017140221A1 (zh) 文本信息处理方法和装置
WO2021098121A1 (zh) 共享编码器生成方法、装置及电子设备
US11768873B2 (en) Method, apparatus, electronic device and readable storage medium for classifying video
US20230114293A1 (en) Method for training a font generation model, method for establishing a font library, and device
CN111582452B (zh) 生成神经网络模型的方法和装置
US20220101642A1 (en) Method for character recognition, electronic device, and storage medium
US20220237935A1 (en) Method for training a font generation model, method for establishing a font library, and device
CN111539897A (zh) 用于生成图像转换模型的方法和装置
KR102607536B1 (ko) 옵티마이저 학습 방법, 장치, 전자 기기 및 판독 가능 기록 매체
US11403799B2 (en) Method and apparatus for recognizing face-swap, device and computer readable storage medium
US11972219B2 (en) Intent recognition optimization processing method, apparatus, and storage medium
KR20220126264A (ko) 비디오 흔들림 검출 방법, 장치, 전자 기기 및 저장 매체
CN114492788A (zh) 训练深度学习模型的方法和装置、电子设备及存储介质
CN111680597A (zh) 人脸识别模型处理方法、装置、设备和存储介质
CN115170815A (zh) 视觉任务处理及模型训练的方法、装置、介质
CN111680599B (zh) 人脸识别模型处理方法、装置、设备和存储介质
WO2023174189A1 (zh) 图网络模型节点分类方法、装置、设备及存储介质
WO2024040870A1 (zh) 文本图像生成、训练、文本图像处理方法以及电子设备

Legal Events

Date Code Title Description
ENP Entry into the national phase

Ref document number: 2021515601

Country of ref document: JP

Kind code of ref document: A

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20767703

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2020767703

Country of ref document: EP

Effective date: 20220509