A method and system for acquiring information based on knowledge graph
By constructing a rail transit text corpus and using random walk and knowledge vector mapping technology, the problem of complexity and deviation of existing knowledge acquisition methods in the field of rail transit is solved, and vectorized expression of knowledge graphs and intelligent decision support are realized .
Patent Information
- Application Number
- CN202011458989.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-11
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2040-12-11
AI Technical Summary
Existing knowledge acquisition methods in the field of rail transit have complex models and large deviations in results, and cannot meet the needs of actual operation and safety management.
The information acquisition method based on the knowledge graph constructs a rail transit text corpus and uses random walk and knowledge vector mapping technology to generate knowledge vectors and realize vectorized expression and modular call of the knowledge graph.
It provides accurate and traceable knowledge data, supports intelligent decision-making in the rail transit field, and improves the accuracy and robustness of knowledge acquisition.
Smart Images

Figure CN112463989B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of rail transit technology, and in particular to an information acquisition method and system based on a knowledge graph. Background Art
[0002] Knowledge graph is one of the important technologies for assisting decision making and is widely used in industries such as medical care, finance, e-commerce, justice and education.
[0003] Knowledge acquisition technology is a key step in creating a knowledge graph. Knowledge extraction generally includes the extraction of entities and the extraction of relationships between entities, which refers to the automatic identification of named entities from the original corpus. At present, the widely used method is to use the long short-term memory network model to predict sequence text and combine it with the conditional random field algorithm (CRF) to complete the task of entity naming recognition. In addition, some knowledge acquisition methods are to artificially create semantic grammar rules to identify entities and the relationship between entities.
[0004] From the perspective of natural language processing, knowledge extraction can be considered as a word embedding technology (also known as pre-training technology), thereby improving the performance of downstream tasks. The Word2vec model designs a word prediction task, determines the text length through the sliding window method, and further distinguishes between background words and central words, mainly involving two implementation methods: CBOW and SKIP-GRAM. Fast-CNN, GloVe and other methods complete the knowledge acquisition task by using word structure information and co-occurrence matrix information respectively.
[0005] In the process of using the above methods to acquire knowledge, either the modeling process is relatively complicated or the extracted results have large deviations, which cannot meet the needs of actual operation, safety management, equipment maintenance, etc. of rail transit. Summary of the invention
[0006] In response to the problems existing in the prior art, an embodiment of the present invention provides an information acquisition method and system based on a knowledge graph.
[0007] The present invention provides an information acquisition method based on a knowledge graph, comprising:
[0008] Construct a knowledge graph based on the rail transit text corpus;
[0009] Execute random walk with the target node as the starting node to obtain the target random walk path;
[0010] Perform knowledge acquisition mapping on the target random walk path to generate a knowledge vector.
[0011] According to a method for obtaining information based on a knowledge graph provided by the present invention, the knowledge graph is constructed based on a rail transit text corpus, comprising:
[0012] Extracting words contained in each sentence in the rail transit text corpus as nodes of the knowledge graph;
[0013] Setting a connection edge of the knowledge graph between any two nodes appearing in the same sentence;
[0014] Obtain the knowledge graph.
[0015] According to a knowledge graph-based information acquisition method provided by the present invention, the method of performing random walk with a target node as a starting node to obtain a target random walk path includes:
[0016] Setting a maximum walking path γ of each node when executing the random walk and a maximum number of nodes m of the target random walk path;
[0017] Using the probability calculation method of normal distribution, an optimal walking node is determined from the γ walking paths corresponding to the current node;
[0018] Iteratively obtain the next walking node of the optimal walking node until the total number of nodes of the target random walking path is m, and then output the target random walking path;
[0019] The target random walk path is formed by sequentially connecting the target node to each optimal walk node in an iterative order.
[0020] According to a knowledge graph-based information acquisition method provided by the present invention, the knowledge acquisition mapping of the target random walk path is performed to generate a knowledge vector, including:
[0021] Get the target node n mapped to v n The probability Pr n , the mapping of the target node to the previous node of the target random walk path is v n-1 The probability Pr n-1 , the mapping of the target node to the next node of the target random walk path is v n+1 The probability Pr n+1 ;
[0022] According to the mapping constraint condition, the optimal mapping vector of the target node n is determined; the mapping constraint condition is to maximize the Pr n-1 and the Pr n+1 ; the v n is the optimal mapping vector corresponding to the target node, v n-1 is the optimal mapping vector corresponding to the previous node, vn+1 is the optimal mapping vector corresponding to the latter node;
[0023] Iterate to obtain the optimal mapping vector for each node;
[0024] According to the target random walk path, each of the optimal mapping vectors is synthesized to generate the knowledge vector.
[0025] According to a knowledge graph-based information acquisition method provided by the present invention, the knowledge acquisition mapping of the target random walk path is performed to generate a knowledge vector, including
[0026] Based on the sliding window algorithm, when the sliding window size is set to z, the target node n is mapped to v n The probability Pr n , the average probability Pr of the target node being mapped to the first z nodes of the target random walk path n-z , the average probability Pr of the target node being mapped to the last z nodes of the target random walk path n+z ;
[0027] According to the mapping constraint condition, the optimal mapping vector of the target node n is determined; the mapping constraint condition is to maximize the Pr n-z and the Pr n+z ; said v n is the optimal mapping vector corresponding to the target node;
[0028] Iterate to obtain the optimal mapping vector for each node;
[0029] According to the target random walk path, each of the optimal mapping vectors is synthesized to generate the knowledge vector.
[0030] According to a knowledge graph-based information acquisition method provided by the present invention, the iterative acquisition of the optimal mapping vector of each node specifically includes:
[0031] Based on the stochastic gradient descent and error back propagation method, the optimal mapping vector of each node is iteratively obtained.
[0032] According to a method for obtaining information based on a knowledge graph provided by the present invention, the target node n is mapped to v n The probability Pr n ,include:
[0033] Convert each node in the knowledge graph into a corresponding vector representation based on the word2vec model;
[0034] According to the number of connected edges of each node, a Huffman tree model is constructed;
[0035] Based on the Huffman tree model, the probability Pr corresponding to the target node n is obtained. n .
[0036] The present invention also provides an information acquisition system based on knowledge graph, including:
[0037] A graph construction unit, used to construct a knowledge graph based on the rail transit text corpus;
[0038] A path determination unit, used to perform random walk with the target node as the starting node, and obtain a target random walk path;
[0039] The vector generating unit is used to perform knowledge acquisition mapping on the target random walk path to generate a knowledge vector.
[0040] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any of the above-mentioned methods for acquiring information based on a knowledge graph are implemented.
[0041] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the above-described methods for acquiring information based on a knowledge graph.
[0042] The information acquisition method and system based on knowledge graph provided by the present invention establishes a text representation method based on knowledge graph and adopts random walk method to determine the knowledge vector of each node in the graph to realize vectorized expression of knowledge graph, so that knowledge graph can be modularized and convenient to call. Then, the changing and developing laws of knowledge can be deduced according to the constructed knowledge graph, providing accurate and traceable knowledge data for intelligent decision-making in the field of rail transportation. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0044] Figure 1 It is a flowchart of the information acquisition method based on knowledge graph provided by the present invention;
[0045] Figure 2 It is a schematic diagram of the structure of the information acquisition system based on the knowledge graph provided by the present invention;
[0046] Figure 3 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] Combine the following Figure 1-Figure 3 Describe the knowledge graph-based information acquisition method and system provided by an embodiment of the present invention.
[0049] Figure 1 is a flow chart of the information acquisition method based on knowledge graph provided by the present invention, such as Figure 1 As shown, including but not limited to the following steps:
[0050] Step S1: construct a knowledge graph based on the rail transit text corpus;
[0051] Step S2: Execute random walk with the target node as the starting node to obtain the target random walk path;
[0052] Step S3: Perform knowledge acquisition mapping on the target random walk path to generate a knowledge vector.
[0053] In step S1, the rail transit text corpus can be constructed based on various collected data such as maintenance records, data recorded by on-board equipment, server processing files, etc. The objects of data collection can be each train, each station and dispatching center, or by collecting Internet data, such as expert database data, etc., which is not specifically limited in the present invention.
[0054] After the rail transit text corpus is created, it also includes: creating a text-based knowledge graph based on all the text content recorded in the rail transit text corpus. The knowledge graph is essentially a semantic network. Its nodes represent entities or concepts, and the edges represent various semantic relationships between entities or concepts. Therefore, in the present invention, each word in the rail transit text corpus can be used as a node, and the knowledge graph can be created with the association relationship between each two words as the connecting edge between two nodes.
[0055] The knowledge graph constructed by the present invention combines the theories and methods of applied mathematics, graphics, information visualization technology, information science and other disciplines with metrology citation analysis, co-occurrence analysis and other methods, and uses visual graphs to display the complex knowledge of rail transit through data mining, information processing, knowledge metrology and graph drawing, so as to deduce the laws of knowledge change and development, and provide accurate and traceable knowledge data for intelligent decision-making in the field of rail transit.
[0056] Furthermore, in step S2, the target node is any node in the knowledge graph, and each node in the knowledge graph is used as a starting node, and a random walk method is used to obtain a random walk path corresponding to each node.
[0057] In the knowledge graph constructed by the present invention, random walks are started from the target node, and an irregular random walk path composed of various nodes can be obtained. Optionally, the walking direction of the random walk can be restricted according to relevant constraints, and the target random walk path can be obtained.
[0058] The random walk is also called a random walk, which means that based on past performance, it is impossible to predict the future development steps and directions. The core concept is that the conservation quantity carried by any irregular walker corresponds to a diffusion transport law, which is close to Brownian motion and is the ideal mathematical state of Brownian motion.
[0059] Furthermore, in step S3, since each node in the acquired random walk path is in text form, the entire knowledge graph is not convenient for storage and modularization, and it is not used as a specific operation tool for rail transit, such as using the knowledge graph for fault cause analysis. In the information acquisition method based on the knowledge graph provided by the present invention, by performing knowledge acquisition mapping on any acquired target random walk path, the corresponding knowledge vector is generated by vectorizing all target random walk paths, which can achieve vectorization of the entire knowledge graph to a certain extent.
[0060] The knowledge vector is synthesized from sub-vectors corresponding to words related to each node constituting the target random walk path.
[0061] The information acquisition method based on knowledge graph provided by the present invention establishes a text representation method based on knowledge graph and adopts random walk method to determine the knowledge vector of each node in the graph to realize vectorized expression of knowledge graph, so that knowledge graph can be modularized and convenient to call. Then, the changing and developing law of knowledge can be deduced according to the constructed knowledge graph, and accurate and traceable knowledge data can be provided for intelligent decision-making in the field of rail transportation.
[0062] Based on the contents of the above embodiments, as an optional embodiment, the construction of a knowledge graph based on a rail transit text corpus includes: extracting words contained in each sentence in the rail transit text corpus as nodes of the knowledge graph; setting connecting edges of the knowledge graph between any two nodes appearing in the same sentence; and obtaining the knowledge graph.
[0063] Word extraction is to identify the words that make up a sentence or text, usually including labels such as appointment, organization / institution name, geographic location, time / date, character value, etc. The specific label definition can be adjusted according to different tasks. The connection edge is to reflect the relationship between the words by connecting them.
[0064] Optionally, since most of the sentences in the rail transit text corpus are Chinese sentences, a term frequency–inverse document frequency index statistical method (TF-IDF) can be used to extract words from each sentence in the rail transit text corpus.
[0065] Furthermore, since each sentence in the rail transit text corpus includes not only keywords but also often a large number of invalid words, the pyhanlp word segmentation tool can also be used to extract keywords, that is, only use keywords as nodes of the knowledge graph.
[0066] It should be noted that the knowledge graph-based information acquisition method provided by the present invention specifically limits the method for word extraction.
[0067] Furthermore, since the distribution of words in the language model follows a power-law distribution, the knowledge graph constructed by the present invention is preferably a scale-free graph. Therefore, in the knowledge graph constructed by the present invention, nodes are used to represent words, and nodes connected to each other indicate that the two words have appeared in the same sentence, and the weight value of the edge in the graph is set to 1. The obtained knowledge graph is an unweighted and phase-free graph, that is, if node A is connected to node B, then node B is also connected to node B.
[0068] The information acquisition method based on knowledge graph provided by the present invention is based on the distribution characteristics of the language model, that is, idiomatic words tend to be concentrated in a small number, while the vast majority of words are rarely used. Setting the knowledge graph as a scale-free graph can better reflect the real data characteristics and effectively reduce the complexity of graph construction.
[0069] Based on the content of the above embodiment, as an optional embodiment, the step of performing a random walk with the target node as the starting node to obtain a target random walk path includes:
[0070] Setting a maximum walking path γ of each node when executing the random walk and a maximum number of nodes m of the target random walk path;
[0071] Using the probability calculation method of normal distribution, an optimal walking node is determined from the γ walking paths corresponding to the current node;
[0072] Iteratively obtain the next walking node of the optimal walking node until the total number of nodes of the target random walking path is m, and then output the target random walking path;
[0073] The target random walk path is formed by sequentially connecting the target node to each optimal walk node in an iterative order.
[0074] Specifically, in the process of generating random walk paths, the parameter γ is first determined, which means that each node will generate γ paths. In addition, the length of each random walk path is defined as m, that is, each random walk path contains m words.
[0075] It should be noted that the random walk path generation process is a node-by-node iterative generation process, in which the selection of the next node can be traced back to the previous node, which is also in line with the actual situation in natural language processing. When selecting the next node, the probability calculation method of the normal distribution can be used to select the next node.
[0076] For example, when the current node is the nth node (n<m), and the n+1th node needs to be determined, since the nth node has γ wandering paths to choose from, that is, γ nodes may be the n+1th node on the target wandering path. The probability of the above γ nodes being the n+1th node can be calculated using the normal distribution probability method, and the node with the largest probability can be determined as the optimal wandering node.
[0077] By adopting the above method, starting from the next node of the target node and gradually iterating to confirm the next node, a target random walk path that meets the requirements can be obtained.
[0078] For the target walking path, according to the language model, the calculation method of the nodes can be expressed as follows:
[0079]
[0080] Among them, t1, t2, t3, …, t γare γ nodes on the target walking path, k is an intermediate parameter, p(t γ ) is the probability that the γth node becomes the optimal walking node of the γ-1th node.
[0081] The information acquisition method based on knowledge graph provided by the present invention uses normal distribution to calculate the probability of the next node of the target node during the process of acquiring the target random walk path, and gradually generates the target random walk path. This is in line with the distribution law of words in the language model and can effectively improve the accuracy and robustness of path prediction.
[0082] Based on the content of the above embodiment, as an optional embodiment, the step of performing knowledge acquisition mapping on the target random walk path to generate a knowledge vector includes:
[0083] Get the target node n mapped to v n The probability Pr n , the mapping of the target node to the previous node of the target random walk path is v n-1 The probability Pr n-1 , the mapping of the target node to the next node of the target random walk path is v n+1 The probability Pr n+1 ;
[0084] According to the mapping constraint condition, the optimal mapping vector of the target node n is determined; the mapping constraint condition is to maximize the Pr n-1 and the Pr n+1 ; said v n is the optimal mapping vector corresponding to the target node, v n-1 is the optimal mapping vector corresponding to the previous node, v n+1 is the optimal mapping vector corresponding to the latter node;
[0085] Iterate to obtain the optimal mapping vector for each node;
[0086] According to the target random walk path, each of the optimal mapping vectors is synthesized to generate the knowledge vector.
[0087] The present invention provides a method for vectorizing an acquired target random walk path, that is, sequentially acquiring a vectorized mapping of each node on the target random walk path.
[0088] Assume that the nodes passed by a random walk path are: node 1-node 2-node 3-node 4-node 5-node 6.
[0089] Since the mapping of node 3 will be related to nodes 2 and 4, the mapping of node 3 needs to maximize the following formula:
[0090] Pr(v2 / v3);
[0091] Pr(v4 / v3);
[0092] Where v represents the vector representation of a node, Pr is the probability of mapping the node to the corresponding vector, and the above two formulas indicate that: given v3, the occurrence probabilities of v2 and v4 are maximized respectively, that is, the following mapping constraints are satisfied: the probability that the previous node of the target node corresponding to v3 is mapped to v2 and the probability that the next node of the target node corresponding to v3 is mapped to v4 are both required to be maximized.
[0093] According to the previous method, the vectorization representation of each node is iterated until the text vectorization of all nodes is completed. Among them, each node text data can generate a corresponding optimal mapping vector, and then the optimal mapping vectors of the nodes are synthesized to obtain the target knowledge vector.
[0094] The knowledge graph-based information acquisition method provided by the present invention utilizes a step-by-step iterative approach to determine the mapping method of the target node according to constraints and the mapping probability of two nodes adjacent to each target node in the random walk path, thereby effectively improving the robustness of the mapping and the accuracy of the mapping.
[0095] Based on the content of the above embodiment, as an optional embodiment, the knowledge acquisition mapping of the target random walk path is performed to generate a knowledge vector, including
[0096] Based on the sliding window algorithm, when the sliding window size is set to z, the target node n is mapped to v n The probability Pr n , the average probability Pr of the target node being mapped to the first z nodes of the target random walk path n-z , the average probability Pr of the target node being mapped to the last z nodes of the target random walk path n+z ;
[0097] According to the mapping constraint condition, the optimal mapping vector of the target node n is determined; the mapping constraint condition is to maximize the Pr n-z and the Pr n+z ; said v n is the optimal mapping vector corresponding to the target node;
[0098] Iterate to obtain the optimal mapping vector for each node;
[0099] According to the target random walk path, each of the optimal mapping vectors is synthesized to generate the knowledge vector.
[0100] Since a large number of node update calculations are involved in the process of determining the mapping direction of the target node, which is not conducive to the computational processing of large-scale knowledge graphs, in the information acquisition method based on the knowledge graph provided by the present invention, a sliding window algorithm is firstly adopted, and the average value of the node probabilities of a certain number of nodes before and after the target node is taken as a reference for its mapping direction.
[0101] The sliding window algorithm (Moving Window) controls the traffic volume by limiting the maximum number of cells that can be received in each value window. In the present invention, the number of words (nodes) in one calculation is determined by the sliding window algorithm.
[0102] Among them, the average probability Pr of the target node being mapped to the first z nodes of the target random walk path is n-z , which means obtaining the probability of the target node in the first z nodes of the target random walk path respectively, and then obtaining the average of the probabilities of all z nodes as Pr n-z Similarly, the average probability Pr of the target node being mapped to the last z nodes of the target random walk path is n+z , refers to obtaining the probability of the target node in the next z nodes of the target random walk path respectively, and then obtaining the average of the probabilities of all z nodes as Pr n+z .
[0103] The knowledge graph-based information acquisition method provided by the present invention adopts a sliding window algorithm to calculate the mapping of the target node, which effectively reduces the amount of calculation and can greatly improve the accuracy and robustness of the mapping by taking the average value.
[0104] Based on the content of the above embodiment, as an optional embodiment, the iterative acquisition of the optimal mapping vector of each node specifically includes:
[0105] Based on the stochastic gradient descent and error back propagation method, the optimal mapping vector of each node is iteratively obtained.
[0106] Since the training process of calculating the optimal mapping vector of each node involves iterative calculation steps, in order to effectively improve the efficiency of the calculation, the information acquisition method based on the knowledge graph provided in the present invention adopts stochastic gradient descent and error back propagation methods in the iterative calculation process.
[0107] The Batch Gradient Descent method solves the problem of too much training data. Each time the model parameters are updated, only q training data need to be processed, where q is a constant much smaller than the total number of training samples M (usually an integer power of 2), which can greatly speed up the training process.
[0108] Among them, the error back propagation method (Error BackPropagation, BP method), the basic idea of BP algorithm is that the learning process consists of two processes: forward propagation of signals and back propagation of errors. Forward propagation includes: input sample-input layer-each hidden layer (processing)-output layer; if the actual output of the output layer does not match the expected output (teacher signal), it will enter the error back propagation process. Error back propagation includes: output error (a certain form)-hidden layer (layer by layer)-input layer. Its main purpose is to distribute the error to all units in each layer by back propagating the output error, so as to obtain the error signal of each layer unit, and then correct the weight of each unit, that is, the error back propagation process is a weight adjustment process.
[0109] Based on the content of the above embodiment, as an optional embodiment, the acquisition target node n is mapped to v n The probability Pr n ,include:
[0110] Based on the word2vec model, each node in the knowledge graph is converted into a corresponding vector representation; a Huffman tree model is constructed according to the quantity relationship of the connecting edges of each node; based on the Huffman tree model, the probability Prn corresponding to the target node n is obtained.
[0111] Among them, the word2vec (word to vector) model is a related model used to generate word vectors. These models are shallow and two-layer neural networks that are represented by words and need to guess the input words in adjacent positions. Under the word bag model assumption in word2vec, the order of words is not important. After training, the word2vec model can be used to map each node (word) to a vector representation, which can be used to represent the relationship between words.
[0112] Regarding the Huffman Tree model, given N weights as N leaf nodes, a binary tree is constructed. If the weighted path length of the tree is minimized, such a binary tree is called an optimal binary tree, also known as a Huffman tree. The Huffman tree is a tree with the shortest weighted path length, and nodes with larger weights are closer to the root.
[0113] In the above embodiment provided by the present invention, for a certain walking path, according to the language model, the calculation method of the node is:
[0114]
[0115] Obviously, such training and calculation will require a large number of node updates, which is not conducive to the processing of large-scale graphs. Therefore, in the process of calculating the knowledge vector, the hierarchical softmax method in word2vec can be selected.
[0116] In this method, the nodes in the knowledge graph are constructed into a Huffman tree from most to least according to the number of edges connecting each node. The vector training process for a certain node can be approximated as a path from the root node to the leaf node, which greatly reduces the computational complexity.
[0117] Figure 2 is a schematic diagram of the structure of the information acquisition system based on the knowledge graph provided by the present invention, such as Figure 2 As shown, it mainly includes a graph construction unit 1, a path determination unit 2 and a vector generation unit 3, wherein:
[0118] The graph construction unit 1 is mainly used to construct a knowledge graph based on the rail transit text corpus;
[0119] The path determination unit 2 is mainly used to perform random walk with the target node as the starting node to obtain the target random walk path;
[0120] The vector generation unit 3 is mainly used to perform knowledge acquisition mapping on the target random walk path to generate a knowledge vector.
[0121] Specifically, on the one hand, the graph construction unit 1 is used to collect various types of relevant information such as maintenance records, data recorded by on-board equipment, server processing files, etc. to build a rail transit text corpus; on the other hand, the graph construction unit 1 is also used, after the rail transit text corpus is created, to also include: based on all the text content recorded in the rail transit text corpus, create a text-based knowledge graph, including: each word in the rail transit text corpus can be used as a node, and the association relationship between each two words is used as the connecting edge between two nodes to create the knowledge graph.
[0122] Furthermore, the path determination unit 2 takes each node in the knowledge graph as a starting node and adopts a random walk method to obtain a random walk path corresponding to each node.
[0123] Furthermore, the vector generation unit 3 performs knowledge acquisition mapping on any acquired target random walk path, so as to generate corresponding knowledge vectors by vectorizing all target random walk paths, which can realize the vectorization of the entire knowledge graph to a certain extent.
[0124] The information acquisition system based on knowledge graph provided by the present invention establishes a text representation method based on knowledge graph and adopts random walk method to determine the knowledge vector of each node in the graph to realize vectorized expression of knowledge graph, so that knowledge graph can be modularized and convenient to call. Then, the changing and developing law of knowledge can be deduced according to the constructed knowledge graph, and accurate and traceable knowledge data can be provided for intelligent decision-making in the field of rail transportation.
[0125] It should be noted that the system for improving train positioning accuracy provided by the embodiment of the present invention can be implemented based on the method for improving train positioning accuracy described in any of the above embodiments during specific execution, which will not be elaborated in this embodiment.
[0126] Figure 3 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 3 As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communication interface 320 and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the information acquisition method based on the knowledge graph, which includes: constructing a knowledge graph based on a rail transit text corpus; performing a random walk with a target node as a starting node to obtain a target random walk path; performing knowledge acquisition mapping on the target random walk path to generate a knowledge vector.
[0127] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0128] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the information acquisition method based on the knowledge graph provided by the above methods, and the method includes: constructing a knowledge graph based on a rail transit text corpus; executing a random walk with a target node as a starting node to obtain a target random walk path; performing knowledge acquisition mapping on the target random walk path to generate a knowledge vector.
[0129] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it is implemented to execute the information acquisition method based on the knowledge graph provided in the above-mentioned embodiments, the method comprising: constructing a knowledge graph based on a rail transit text corpus; performing a random walk with a target node as a starting node to obtain a target random walk path; performing knowledge acquisition mapping on the target random walk path to generate a knowledge vector.
[0130] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0131] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0132] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for obtaining information based on knowledge graph, characterized in that: include: Construct a knowledge graph based on the rail transit text corpus; Execute random walk with the target node as the starting node to obtain the target random walk path; Performing knowledge acquisition mapping on the target random walk path to generate a knowledge vector; The knowledge graph is constructed based on the rail transit text corpus, including: Extracting words contained in each sentence in the rail transit text corpus as nodes of the knowledge graph; setting a connection edge of the knowledge graph between any two nodes appearing in the same sentence; and obtaining the knowledge graph; The step of performing random walk with the target node as the starting node to obtain the target random walk path includes: Set the maximum number of paths that each node can walk when executing the random walk. and the maximum number of nodes m of the target random walk path; using the probability calculation method of normal distribution, from the current node corresponding to An optimal walking node is determined from the maximum walking paths; the next walking node of the optimal walking node is iteratively obtained until the total number of nodes of the target random walking path is m, and the target random walking path is output; the target random walking path is formed by connecting the target node to each optimal walking node in sequence according to the iteration order; The step of performing knowledge acquisition mapping on the target random walk path to generate a knowledge vector includes: Based on the sliding window algorithm, when the sliding window size is set to z, the target node n is mapped to v n The probability Pr n , the average probability Pr of the target node being mapped to the first z nodes of the target random walk path n-z , the average probability Pr of the target node being mapped to the last z nodes of the target random walk path n+z ; According to the mapping constraint, determine the optimal mapping vector of the target node n; the mapping constraint is to maximize the Pr n-z and the Pr n+z ; the v n is the optimal mapping vector corresponding to the target node; iteratively obtains the optimal mapping vector of each node; and generates the knowledge vector by synthesizing each of the optimal mapping vectors according to the target random walk path; Alternatively, performing knowledge acquisition mapping on the target random walk path to generate a knowledge vector includes: Get the target node n mapped to v n The probability Pr n , the mapping of the target node to the previous node of the target random walk path is v n-1 The probability Pr n-1 , the mapping of the target node to the next node of the target random walk path is v n+1 The probability Pr n+1 ; According to the mapping constraint, determine the optimal mapping vector of the target node n; the mapping constraint is to maximize the Pr n-1 and the Pr n+1 ; said v n is the optimal mapping vector corresponding to the target node, v n-1 is the optimal mapping vector corresponding to the previous node, v n+1 is the optimal mapping vector corresponding to the latter node; iteratively obtains the optimal mapping vector of each node; and generates the knowledge vector by synthesizing each of the optimal mapping vectors according to the target random walk path.
2. The method for obtaining information based on knowledge graph according to claim 1, characterized in that: The iterative acquisition of the optimal mapping vector for each node specifically includes: Based on the stochastic gradient descent and error back propagation method, the optimal mapping vector of each node is iteratively obtained.
3. The method for obtaining information based on knowledge graph according to claim 1, characterized in that: The target node n is mapped to v n The probability Pr n ,include: Convert each node in the knowledge graph into a corresponding vector representation based on the word2vec model; According to the number of connected edges of each node, a Huffman tree model is constructed; Based on the Huffman tree model, the probability Pr corresponding to the target node n is obtained. n .
4. An information acquisition system based on knowledge graph, characterized in that: include: A graph construction unit, used to construct a knowledge graph based on the rail transit text corpus; A path determination unit, used to perform random walk with the target node as the starting node, and obtain a target random walk path; A vector generation unit, used for performing knowledge acquisition mapping on the target random walk path to generate a knowledge vector; The graph construction unit is further used to extract the words contained in each sentence in the rail transit text corpus as nodes of the knowledge graph; set a connection edge of the knowledge graph between any two nodes appearing in the same sentence; and obtain the knowledge graph; The path determination unit is further used to set the maximum number of walking paths for each node when executing the random walk. and the maximum number of nodes m of the target random walk path; using the probability calculation method of normal distribution, from the corresponding An optimal walking node is determined from the maximum walking paths; the next walking node of the optimal walking node is iteratively obtained until the total number of nodes of the target random walking path is m, and the target random walking path is output; the target random walking path is formed by connecting the target node to each optimal walking node in sequence according to the iteration order; The vector generation unit is also used to obtain the target node n mapped to v based on the sliding window algorithm when the sliding window size is set to z. n The probability Pr n , the average probability Pr of the target node being mapped to the first z nodes of the target random walk path n-z , the average probability Pr of the target node being mapped to the last z nodes of the target random walk path n+z ; According to the mapping constraint, determine the optimal mapping vector of the target node n; the mapping constraint is to maximize the Pr n-z and the Pr n+z ; the v n is the optimal mapping vector corresponding to the target node; iteratively obtains the optimal mapping vector of each node; according to the target random walk path, synthesizes each of the optimal mapping vectors to generate the knowledge vector; or, further used to obtain the mapping of the target node n to v n The probability Pr n , the mapping of the target node to the previous node of the target random walk path is v n-1 The probability Pr n-1 , the mapping of the target node to the next node of the target random walk path is v n+1 The probability Pr n+1 ; According to the mapping constraint, determine the optimal mapping vector of the target node n; the mapping constraint is to maximize the Pr n-1 and the Pr n+1 ; the v n is the optimal mapping vector corresponding to the target node, v n-1 is the optimal mapping vector corresponding to the previous node, v n+1 is the optimal mapping vector corresponding to the latter node; iteratively obtains the optimal mapping vector of each node; and generates the knowledge vector by synthesizing each of the optimal mapping vectors according to the target random walk path.
5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the information acquisition method based on the knowledge graph as described in any one of claims 1 to 3 are implemented.
6. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the information acquisition method based on the knowledge graph as described in any one of claims 1 to 3 are implemented.
