Knowledge reasoning and relation generation method and device, equipment and storage medium
By combining the evolution algorithm and deep learning technology, the potential relationship between the entities in the knowledge map of urban -level data services is automatically excavated and generated by the city -level data services, and the problems of the knowledge map updates in the existing technologies are not timely, and the manual labeling time and effort will be achieved. The construction and update of high -efficiency and automated knowledge maps improve the intelligent level of data services.
Patent Information
- Application Number
- CN202411302658.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2025-01-24
AI Technical Summary
When building and maintaining the knowledge graph of city-level data services, the existing technology faces problems such as untimely updates, time-consuming and labor-intensive manual labeling, low degree of automation, and inability to ensure the consistency and timeliness of large-scale data.
By combining global search capabilities and characteristic extraction capabilities of deep learning, automatically excavate and generate potential relationships between entities in the knowledge map, and improve the coverage and accuracy of the knowledge map. Specific methods include collecting urban operation management data, data governance, extracting text characteristics, identifying entities, extracting entity relationships, storage to diagram databases, using knowledge reasoning engines to generate new entities and relationships, and update the knowledge map.
It realizes the automatic construction and update of knowledge graphs, improves the construction efficiency and quality of knowledge graphs, reduces maintenance costs, enhances the dynamic adaptability of knowledge graphs, and provides richer solutions for applications such as intelligent recommendations, semantic search, and automatic question answering. knowledge base.
Smart Images

Figure CN119358667A_ABST
Abstract
Description
Background Art
[0002] In the current context of intelligent and digital transformation, the field of city-level data governance is actively exploring the use of advanced technologies to create a common urban support platform that integrates online and offline services and coordinated service management, in order to improve the application support and service capabilities of data elements. In order to better serve decision-making needs and ensure that they can gain a comprehensive and accurate understanding of the situation and clarify the process of handling matters, the construction of knowledge reasoning based on knowledge graphs has become an important support for the intelligent upgrade of data services in some regions.
[0003] However, the construction and maintenance of the knowledge graph of data services in some regions face many problems. For example, the knowledge graph has not been updated, or the construction of the knowledge graph relies on manual annotation by experts, which is time-consuming and labor-intensive, with a low degree of automation, and cannot meet the needs of large-scale knowledge graph construction. It is also difficult to ensure the consistency and timeliness of large-scale data. The original data of the knowledge graph may be inconsistent, redundant or missing, affecting the accuracy and completeness of the knowledge graph. Summary of the invention
[0004] The present invention provides a knowledge reasoning and relationship generation method, which can obtain data from various fields, and automatically mine and generate potential relationships between entities in a knowledge graph by combining the global search capability of an evolutionary algorithm and the feature extraction capability of deep learning, thereby improving the coverage and accuracy of the knowledge graph.
[0005] Methods include:
[0006] S101: Collect data in various fields of urban operation and management, and conduct data governance on the collected data;
[0007] S102: Using a preset feature extraction method to extract text features from various types of data after data management;
[0008] S103: Identify entities in text features;
[0009] S104: extracting the relationship between entities in the text features and setting the task of binary or multi-element relationship extraction; encoding the text fragments containing the entities and automatically learning the semantic features and relationship patterns in the text features using a deep learning model;
[0010] S105: storing the identified entities and the relationships between the extracted entities in a graph database to form an initial knowledge graph;
[0011] S106: Using the preset knowledge reasoning engine, generate new entities and relationships corresponding to the data in various fields after governance;
[0012] S107: Update the initial knowledge graph based on the new entities and relationships to obtain a city-level data knowledge graph.
[0013] It is further necessary to explain that the method also includes updating the city-level data knowledge graph;
[0014] S201: Collecting new data in various fields of urban operation management in real time, and performing data management on the new data;
[0015] S202: using the feature extraction method to extract text features from various newly added data after data management is completed as newly added text features;
[0016] S203: Identify entities in the newly added text features;
[0017] S204: extracting the relationship between entities in the newly added text features;
[0018] S205: adding the entities in the identified newly added text features and the relationships between the entities in the extracted newly added text features to the city-level data knowledge graph to obtain a first knowledge graph;
[0019] S206: Using the knowledge reasoning engine, generate new entities and relationships corresponding to various types of newly added data after data governance is completed;
[0020] S207: Update the first knowledge graph with the new entities and relationships corresponding to the various types of newly added data to obtain an updated city-level data knowledge graph.
[0021] It should be further explained that step S103 also includes:
[0022] Preprocess text features;
[0023] Input each word in the text feature into the BiLSTM network, learn the context information of the word, and output the feature representation of each word;
[0024] The output of the BiLSTM network is input into the CRF layer. The CRF layer identifies the label constraint relationship based on the named entity and predicts the entity in the text feature.
[0025] It should be further explained that step S105 also includes: constructing an initial knowledge graph using graph database technology, and the specific steps include:
[0026] Prepare data. After completing the data collection and data governance work in various fields of urban operation and management, extract text features from the data, identify entities in the text features, and extract the relationships between entities;
[0027] Create node labels and relationship types in the graph database based on the entity types and relationship types in the knowledge graph;
[0028] Use Python scripts to import entities and extracted relationships into the graph database in CSV format supported by the graph database.
[0029] Set attributes and indexes to verify the initial knowledge graph.
[0030] It should be further explained that, in step S106, the knowledge reasoning engine identifies implicit relationships between entities based on the entity relationship data of the initial knowledge graph;
[0031] Based on the adaptive evolutionary learning strategy, the knowledge graph is inferred to identify the implicit relationships between entities and fill the knowledge gaps.
[0032] It is further necessary to explain that, according to the update frequency of data in each field, the evaluation data related to the city-level data knowledge graph is collected;
[0033] Based on the collected evaluation data, the coverage, accuracy and update speed values of the city-level data knowledge graph are evaluated.
[0034] It should be further explained that the coverage of the city-level data knowledge graph is calculated as follows:
[0035]
[0036] K entity ——The number of entities covered in the city-level data knowledge graph;
[0037] K relation ——The number of relationships covered in the city-level data knowledge graph;
[0038] T entity ——The actual number of entities that should be included in the city-level data knowledge graph;
[0039] T relation ——The actual number of relationships that should be included in the city-level data knowledge graph;
[0040] The accuracy of the city-level data knowledge graph is calculated as follows:
[0041]
[0042] R entity ——The correct number of entities in the city-level data knowledge graph;
[0043] R relation ——The correct number of relationships in the knowledge graph of city-level data;
[0044] K entity ——The number of entities covered in the city-level data knowledge graph;
[0045] K relation ——The number of relationships covered in the city-level data knowledge graph;
[0046] The update speed of the city-level data knowledge graph is calculated as follows:
[0047]
[0048] N – the number of entities and relationships updated in a certain period of time;
[0049] t – a specific period of time.
[0050] The present application also provides a knowledge reasoning and relationship generation system, the system comprising:
[0051] Data collection module, used to collect data in various fields of urban operation and management, and to manage the collected data;
[0052] The feature extraction module is used to extract text features from various types of data after data management using a preset feature extraction method;
[0053] Entity recognition module, used to identify entities in text features;
[0054] The extraction learning module is used to extract the relationship between entities in text features and set the task of binary or multi-element relationship extraction; encode the text fragments containing entities and use the deep learning model to automatically learn the semantic features and relationship patterns in the text features;
[0055] A graph configuration module is used to store the identified entities and the relationships between the extracted entities into a graph database to form an initial knowledge graph;
[0056] The data generation module is used to use the preset knowledge reasoning engine to generate new entities and relationships corresponding to the data in various fields after governance;
[0057] The graph updating module is used to update the initial knowledge graph based on new entities and relationships to obtain a city-level data knowledge graph.
[0058] According to another embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the knowledge reasoning and relationship generation method when executing the program.
[0059] According to another embodiment of the present application, a storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the knowledge reasoning and relationship generation method are implemented.
[0060] It can be seen from the above technical solutions that the present invention has the following advantages:
[0061] The knowledge reasoning and relationship generation method provided by this application realizes the integration of multi-source data by collecting and acquiring data from various fields. It can break data silos and realize data interconnection and interoperability. By analyzing the relationship between text features and entities, an initial knowledge graph is formed, which provides a graphical representation for data in various fields, making it convenient for users to quickly understand the relationship and pattern between data.
[0062] This application identifies and extracts the relationships between entities in text features, and sets the task of extracting binary or multi-element relationships; encodes text fragments containing entities, and uses deep learning models to automatically learn semantic features and relationship patterns in text features; stores the identified entities and the relationships between extracted entities in a graph database to form an initial knowledge graph; uses a preset knowledge reasoning engine to generate new entities and relationships corresponding to data in various fields after governance; updates the initial knowledge graph based on the new entities and relationships to obtain a city-level data knowledge graph, and realizes automatic mining and generation of potentially complex relationships between entities in the knowledge graph. Combining evolutionary learning and deep learning, the efficiency and quality of knowledge graph construction are improved through automatic mining and generation of knowledge graph relationships.
[0063] This application adopts a multi-objective optimization strategy, which not only ensures the accuracy of the entity relationship of the knowledge graph, but also takes into account the mining of deep implicit relationships. It not only performs well on the data set of the city-level data service field, but also has strong generalization capabilities. It further solves the problem that it relies on manual annotation by experts, which is time-consuming and labor-intensive, cannot meet the needs of large-scale knowledge graph construction, and is difficult to ensure the consistency and timeliness of large-scale data. By combining evolutionary learning and deep learning, the knowledge graph relationship is automatically mined and generated, which improves the construction efficiency and quality of the knowledge graph, reduces maintenance costs, and enhances the dynamic adaptability of the knowledge graph, providing a richer knowledge base for applications such as intelligent recommendation, semantic search, and automatic question and answer. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the technical solution of the present invention, the accompanying drawings required for use in the description will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0065] Figure 1 Flowchart of methods for knowledge reasoning and relationship generation;
[0066] Figure 2 A flow chart of the method for updating the city-level data knowledge graph;
[0067] Figure 3 Generate system diagrams for knowledge reasoning and relationships;
[0068] Figure 4 Schematic diagram of an electronic device. DETAILED DESCRIPTION
[0069] In the following description, specific details such as specific system structures and technologies are provided for illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application can also be implemented in other embodiments without these specific details.
[0070] It should be understood that when used in the present specification, the term "includes" indicates the presence of the described features, integral bodies, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integral bodies, steps, operations, elements, components and / or their collections. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.
[0071] It should be understood that the "one or more" mentioned in this application refers to one, two or more than two, and the "multiple" mentioned in this application refers to two or more. In the description of this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B. The "and / or" in this article is just a way to describe the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0072] The phrases such as "one embodiment" or "some embodiments" described in the present application mean that the specific features, structures or characteristics described in the embodiment are included in one or more embodiments of the present application. Therefore, the phrases such as "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments" etc. that appear in different places in the present application do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways.
[0073] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only 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.
[0074] See also Figure 1The figure is a flow chart of a method for knowledge reasoning and relationship generation in a specific embodiment, the method comprising:
[0075] S101: Collect data from various fields of urban operation and management, and conduct data governance on the collected data.
[0076] In some embodiments, the data collected and acquired in various fields may be data generated by various government departments, medical institutions, educational institutions and other public institutions in the process of performing their duties, and the data may be stored in a database. It may also be based on the data generated by the established environment and traffic sensor data platform. The data may have a relationship with its source. The data may also have a relationship with the public institutions that process the data, and the relationship may also be established based on the data.
[0077] Alternatively, the public's opinions and demand data on urban events, public services, etc. can be collected on social media platforms. It can also be based on data related to urban infrastructure: such as transportation, water, electricity, gas, communications, etc. It can also be economic indicators, statistical data, etc.
[0078] In some embodiments, sources of city-level data are determined, such as databases, social media platforms, policy documents, news reports, social media, etc.
[0079] In this embodiment, city-level data can be obtained by using crawler technology, calling API interfaces, etc. The amount of city-level data obtained can be obtained in batches, at intervals, or in real time.
[0080] In this embodiment, the data governance method may include removing duplicate items from the data, processing missing values in the data, correcting errors in the data set, and processing in a unified format, etc., to ensure data consistency. The cleaned data set is stored in a database.
[0081] S102: Using a preset feature extraction method, extract text features from various types of data after data management.
[0082] In some embodiments, the preset feature extraction method adopts the Word2Vec word embedding method and a word vector representation method based on deep learning.
[0083] Specifically, the method of this embodiment converts words in text features into low-dimensional real number vectors, which can effectively capture the semantic information of words. By performing word segmentation on the text in various types of data, and then using a pre-trained word vector model to convert each word into a vector representation, and then performing an aggregation operation on all word vectors in the text features, a feature vector of the entire text feature is obtained.
[0084] For example, after data governance, various types of data are processed by word segmentation and part-of-speech tagging to identify text features in the text. Using NER named entity recognition technology, entities such as names of people, places, institutions, time, and events are identified from the text.
[0085] Based on the preset feature extraction method, the relationship between entities is extracted from the text, such as the source of the data, the target of the data, the place where the data occurs, or the processing department.
[0086] S103: Identify entities in text features;
[0087] In some embodiments, the entity recognition process may adopt a named entity recognition method based on deep learning, that is, a model structure using a bidirectional long short-term memory network (BiLSTM) combined with a conditional random field (CRF).
[0088] Specifically, the data text after data governance is completed is preprocessed first, including word segmentation, part of speech marking, etc.
[0089] Then, each word in the text is input into the BiLSTM network. BiLSTM can learn the context information of the word and output the feature representation of each word.
[0090] Finally, the output of BiLSTM is input into the CRF layer. CRF can take into account the label constraints in named entity recognition and accurately predict the entities in the text.
[0091] S104: Extract the relationship between entities in the text features and set the task of binary or multi-element relationship extraction; encode the text fragments containing entities, and use the deep learning model to automatically learn the semantic features and relationship patterns in the text features.
[0092] In some embodiments, in the process of relation extraction, a relation extraction method based on deep learning is adopted, that is, a model using a convolutional neural network (CNN) architecture. First, a task of binary or multi-element relation extraction is set. Then, the text fragment containing the entity is encoded, and the semantic features and relation patterns in the text are automatically learned using a deep learning model.
[0093] S105: Store the identified entities and the relationships between the extracted entities in a graph database to form an initial knowledge graph.
[0094] In this embodiment, the initial knowledge graph is constructed using graph database technology, and the specific steps include:
[0095] After preparing the data and completing the data collection and data governance work in various fields of urban operation and management, the text features in the data are extracted, the entities in the text features are identified, and the relationships between the entities are extracted.
[0096] Design the data model and create corresponding node labels and relationship types in the graph database Neo4j according to the entity types and relationship types in the knowledge graph. Import data and use python scripts to import the identified entities and extracted relationships into the graph database in the csv format supported by the graph database.
[0097] Set attributes and indexes, verify and adjust, and after importing data, verify the initial knowledge graph to check the completeness and accuracy of the knowledge graph.
[0098] It should be noted that the integrity of the knowledge graph means that the knowledge graph covers all important entities and relationships in data in various fields of urban operation and management. Consistency means that the relationships in the knowledge graph conform to business logic and rules, and maintain consistent performance in different queries and usage scenarios.
[0099] In some embodiments, a Neo4j graph database or a JanusGraph graph database may be selected to store entity and relationship data. The identified entities and extracted relationships are imported into the graph database in the form of a graph, with each entity as a node and the relationship as an edge. The data in the graph database is indexed and optimized to improve query efficiency.
[0100] It can be seen that the graph database of this embodiment can intuitively represent the relationship between entities, which is convenient for subsequent knowledge reasoning and query. The construction of the initial knowledge graph provides a basic framework for subsequent knowledge reasoning and graph updating.
[0101] S106: Use the preset knowledge reasoning engine to generate new entities and relationships corresponding to the data in various fields after governance.
[0102] In this embodiment, the knowledge reasoning engine identifies implicit relationships between entities based on the entity relationship data of the initial knowledge graph; based on the adaptive evolutionary learning strategy, the knowledge graph is inferred to identify implicit relationships between entities and fill in knowledge gaps.
[0103] In some embodiments, data from various fields are integrated and new entities and relationships are generated using a knowledge reasoning engine. The newly generated entities and relationships are evaluated to ensure accuracy and credibility.
[0104] This embodiment can discover implicit entities and relationships that are not directly extracted through knowledge reasoning, enriching the content of the knowledge graph and improving the completeness and accuracy of the knowledge graph.
[0105] S107: Update the initial knowledge graph based on the new entities and relationships to obtain a city-level data knowledge graph.
[0106] In some embodiments, newly generated entities and relationships can be added to the initial knowledge graph to update the graph database. This embodiment can also use visualization tools to display the city-level data knowledge graph for easy analysis and use. It provides strong support for urban planning, public services and other fields.
[0107] In one embodiment of the present invention, the city-level data knowledge graph is also updated to meet the needs of use, such as Figure 2 As shown, a possible example is given below to illustrate its specific implementation scheme in a non-limiting manner.
[0108] S201: Collecting new data in various fields of urban operation management in real time, and performing data management on the new data;
[0109] S202: using the feature extraction method to extract text features from various newly added data after data management is completed as newly added text features;
[0110] S203: Identify entities in the newly added text features;
[0111] S204: extracting the relationship between entities in the newly added text features;
[0112] S205: adding the entities in the identified newly added text features and the relationships between the entities in the extracted newly added text features to the city-level data knowledge graph to obtain a first knowledge graph;
[0113] S206: Using the knowledge reasoning engine, generate new entities and relationships corresponding to various types of newly added data after data governance is completed;
[0114] S207: Update the first knowledge graph based on the new entities and relationships corresponding to the various types of newly added data to obtain an updated city-level data knowledge graph.
[0115] This embodiment stores the text features and entity relationships of newly generated data in various fields into the knowledge graph, and updates the data and entities of the knowledge graph.
[0116] It can be seen that this embodiment uses the knowledge reasoning engine to generate new entities and relationships corresponding to various types of newly added data after data governance is completed, and updates the first knowledge graph based on the new entities and relationships corresponding to various types of newly added data to obtain an updated city-level data knowledge graph. Based on data processing, knowledge extraction, knowledge fusion and reasoning technology, the quality and practicality of the knowledge graph can be improved.
[0117] In the knowledge reasoning and relationship generation method involved in this embodiment, the correctness of the candidate relationship is verified based on the implicit relationship generated by the evolutionary learning knowledge reasoning in the knowledge reasoning engine; the verified relationship is added to the knowledge graph to achieve dynamic expansion and optimization of the knowledge graph.
[0118] The candidate relationships involved in this embodiment are potential relationships that are derived in different ways and are waiting to be confirmed, including relationships inferred using heuristic rules and relationships predicted using machine learning algorithms on unlabeled data.
[0119] The specific steps for verifying the correctness of the candidate relationship include the following:
[0120] First, evidence data related to the candidate relationship is collected; then, features that can be used to verify the candidate relationship are extracted from the collected data.
[0121] Secondly, use the trained machine learning-based model to classify and judge the candidate relationships; use a portion of known correct or incorrect relationship data to evaluate the verification model and determine the verification model.
[0122] Finally, the candidate relationship is input into the verification model. If the candidate relationship is judged to be correct, it passes the verification; otherwise, it fails the verification.
[0123] Furthermore, the verified relationship is added to the knowledge graph, which specifically includes the following steps:
[0124] Search by entity name to identify entities related to the new relationship in the knowledge graph; then, use Python to add verified relationships between the identified entities to the Neo4j graph database. After adding the relationship, perform a consistency check on the knowledge graph to ensure that the addition of the new relationship does not cause contradictions or inconsistencies in the knowledge graph. Update the index of the Neo4j graph database to ensure that the newly added relationship and related entities can be quickly queried; record the addition of the new relationship.
[0125] According to the knowledge reasoning and relationship generation method involved in this embodiment, the knowledge reasoning engine identifies implicit relationships between entities based on the entity relationship data of the initial knowledge graph; based on the adaptive evolutionary learning strategy, the knowledge graph is reasoned to identify implicit relationships between entities and fill knowledge gaps.
[0126] More specifically, the specific training steps of the knowledge reasoning engine are:
[0127] S501: Initialization: Randomly initialize the weights and biases of R-GCN and randomly generate chromosomes of the initial population of the genetic algorithm.
[0128] S502: R-GCN training: Use the training set to train R-GCN, input the entity and relationship data in the training set into R-GCN, and update the parameters of R-GCN through the back propagation algorithm to minimize the cross entropy loss function.
[0129] S503: Genetic algorithm optimization: Use genetic algorithm to optimize the parameters of R-GCN. On the basis of R-GCN training, encode the parameters of R-GCN into chromosomes, use fitness function to evaluate the quality of genetic algorithm chromosomes, and generate new chromosomes through genetic operations (selection, crossover, mutation), that is, new R-GCN parameter combinations.
[0130] S504: Iterative training: Repeat steps S502 and S503 for multiple iterations until the preset number of iterations is reached, the loss function converges, or the performance on the validation set no longer improves, then stop.
[0131] S505: Model evaluation: Use the test set to evaluate the trained knowledge reasoning engine, calculate the accuracy, recall, F1 value and other indicators of the model on the test set, and evaluate the performance of the model.
[0132] S506: Model adjustment: According to the evaluation results, the structure, parameters, and training strategies of the model are adjusted and optimized to improve the performance of the model.
[0133] Further, as a refinement and expansion of the specific implementation methods of the above-mentioned embodiments, in order to fully illustrate the specific implementation process in this embodiment, in the knowledge reasoning and relationship generation method provided below, a basic knowledge graph is provided to the knowledge reasoning engine, that is, the initial knowledge graph formed by the relationship generation module. The knowledge reasoning engine identifies the implicit relationships between entities based on the entity relationship data of the initial knowledge graph. Based on the adaptive evolutionary learning strategy, the knowledge graph is reasoned to identify the implicit relationships between entities and fill the knowledge gaps; the evolutionary algorithm (genetic algorithm) and the deep learning model (Relational graph convolutional network, R-GCN) are combined to optimize the relationship prediction model and improve the reasoning accuracy.
[0134] Specifically, the constructed knowledge reasoning engine model structure is as follows:
[0135] Input layer: Receives entity and relationship data in the knowledge graph as input, uses Word2Vec word embedding technology to encode entities and relationships, and converts them into vector representations.
[0136] R-GCN layer: Use R-GCN to perform convolution operations on the nodes (entities) and edges (relationships) in the knowledge graph, extract the feature representation of the nodes, and obtain the feature representation of each node by aggregating the features of its neighboring nodes.
[0137] Output layer: Use a fully connected layer to transform the features extracted by R-GCN into the final output, thereby predicting the implicit relationship between entities in the knowledge graph.
[0138] Genetic algorithm module: The performance indicators (accuracy and recall) of R-GCN are used as the fitness function of the genetic algorithm. Through operations such as selection, crossover and mutation, the hyperparameters of R-GCN are optimized and the R-GCN model configuration is updated to improve the performance of the model.
[0139] The method for constructing the model training set corresponding to the knowledge reasoning engine in this embodiment includes the following steps:
[0140] Collect a large amount of data in various fields of urban operation and management, and ensure that the data covers different fields and different types of operation and management activities and relationships.
[0141] The collected data is annotated manually and with the assistance of semi-automatic annotation tools to identify the entities and the relationships between them.
[0142] The labeled data set is divided into training set, validation set and test set in the ratio of 70%, 20% and 10% respectively; finally, the entity and relationship data in the training set are preprocessed by entity encoding and relationship encoding to make them meet the input requirements of the model.
[0143] As an implementation of the present application, the knowledge reasoning and relationship generation method further includes the following steps:
[0144] S301: Collect and obtain data in various fields.
[0145] S302: Identify and parse the text features of data in various fields, parse the relationship between text features and entities based on the current feature relationship rules, and form an initial knowledge graph.
[0146] S303: Acquire the knowledge reasoning engine, generate new text features and entity relationships, and update the knowledge graph.
[0147] This embodiment can adopt an incremental learning method to receive the output data of the knowledge reasoning engine, generate new text features and entity relationships, update the knowledge graph, and realize dynamic expansion of the knowledge graph.
[0148] This embodiment also verifies the implicit relationships of the knowledge graph and adds the verified implicit relationships to the knowledge graph.
[0149] S304: Generate implicit relationships of the knowledge graph based on the evolutionary learning knowledge in the knowledge inference engine;
[0150] S305: Based on the adaptive evolutionary learning strategy, the knowledge graph is inferred to identify the implicit relationships between entities and fill in the blank relationships between knowledge graphs.
[0151] Exemplarily, the knowledge reasoning engine may include entity classification and link prediction through R-GCN to model a multi-relational graph network.
[0152] Then, link prediction is performed. Here, the entity representation learned by R-GCN can be used, and then combined with the knowledge graph representation learning method to jointly learn the embedded representation of entities and relationships, and the possibility of a triple being established is evaluated through a scoring function.
[0153] In the knowledge reasoning engine of this embodiment, in order to identify the implicit relationship between entities, a genetic algorithm with an adaptive evolutionary learning strategy is adopted to tune the hyperparameters in the relationship graph convolutional network and optimize the implicit relationship prediction model, thereby improving the accuracy of knowledge reasoning.
[0154] Among them, the crossover probability P of the adaptive evolutionary learning strategy c and mutation probability P m The calculation formula is as follows:
[0155]
[0156] Among them, f max ——The maximum fitness value in the group;
[0157] f avg ——The average fitness value of the group;
[0158] f——the larger fitness value of the two individuals to be crossed;
[0159] f'——the fitness value of the individual to be crossed;
[0160] k1, k2, k3 and k4 are constants.
[0161] According to an embodiment of the present application, the global search capability of the evolutionary algorithm and the feature extraction capability of the deep learning model are utilized to automatically mine and generate potential complex relationships between entities in the knowledge graph.
[0162] The intelligent reasoning engine involved in this embodiment can reason about the knowledge graph based on the results of evolutionary learning, identify and supplement the complex relationships implicit between entities. The development dynamic update strategy of this embodiment includes incremental learning and real-time monitoring systems to ensure that the knowledge graph can quickly respond to changes in policies and services.
[0163] The knowledge reasoning and relationship generation method provided in this embodiment can provide intelligent question-answering services based on the updated knowledge graph to answer users' questions about policies, services, etc., and improve the intelligence level of city-level data services. Combining semantic understanding and dialogue management technology, natural language interaction is achieved to provide accurate policy interpretation and service guidance.
[0164] This embodiment regularly evaluates the system performance used by the knowledge reasoning and relationship generation method, including indicators such as the coverage, accuracy, and update speed of the knowledge graph; based on the evaluation results, the algorithm parameters are continuously adjusted and optimized to improve the overall performance of the system.
[0165] Specifically, the performance evaluation method based on indicators includes the following steps:
[0166] Determine the appropriate evaluation cycle based on the update and collection frequency of different data.
[0167] During the evaluation cycle, evaluation data related to the knowledge graph is collected. Based on the collected data, the coverage, accuracy, and update speed of the knowledge graph are calculated.
[0168] Analyze the calculated indicator values to understand the performance of the knowledge graph in different aspects; finally, adjust the corresponding data processing methods and algorithm parameters based on the results of the indicator analysis.
[0169] For example, if the coverage is low, increase the data sources, optimize the data governance and feature extraction methods; if the accuracy is not high, adjust the parameters of the knowledge reasoning engine, increase the training data or improve the algorithm model; if the update speed is slow, optimize the update process of the knowledge graph and improve the data processing efficiency.
[0170] The coverage, accuracy and update speed of the knowledge graph of this embodiment are calculated based on the following method.
[0171] The coverage of the city-level data knowledge graph is calculated as follows:
[0172]
[0173] K entity ——The number of entities covered in the city-level data knowledge graph;
[0174] K relation ——The number of relationships covered in the city-level data knowledge graph;
[0175] T entity ——The actual number of entities that should be included in the city-level data knowledge graph;
[0176] T relation——The actual number of relationships that should be included in the city-level data knowledge graph;
[0177] The accuracy of the city-level data knowledge graph is calculated as follows:
[0178]
[0179] R entity ——The correct number of entities in the city-level data knowledge graph;
[0180] R relation ——The correct number of relationships in the knowledge graph of city-level data;
[0181] K entity ——The number of entities covered in the city-level data knowledge graph;
[0182] K relation ——The number of relationships covered in the city-level data knowledge graph;
[0183] The update speed of the city-level data knowledge graph is calculated as follows:
[0184]
[0185] N – the number of entities and relationships updated in a certain period of time;
[0186] t – a specific period of time.
[0187] This embodiment integrates the collected data into the model in an incremental manner and adjusts the model parameters to adapt to the new data. According to the use requirements of the data, the performance of the model is evaluated regularly using a validation set or a test set to ensure that the model does not lose the original knowledge while absorbing new knowledge.
[0188] In this embodiment, when updating the knowledge graph, entities and relationships can be updated synchronously, that is, new knowledge, new entities, and new relationships learned by the model are added to the knowledge graph. The updated knowledge graph is verified to ensure the accuracy and consistency of the graph. It ensures that the knowledge graph can reflect the latest knowledge and information. It can gradually absorb new knowledge while retaining the original knowledge, reducing errors caused by data updates.
[0189] The following is an embodiment of the knowledge reasoning and relationship generation system provided by the embodiments of the present disclosure. The system and the knowledge reasoning and relationship generation methods of the above-mentioned embodiments belong to the same inventive concept. For details not described in detail in the embodiments of the knowledge reasoning and relationship generation system, please refer to the embodiments of the above-mentioned knowledge reasoning and relationship generation methods.
[0190] A mobile terminal implementing various embodiments of the present invention will now be described with reference to the accompanying drawings. In the subsequent description, suffixes such as "module", "component" or "unit" used to represent elements are used only to facilitate the description of the embodiments of the present invention and have no specific meaning in themselves. Therefore, "module" and "component" can be used interchangeably.
[0191] like Figure 3 As shown, the system includes:
[0192] Data collection module, used to collect data in various fields of urban operation and management, and to manage the collected data;
[0193] The feature extraction module is used to extract text features from various types of data after data management using a preset feature extraction method;
[0194] Entity recognition module, used to identify entities in text features;
[0195] The extraction learning module is used to extract the relationship between entities in text features and set the task of binary or multi-element relationship extraction; encode the text fragments containing entities and use the deep learning model to automatically learn the semantic features and relationship patterns in the text features;
[0196] A graph configuration module is used to store the identified entities and the relationships between the extracted entities into a graph database to form an initial knowledge graph;
[0197] The data generation module is used to use the preset knowledge reasoning engine to generate new entities and relationships corresponding to the data in various fields after governance;
[0198] The graph updating module is used to update the initial knowledge graph based on new entities and relationships to obtain a city-level data knowledge graph.
[0199] In an exemplary embodiment, the collection and acquisition module can also implement the following two functions:
[0200] (1) Collect and conduct basic data management on data from various fields in the data aggregation platform.
[0201] (2) After completing data governance, natural language processing (NLP) technology and machine learning algorithms are used to extract features from texts of various types of data to provide raw data for subsequent knowledge graph construction.
[0202] The relationship generation module of this embodiment also involves the following functions:
[0203] Identify entities in the text, such as policies, services, institutions, individuals, etc., based on text features; extract the relationships between entities from text features based on known patterns or rules; store entities and relationships in the graph database of the knowledge graph management module to form an initial knowledge graph.
[0204] Receive the output of the knowledge reasoning engine, generate new entity relationships, update the knowledge graph, and realize dynamic expansion of the knowledge graph; adopt incremental learning methods to continuously absorb new knowledge, avoid cold start problems, and ensure the timeliness and accuracy of the knowledge graph.
[0205] According to the implicit relations generated by the evolutionary learning knowledge reasoning in the knowledge reasoning engine, the correctness of the candidate relations is verified; the verified relations are added to the knowledge graph to realize the dynamic expansion and optimization of the knowledge graph.
[0206] As a preferred method of this embodiment, the system also includes a knowledge graph management module and an intelligent question and answer module.
[0207] In this embodiment, the knowledge graph management module can use graph database technology to build and maintain the knowledge graph, including entity registration, relationship management, version control and other functions to ensure the integrity and consistency of the knowledge graph.
[0208] The knowledge graph management module also provides the basic knowledge graph to the knowledge reasoning engine, namely the initial knowledge graph formed by the relationship generation module.
[0209] The knowledge reasoning engine in this embodiment can identify implicit relationships between entities based on the entity relationship data of the initial knowledge graph. Based on the adaptive evolutionary learning strategy, the knowledge graph is reasoned to identify implicit relationships between entities and fill in knowledge gaps.
[0210] It should be noted that this embodiment combines an evolutionary algorithm (genetic algorithm) with a deep learning model (relational graph convolutional network, R-GCN) to optimize the relationship prediction model and improve the reasoning accuracy.
[0211] As an example of this embodiment, the intelligent question and answer module can provide intelligent question and answer services based on the updated knowledge graph to answer users' questions about policies, services, etc., and improve the intelligence level of city-level data services.
[0212] The intelligent question-and-answer module combines semantic understanding and dialogue management technology to achieve natural language interaction and provide accurate policy interpretation and service guidance.
[0213] Regularly evaluate system performance, including indicators such as knowledge graph coverage, accuracy, and update speed; based on the evaluation results, continuously adjust and optimize algorithm parameters to improve the overall performance of the system.
[0214] It can be seen that the intelligent question and answer module provides cross-departmental question and answer tools for business personnel in various departments, so that they can understand policy trends efficiently and conveniently; it provides business processing auxiliary tools for business processing personnel to optimize business processes and improve work efficiency.
[0215] The following is the electronic device provided by this embodiment: Figure 4 A schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention.
[0216] The electronic device 500 includes, but is not limited to, components such as a processor 501, a network module 502, an audio output unit 503, an input unit 504, a display unit 506, a user input unit 507, an interface unit 508, and a memory 509. Those skilled in the art will appreciate that the electronic device structure involved in the embodiments of the present invention does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0217] In embodiments of the present invention, electronic devices include, but are not limited to, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices may 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 embodiments of the present application described and / or required herein.
[0218] In the embodiment of the present application, the processor 501 can be implemented by using at least one of an application-specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a processor, a controller, a microcontroller, a microprocessor, and an electronic unit designed to perform the functions described herein. In some cases, such an implementation can be implemented in a controller. For software implementation, implementations such as processes or functions can be implemented with separate software modules that allow execution of at least one function or operation. The software code can be implemented by a software application (or program) written in any appropriate programming language, and the software code can be stored in a memory and executed by a controller.
[0219] The processor 501 provides the user with wireless Internet access through the network module 502, thereby realizing the transmission and communication of data information in this application.
[0220] The audio output unit 503 may provide audio output related to a specific function executed by the processor 501. The audio output unit 503 includes a speaker, a buzzer, a receiver, and the like.
[0221] The input unit 504 is used to receive audio or video signals.
[0222] The display unit 506 is used to display information input by the user or information provided to the user. The display unit 506 may include a display panel, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc.
[0223] The user input unit 507 may include, but is not limited to, a physical keyboard, a function key (such as a volume control key, a switch key, etc.), a trackball, a mouse, and a joystick, which will not be described in detail here.
[0224] The interface unit 508 is an interface for connecting an external device to the electronic device 500. The memory 509 can be used to store software programs and various data. The memory 509 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0225] In addition, the electronic device 500 includes some functional modules not shown, which will not be described in detail here.
[0226] In an embodiment of the present invention, computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as a separate software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or power server. In cases involving remote computers, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (exemplarily using an Internet service provider to connect via the Internet).
[0227] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0228] Those skilled in the art will appreciate that the various aspects of the knowledge reasoning and relationship generation system involved in this application can be implemented as a method or program product. Therefore, various aspects of the present disclosure can be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software aspects, which can be collectively referred to as "circuit", "module" or "system" here.
[0229] In the storage medium provided in the present application, the storage medium stores the method steps included in the knowledge reasoning and relationship generation method.
[0230] The specific storage steps include but are not limited to: collecting and acquiring urban operation management data; identifying and parsing text features of urban operation management data, parsing the relationship between text features and entities based on current feature relationship rules, and forming an initial knowledge graph; acquiring a knowledge reasoning engine, generating new text feature and entity relationships, and updating the knowledge graph; generating implicit relationships of the knowledge graph based on evolutionary learning knowledge reasoning in the knowledge reasoning engine; reasoning on the knowledge graph based on an adaptive evolutionary learning strategy, identifying implicit relationships between entities, and filling in blank relationships between knowledge graphs.
[0231] The storage medium of the present embodiment can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0232] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A knowledge reasoning and relationship generation method, characterized in that: Methods include: S101: Collect data in various fields of urban operation and management, and conduct data governance on the collected data; S102: Using a preset feature extraction method to extract text features from various types of data after data management; S103: Identify entities in text features; S104: extracting the relationship between entities in the text features and setting the task of binary or multi-element relationship extraction; encoding the text fragments containing the entities and automatically learning the semantic features and relationship patterns in the text features using a deep learning model; S105: storing the identified entities and the relationships between the extracted entities in a graph database to form an initial knowledge graph; S106: Using the preset knowledge reasoning engine, generate new entities and relationships corresponding to the data in various fields after governance; S107: Update the initial knowledge graph based on the new entities and relationships to obtain a city-level data knowledge graph.
2. The knowledge reasoning and relationship generation method according to claim 1, characterized in that: The method also includes updating the city-level data knowledge graph; S201: Collecting new data in various fields of urban operation management in real time, and performing data management on the new data; S202: using the feature extraction method to extract text features from various newly added data after data management is completed as newly added text features; S203: Identify entities in the newly added text features; S204: extracting the relationship between entities in the newly added text features; S205: adding the entities in the identified newly added text features and the relationships between the entities in the extracted newly added text features to the city-level data knowledge graph to obtain a first knowledge graph; S206: Using the knowledge reasoning engine, generate new entities and relationships corresponding to various types of newly added data after data governance is completed; S207: Update the first knowledge graph with the new entities and relationships corresponding to the various types of newly added data to obtain an updated city-level data knowledge graph.
3. The knowledge reasoning and relationship generation method according to claim 1 or 2, characterized in that: Step S103 also includes: Preprocess text features; Input each word in the text feature into the BiLSTM network, learn the context information of the word, and output the feature representation of each word; The output of the BiLSTM network is input into the CRF layer. The CRF layer identifies the label constraint relationship based on the named entity and predicts the entity in the text feature.
4. The knowledge reasoning and relationship generation method according to claim 1 or 2, characterized in that: Step S105 also includes: constructing an initial knowledge graph using graph database technology, and the specific steps include: Prepare data. After completing the data collection and data governance work in various fields of urban operation and management, extract text features from the data, identify entities in the text features, and extract the relationships between entities; Create node labels and relationship types in the graph database based on the entity types and relationship types in the knowledge graph; Use Python scripts to import entities and extracted relationships into the graph database in CSV format supported by the graph database. Set attributes and indexes to verify the initial knowledge graph.
5. The knowledge reasoning and relationship generation method according to claim 1 or 2, characterized in that: In step S106, the knowledge reasoning engine identifies implicit relationships between entities based on the entity relationship data of the initial knowledge graph; Based on the adaptive evolutionary learning strategy, the knowledge graph is inferred to identify the implicit relationships between entities and fill the knowledge gaps.
6. The knowledge reasoning and relationship generation method according to claim 1 or 2, characterized in that: Collect evaluation data related to the city-level data knowledge graph based on the update frequency of data in each field; Based on the collected evaluation data, the coverage, accuracy and update speed values of the city-level data knowledge graph are evaluated.
7. The knowledge reasoning and relationship generation method according to claim 6, characterized in that: The coverage of the city-level data knowledge graph is calculated as follows: K entity ——The number of entities covered in the city-level data knowledge graph; K relation ——The number of relationships covered in the city-level data knowledge graph; T entity ——The actual number of entities that should be included in the city-level data knowledge graph; T relation ——The actual number of relationships that should be included in the city-level data knowledge graph; The accuracy of the city-level data knowledge graph is calculated as follows: R entity ——The correct number of entities in the city-level data knowledge graph; R relation ——The correct number of relationships in the knowledge graph of city-level data; K entity ——The number of entities covered in the city-level data knowledge graph; K relation ——The number of relationships covered in the city-level data knowledge graph; The update speed of the city-level data knowledge graph is calculated as follows: N – the number of entities and relationships updated in a certain period of time; t – a specific period of time.
8. A knowledge reasoning and relationship generation system, characterized in that: The system is used to implement the knowledge reasoning and relationship generation method as described in any one of claims 1 to 7; The system includes: Data collection module, used to collect data in various fields of urban operation and management, and to manage the collected data; The feature extraction module is used to extract text features from various types of data after data management using a preset feature extraction method; Entity recognition module, used to identify entities in text features; The extraction learning module is used to extract the relationship between entities in text features and set the task of binary or multi-element relationship extraction; encode the text fragments containing entities and use the deep learning model to automatically learn the semantic features and relationship patterns in the text features; A graph configuration module is used to store the identified entities and the relationships between the extracted entities into a graph database to form an initial knowledge graph; The data generation module is used to use the preset knowledge reasoning engine to generate new entities and relationships corresponding to the data in various fields after governance; The graph updating module is used to update the initial knowledge graph based on new entities and relationships to obtain a city-level data knowledge graph.
9. 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 the knowledge reasoning and relationship generation method as described in any one of claims 1 to 7 are implemented.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the knowledge reasoning and relationship generation method as claimed in any one of claims 1 to 7 are implemented.