Construction method of knowledge graph system based on scientific and technological innovation service of research institutions
By constructing a knowledge graph system based on the Bert-GCN+Qlearning-Transformer model, the problem of insufficient query and retrieval of knowledge graphs in innovation services of R&D institutions in existing technologies is solved. It realizes entity recognition, relation extraction and entity disambiguation, improves knowledge storage and visualization capabilities, and provides intelligent decision support.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHUHAI INST OF ADVANCED TECH CO LTD
- Filing Date
- 2023-07-14
- Publication Date
- 2026-04-17
AI Technical Summary
Existing knowledge graphs cannot fully leverage their query and retrieval advantages in innovative services provided by R&D institutions, and they are difficult to effectively perform entity recognition, relationship extraction, and entity disambiguation, thus failing to meet the needs of knowledge storage and visualization.
A knowledge graph of scientific and technological innovation services of R&D institutions is constructed using the Bert-GCN+Qlearning-Transformer model. Through data collection and cleaning, entity recognition, relation extraction and entity disambiguation are performed using the Bert-GCN+Qlearning-Transformer model, and knowledge storage and visualization are performed using a NoSQL database.
It improves entity recognition, relation extraction, and entity disambiguation tasks, enhances the query and retrieval capabilities of the knowledge graph, and uses Neo4J for knowledge storage and visualization, constructing a knowledge graph for vertical fields to provide intelligent decision-making services for R&D institutions.
Smart Images

Figure CN116992042B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent decision-making, and in particular to a method for constructing a knowledge graph system based on scientific and technological innovation services of research and development institutions. Background Technology
[0002] Knowledge graphs, also known as scientific knowledge graphs, are a concept in the field of library and information science. They are used to draw, analyze, and display the interrelationships between disciplines or academic research subjects. They are visualization tools that reveal the development process and structural relationships of scientific knowledge. In most cases, knowledge graphs are visualized using a graph structure, with nodes representing authors, academic institutions, scientific documents, or keywords, and lines representing the relationships between nodes. Commonly used tools for drawing knowledge graphs include CiteSpace, Ucinet, Gephi, and Bibexcel.
[0003] When knowledge graphs are used to provide innovative services to R&D institutions, they can provide intelligent decision-making services, but they cannot fully leverage the advantages of knowledge graphs in querying and retrieval. At the same time, they cannot effectively address and improve the performance indicators of entity recognition, relationship extraction, entity disambiguation tasks, knowledge storage, and knowledge graph visualization.
[0004] Therefore, it is necessary to propose a method for constructing a knowledge graph system for scientific and technological innovation services of R&D institutions to solve the above problems. Summary of the Invention
[0005] The main objective of this invention is to provide a method for constructing a knowledge graph system based on scientific and technological innovation services of R&D institutions, which can effectively solve the problems in the background technology.
[0006] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0007] The construction method of the knowledge graph system for scientific and technological innovation services of R&D institutions includes the following construction steps:
[0008] S1: Data Collection and Cleaning: Data collection can be conducted through interviews and questionnaires, gathering real-world data across 12 dimensions, including departments, staff, technical fields, publications, patents, medical device certificates, vertical projects, vertical collaborations, and horizontal collaborations within the relevant research institute. Data cleaning includes: handling duplicate values, handling missing values, and standardization. Specifically, for duplicate value handling, only the first record of each duplicate is retained. For missing value handling, empty attribute values are filled using the hyphen "-". For standardization, due to different recording methods, data of the same type may be collected; standardization primarily involves papers... Journal quartile consistency, paper data consistency, and journal data consistency: For journal quartiles, the following consistency rules apply. When a paper has multiple quartile types, they are written in ascending order, separated by commas ("," in English). For example, "JCR1," "JCR2, 1," and "JCR1, 2," but the valid data is "JCR1," "JCR1, 2." During consistency, the abnormal data "JCR2, 1" is replaced with "JCR1, 2." In the consistency of paper data and talent data, if multiple technical field keywords exist, they are separated by commas (","" in English).
[0009] S2: Bert-GCN+Qlearning-Transformer Model Construction: Includes the Bert-GCN+Qlearning-Transformer model, which extracts structured triples from text, namely topic-relation-object, without relying on predefined schemas or ontology. Open information extraction often employs key information extraction technologies, including identifying and extracting structured information from unstructured or semi-structured data sources. This includes the following steps:
[0010] A: Input encoding: The input sentence is tokenized and encoded using word embeddings or subword embeddings, which capture semantic and contextual information about the words in the sentence;
[0011] B: Sentence encoding: The encoded tokens are used by a neural network, such as an RNN or a transformer-based model, to generate a fixed-size sentence representation. The neural network takes into account the contextual dependencies of the tokens and processes the tokens sequentially or in parallel.
[0012] C: Relationship Extraction: Sentence representations are used to predict the relationships between entities in a sentence. This can be accomplished using various techniques, such as binary classification or sequence tagging. The model identifies the spans that represent entities in a sentence and predicts the relationships between them.
[0013] D: Triple Generation: Based on the identified entity span and predicted relationship, the model generates OpenIE triples in the form of triples, which represent structured information extracted from the input sentence;
[0014] E: Post-processing: The generated triples may undergo post-processing steps to refine and standardize the extracted information, including handling coreference resolution, entity disambiguation, or merging similar relationships to reduce redundancy. However, due to the complexity of the deep learning open information extraction model itself, the space and time complexity of the deep learning framework required for knowledge extraction varies for different texts. This reduces prediction errors in the knowledge process and lowers resource requirements.
[0015] S3: Verification of the advancement of the Bert-GCN+Qlearning-Transformer model based on a public dataset: To select a deep learning model for information extraction, comparative experiments were conducted on CRF, BILSTM, BILSTM+CRF, BERT+GCN+CRF, BERT+LSTM+CRF, Bert+LSTM+Transformer, Bert+GCN+Transformer, and Bert-GCN+Qlearning-Transformer. The ResumeNER dataset, a large open-source Chinese data tagging corpus, was used for training. ResumeNER includes seven categories: name, nationality, place of origin, major, degree, institution, and professional title. The model was trained based on this comparison to determine the overall basic model structure.
[0016] S4: Construction of a Knowledge Graph for Technological Innovation Services of R&D Institutions: Based on the Bert-GCN+Qlearning-Transformer model, entity recognition, relation extraction, and entity disambiguation are achieved to establish a knowledge graph for technological innovation services of R&D institutions, which includes:
[0017] (1): Entity Recognition Deep Learning Model Based on BERT-GCN+Qlearning-Transformer: The BERT-GCN+Qlearning-transformer model is adopted to realize entity recognition of unstructured data. Among them, NER focuses on recognizing and classifying named entities in text, such as names, places, organizations, etc., with the goal of extracting specific entity mentions from text. The combination of the three can leverage the advantages of individual models to improve the performance of relation extraction tasks. The BERT model is pre-trained on a large amount of unlabeled text data and then fine-tuned on specific downstream tasks. GCN is a deep learning model for graph structure data. In the context of NER, words or tokens in a sentence can be viewed as nodes in a graph. GCN can be used to capture the dependencies and relationships between these nodes. By incorporating GCN into the model architecture, the model can leverage the structural information of the sentence to improve entity recognition. Transformer is a self-attention-based neural network architecture that has been proven effective in various NLP tasks. The architecture is a key component of models such as BERT, allowing the model to capture contextual information and dependencies between words in a sentence. A model can be created based on this by combining BERT-GCN + Qlearning-transformer.
[0018] (2): Relation extraction deep learning model based on BERT-GCN+Qlearning-Transformer: The combination of BERT-GCN+Qlearning-transformer model is applied to relation extraction. It can also take advantage of the advantages of a single model to improve the performance of relation extraction tasks. The pre-trained language model of BERT is used to capture contextualized word representations. BERT is used to encode the input text and obtain rich word embeddings to capture the semantic and contextual information of words. By applying the GCN layer after BERT and using Qlearning to achieve parameter tuning, the sequence information can be modeled and the long-range dependencies in the encoded representation can be captured.
[0019] (3): Entity disambiguation deep learning model based on BERT-GCN+Qlearning-Transformer: The BERT+GCN+Transformer deep learning method is used to eliminate entity ambiguity, such as the ambiguous mention of "undergraduate", which refers to the academic qualification "undergraduate" or "undergraduate department". The model traverses the ambiguous words in the Chinese ambiguity dictionary database. BERT is used to encode the input text, GCN propagates information through graph structure, and the transformation layer captures global dependencies. The model is trained using cross-entropy loss and optimized using the Adam optimizer. The research steps include:
[0020] a: Matching entity mapping dictionary preparation: Build a labeled ambiguous dictionary dataset in which each mention is associated with its correct entity. For example, the mention of "undergraduate" can refer to the academic qualification "undergraduate" or "undergraduate department". Split the dataset into training set, validation set and test set;
[0021] b: Word embeddings: Words in the dataset are represented using word embeddings, and pre-trained BERT embeddings are used;
[0022] c: Using the GCN+QlearningTransformer neural network architecture constructed in steps a and b, a neural network architecture was designed as an entity disambiguation task. The input of this model will be word embeddings around the context of mentioning “undergraduate”.
[0023] d: Training: Using 10-fold classification cross-entropy and an optimizer to train the model, the neural network is trained on a labeled dataset. During training, the model learns to predict the correct entity given the mention context. The training data is traversed, and the parameters of the model are updated using backpropagation and the optimizer.
[0024] e: Evaluation: Evaluate the trained model on the validation set to assess its performance, and calculate evaluation metrics such as accuracy, precision, recall, or F1 score to measure disambiguation performance.
[0025] f: Inference: Once the model has been trained and evaluated, it can be used to eliminate entity ambiguity on new, unseen data. Given a new mention, the context surrounding the mention is fed into the trained model, which predicts the entity most likely to be mentioned based on learned patterns and associations. The predicted entity is compared with the live label to evaluate the model's accuracy. The specific implementations of BERT, GCN, Transformer, Q-learning components, data preprocessing, reward functions, exploration strategies, learning rates, discount factors, and evaluation metrics need to be customized according to specific needs.
[0026] The construction of the knowledge graph for the scientific and technological innovation services of the aforementioned R&D institution first imports the necessary libraries and implements it based on the PyTorch framework. It implements the proposed BERT-GCN+Qlearning-transformer model, including defining data classes, describing the three components of the dataset (texts, labels, and tokenizer), defining the BERT-GCN+Qlearning-transformer model structure (using BERT as the word vector model with an added GCN layer), defining relevant parameters (num_labels represents the number of relations), using Adam as the optimizer, cross-entropy as the loss function, and a learning rate of [missing value]. Define the Qlearning function for tuning the GCN parameter;
[0027] S5: Knowledge Graph Storage and Visualization for Technological Innovation Services in R&D Institutions: This section utilizes NoSQL (NoSQL) unstructured data storage tools for knowledge storage and implements knowledge graph visualization. Key aspects include selecting a NoSQL database, designing a data model, storing knowledge data, extracting data for visualization, visualizing the knowledge graph, configuring visualization settings, and knowledge graph interaction. Several NoSQL databases are available, such as MongoDB, Cassandra, Redis, and Neo4J. The data model design defines the structure of the knowledge data and designs the NoSQL storage mode. The knowledge data storage involves storing the knowledge data in the selected NoSQL database. The process involves converting knowledge data into an appropriate format and inserting it into a database using provided APIs or libraries. A mapping strategy is defined to transform the extracted data into a Neo4j-compatible graph structure, creating entity nodes, establishing relationships between entities, and assigning attributes to entities. Visualizing the knowledge graph utilizes Neo4j's visualization tools or third-party libraries, configuring visualization settings including node styles, relationship types, and layout algorithms to create an information-rich and visually appealing representation. Knowledge graph interaction enables interactive functionality, allowing users to explore and query the knowledge graph through visualization. Users can traverse the graph, expand nodes, view node details, and execute Cypher queries to retrieve specific information.
[0028] Beneficial effects
[0029] Compared with existing technologies, this invention provides a method for constructing a knowledge graph system for scientific and technological innovation services of R&D institutions, which has the following beneficial effects:
[0030] 1. This invention relates to a method for constructing a knowledge graph system for scientific and technological innovation services of R&D institutions. The method utilizes knowledge graphs to abstract the innovative service content of R&D institutions, providing a technical foundation for intelligent decision-making services and leveraging the advantages of knowledge graphs in querying and retrieval. Based on the theoretical and practical knowledge of scientific and technological innovation services of R&D institutions, it constructs entities, relationships, and attribute content of a vertical domain knowledge graph. Neo4J is used for knowledge storage and visualization. For entity recognition, relationship extraction, and entity disambiguation tasks, this invention achieves the construction of a knowledge graph for scientific and technological innovation services of R&D institutions, explores information extraction models, and conducts entity recognition, relationship extraction, entity disambiguation, knowledge storage, and knowledge graph visualization. BERT-GCN+Qlearning-Transformer is used to implement entity recognition, entity disambiguation, and relationship extraction tasks, and the graph database Neo4j is used for knowledge storage and visualization.
[0031] 2. This invention presents a method for constructing a knowledge graph system for scientific and technological innovation services in R&D institutions. The proposed BERT-GCN+Qlearning-Transformer model is an information extraction model that can extract information based on different downstream tasks. This model uses the BERT model to provide semantic output for the GCN layer, which then constructs the network structure. It combines this with the Qlearning algorithm for reinforcement learning, and finally performs sequence encoding using a Transformer. By combining the advantages of all three, it fully extracts text features. This model exhibits extremely high performance in tasks such as entity extraction, relation extraction, and entity disambiguation. Furthermore, in the knowledge graph construction process, it transforms unstructured knowledge into structured knowledge. In the knowledge graph extraction model, advanced domain models are explored, and the extraction model of this invention is proposed for knowledge graph construction. Attached Figure Description
[0032] Figure 1 This is a research roadmap for constructing a knowledge graph of scientific and technological innovation services based on R&D institutions, as described in this invention.
[0033] Figure 2 This is a structural diagram of the Bert-GCN+Qlearning-Transformer of this invention;
[0034] Figure 3 This is an overview diagram of the knowledge graph visualization of this invention;
[0035] Figure 4 This is a schematic diagram of the knowledge graph visualization structure transformation - circle of the present invention;
[0036] Figure 5This is a schematic diagram of the knowledge graph visualization display of the present invention - partial detail 1 - research and development institution;
[0037] Figure 6 This is the published image of the knowledge graph visualization display of this invention - partial detail 2 - paper;
[0038] Figure 7 This is a schematic diagram of the knowledge graph visualization display of the present invention - local detail 3 - degree.
[0039] In the text: Recurrent Neural Networks (RNN); Convolutional Neural Networks (CNNs); Graph Neural Networks (GNNs); Graph Convolutional Networks (GCNs). Detailed Implementation
[0040] To make the technical means, creative features, objectives and effects of this invention easier to understand, the invention will be further described below in conjunction with specific embodiments. Specific Implementation Example 1:
[0042] The construction method of the knowledge graph system for scientific and technological innovation services of R&D institutions includes the following construction steps:
[0043] S1: Data Collection and Cleaning: Data collection can be conducted through interviews and questionnaires, gathering real-world data across 12 dimensions, including departments, staff, technical fields, publications, patents, medical device certificates, vertical projects, vertical collaborations, and horizontal collaborations within the relevant research institute. Data cleaning includes: handling duplicate values, handling missing values, and standardization. Specifically, for duplicate values, only the first record is retained. For missing values, "-" is used to fill in missing attribute values. For standardization, due to different recording methods, data of the same type may be mixed; standardization primarily involves checking the publication period... Journal zoning consistency, paper data and journal section consistency: For paper journal zoning, the following consistency rules are adopted. When a paper journal has multiple zoning types, they are written in an incremental numerical manner, and the zonings are separated by commas ("," in English). For example: "JCR1 Zone", "JCR2 Zone, 1 Zone", "JCR1 Zone, 2 Zone", but the valid data is "JCR1 Zone", "JCR1 Zone, 2 Zone". In the consistency process, the abnormal data "JCR2 Zone, 1 Zone" will be replaced with "JCR1 Zone, 2 Zone". In the consistency of paper data and talent data, if there are multiple technical field keywords, the technical field keywords are separated by commas (","" in English).
[0044] S2: Bert-GCN+Qlearning-Transformer model construction: Extracting structured triples from text, which are topic-relation-object pairs, without relying on predefined patterns or ontology. Open information extraction often employs key information extraction technologies, including identifying and extracting structured information from unstructured or semi-structured data sources. This includes the following steps:
[0045] A: Input encoding: The input sentence is tokenized and encoded using word embeddings or subword embeddings, which capture semantic and contextual information about the words in the sentence;
[0046] B: Sentence encoding: The encoded tokens are used by a neural network, such as an RNN or a transformer-based model, to generate a fixed-size sentence representation. The neural network takes into account the contextual dependencies of the tokens and processes the tokens sequentially or in parallel.
[0047] C: Relationship Extraction: Sentence representations are used to predict the relationships between entities in a sentence. This can be accomplished using various techniques, such as binary classification or sequence tagging. The model identifies the spans that represent entities in a sentence and predicts the relationships between them.
[0048] D: Triple Generation: Based on the identified entity span and predicted relationship, the model generates OpenIE triples in the form of triples, which represent structured information extracted from the input sentence;
[0049] E: Post-processing: The generated triples may undergo post-processing steps to refine and standardize the extracted information, including handling coreference resolution, entity disambiguation, or merging similar relationships to reduce redundancy. However, due to the complexity of the deep learning open information extraction model itself, the space and time complexity of the deep learning framework required for knowledge extraction from different texts varies, which reduces prediction errors in the knowledge process and lowers resource requirements.
[0050] like Figure 2As shown, this invention proposes the Bert-GCN+Qlearning-Transformer model for entity recognition, relation extraction, and entity disambiguation. This model is trained on a labeled dataset of sentence and entity relation triples. The labeled dataset is created by manually annotating sentences with entities and relations. Bert supervised learning is used to train the model, transforming unstructured text data into structured data and extracting features. GraphConvolutionalNetwork is used to capture the graph structure and dependencies in the text, and Transformer is employed to realize multi-source correlation. To adjust the model's space and time complexity, Qlearning is used to optimize the model parameters, minimizing prediction error and conserving resources.
[0051] S3: Verification of the advancement of the Bert-GCN+Qlearning-Transformer model based on a public dataset: To select a deep learning model for information extraction, comparative experiments were conducted on CRF, BILSTM, BILSTM+CRF, BERT+GCN+CRF, BERT+LSTM+CRF, Bert+LSTM+Transformer, Bert+GCN+Transformer, and Bert-GCN+Qlearning-Transformer. The ResumeNER dataset, a large open-source Chinese data tagging corpus, was used for training. ResumeNER includes seven categories: name, nationality, place of origin, major, degree, institution, and professional title. The model was trained based on this comparison to determine the overall basic model structure.
[0052] S4: Construction of a Knowledge Graph for Technological Innovation Services of R&D Institutions: Based on the Bert-GCN+Qlearning-Transformer model, entity recognition, relation extraction, and entity disambiguation are achieved to establish a knowledge graph for technological innovation services of R&D institutions, which includes:
[0053] (1): Entity Recognition Deep Learning Model Based on BERT-GCN+Qlearning-Transformer: The BERT-GCN+Qlearning-transformer model is adopted to realize entity recognition of unstructured data. Among them, NER focuses on recognizing and classifying named entities in text, such as names, places, organizations, etc., with the goal of extracting specific entity mentions from text. The combination of the three can leverage the advantages of individual models to improve the performance of relation extraction tasks. The BERT model is pre-trained on a large amount of unlabeled text data and then fine-tuned on specific downstream tasks. GCN is a deep learning model for graph structure data. In the context of NER, words or tokens in a sentence can be viewed as nodes in a graph. GCN can be used to capture the dependencies and relationships between these nodes. By incorporating GCN into the model architecture, the model can leverage the structural information of the sentence to improve entity recognition. Transformer is a self-attention-based neural network architecture that has proven effective in various NLP tasks. The architecture is a key component of models such as BERT, allowing the model to capture contextual information and dependencies between words in a sentence. A model can be created based on this by combining BERT-GCN and Q-learning-transformer.
[0054] (2): Relation extraction deep learning model based on BERT-GCN+Qlearning-Transformer: The combination of BERT-GCN+Qlearning-transformer model is applied to relation extraction. It can also take advantage of the advantages of a single model to improve the performance of relation extraction tasks. The pre-trained language model of BERT is used to capture contextualized word representations. BERT is used to encode the input text and obtain rich word embeddings to capture the semantic and contextual information of words. By applying the GCN layer after BERT and using Qlearning to achieve parameter tuning, the sequence information can be modeled and the long-range dependencies in the encoded representation can be captured.
[0055] (3): Entity disambiguation deep learning model based on BERT-GCN+Qlearning-Transformer: The BERT+GCN+Transformer deep learning method is used to eliminate entity ambiguity, such as the ambiguous mention of "undergraduate", which refers to the academic qualification "undergraduate" or "undergraduate department". The model traverses the ambiguous words in the Chinese ambiguity dictionary database, uses BERT to encode the input text, and uses GCN to propagate information through graph structure. The transformation layer captures global dependencies. The model is trained using cross-entropy loss and optimized using the Adam optimizer. The research steps include:
[0056] a: Matching entity mapping dictionary preparation: Build a labeled ambiguous dictionary dataset in which each mention is associated with its correct entity. For example, the mention of "undergraduate" can refer to the academic qualification "undergraduate" or "undergraduate department". Split the dataset into training set, validation set and test set;
[0057] b: Word embeddings: Words in the dataset are represented using word embeddings, and pre-trained BERT embeddings are used;
[0058] c: Using the GCN+QlearningTransformer neural network architecture constructed in steps a and b, a neural network architecture was designed as an entity disambiguation task. The input of this model will be word embeddings around the context of mentioning “undergraduate”.
[0059] d: Training: Using 10-fold classification cross-entropy and an optimizer to train the model, the neural network is trained on a labeled dataset. During training, the model learns to predict the correct entity given the mention context. The training data is traversed, and the parameters of the model are updated using backpropagation and the optimizer.
[0060] e: Evaluation: Evaluate the trained model on the validation set to assess its performance, and calculate evaluation metrics such as accuracy, precision, recall, or F1 score to measure disambiguation performance.
[0061] f: Inference: Once the model is trained and evaluated, it can be used to eliminate entity ambiguity on new, unseen data. Given a new mention, the context surrounding the mention is fed into the trained model, which predicts the entity most likely to be mentioned based on learned patterns and associations. The predicted entity is compared with the live label to evaluate the model's accuracy. The specific implementations of BERT, GCN, Transformer, Q-learning components, data preprocessing, reward functions, exploration strategies, learning rates, discount factors, and evaluation metrics need to be customized according to specific needs.
[0062] The construction of the knowledge graph for scientific and technological innovation services in R&D institutions first involves importing necessary libraries and then implementing the proposed BERT-GCN+Qlearning-transformer model based on the PyTorch framework. Key aspects include defining data classes, outlining the three components of the dataset (texts, labels, and tokenizer), defining the BERT-GCN+Qlearning-transformer model structure (using BERT as the word vector model with an added GCN layer), defining relevant parameters (num_labels represents the number of relations), using Adam as the optimizer, cross-entropy as the loss function, and a learning rate of [missing value]. Define the Qlearning function for tuning the GCN parameter.
[0063] S5: Knowledge Graph Storage and Visualization for Technological Innovation Services in R&D Institutions: This section utilizes NoSQL (NoSQL) unstructured data storage tools for knowledge storage and implements knowledge graph visualization. Key aspects include selecting a NoSQL database, designing a data model, storing knowledge data, extracting data for visualization, visualizing the knowledge graph, configuring visualization settings, and knowledge graph interaction. Several NoSQL databases are available, such as MongoDB, Cassandra, Redis, and Neo4J. The data model design defines the structure of the knowledge data and designs the NoSQL storage mode. The knowledge data storage involves storing the knowledge data in the selected NoSQL database. The process involves converting knowledge data into an appropriate format and inserting it into a database using provided APIs or libraries. A mapping strategy is defined to transform the extracted data into a Neo4j-compatible graph structure, creating entity nodes, establishing relationships between entities, and assigning attributes to entities. Visualizing the knowledge graph utilizes Neo4j's visualization tools or third-party libraries, configuring visualization settings including node styles, relationship types, and layout algorithms to create an information-rich and visually appealing representation. Knowledge graph interaction enables interactive functionality, allowing users to explore and query the knowledge graph through visualization. Users can traverse the graph, expand nodes, view node details, and execute Cypher queries to retrieve specific information. Specific Implementation Example 2:
[0065] Based on step S2, as shown in pseudocode 1, BERT-GCN+Qlearning-Transformer implements public information extraction. It includes a BERT model, a GCN model, a Transformer model, and a Qlearning algorithm. Specific details regarding data preprocessing, graph construction, reward calculation, and other public information extraction-specific components are not included in this pseudocode and can be customized according to different tasks.
[0066] Pseudocode 1: Entity Recognition Implementation using Bert-GCN + Q-learning-Transformer Model #Importnecessarylibrariesandmodules#DefineBERT-GCNmodelarchitectureclassBERT_GCN:def__init__(self):#InitializeBERTmodelself.bert=BERTModel()#InitializeGCNmodelself.GCN=GCNModel() #InitializeTransformermodelself.transformer=TransformerModel() defforward(self,input_ids,attention_mask,graph):#ApplyBERTmodeltogetcontextualembeddingsbert_outputs=self.bert(input_ids,attention_mask) #ApplyGCNmodeltoprocessgraphandextractgraphembeddingsgraph_embeddings=self.GCN(graph,bert_outputs) #CombineBERTandgraphembeddingsusingTransformermodelcombined_embeddings=self.transformer(bert_outputs,graph_embeddings) returncombined_embeddings#DefineQ-learningalgorithmdefq_learning(state,action):#PerformQ-learningupdatebasedoncurrentstateandaction#UpdateQ-valuesbasedonrewardandnewstate returnupdated_q_values#InstantiateBERT-GCN+Q-learning-Transformermodelmodel=BERT_GCN()#Definetrainingloopforepochinrange(num_epochs):#Iterateovertrainingdata#Forwardpassthroughthemodeltogetpredictionspredictions=model.forward(input_ids,attention_mask,graph) #Computelossbasedonpredictionsandgroundtruth #Backpropagationandoptimizationstep #PerformQ-learningupdatebasedoncurrentstateandaction #Updatetargetnetworkorexploration-exploitationstrategy #Evaluatemodelperformanceonvalidationset#Savethetrainedmodelforfutureusemodel.save_model().
[0067] The key equation in BERT's bidirectional encoder representation from Transformers is the self-attention mechanism, which is used to compute contextualized word representations. The mathematical definition of the self-attention mechanism is as follows: Given an input sequence X=[x1, x2, ..., xn] with corresponding embeddings of tokens... n Let xᵢ represent the embedding of the i-th token. BERT uses three learning matrices: Query (Q), Key (K), and Value (V) to compute attention scores between all token pairs. These matrices are obtained through a linear transformation of the input embeddings. , and These three are the learnable weight matrix parameters. (4-1), (4-2), (4-3) Next, the attention score QKᵀ is calculated by taking the dot product between the query matrix and the key matrix. (4-4) To normalize the attention score, a scaling factor equal to the square root of the dimension of the key vector is applied, where d K The dimension of the key vector. (4-5), and then the attention scores are passed through the softmax function to obtain the attention weights. (4-6) Finally, the contextualized_representation of each matrix is calculated by using a weighted sum of the attention weight value vectors. This process is applied to multiple attention layers of the BERT model, allowing the model to capture contextual information by focusing on different parts of the input sequence. (4-7) The self-attention mechanism described above is the fundamental equation driving the core mechanism of BERT. In addition, by combining positional encoding and feedforward neural networks, the contextual representation is enhanced to achieve the BERT output result. However, the acquired contextual information is still relatively limited. Therefore, ATGCAN is used next to realize the global contextual information recognition. The core calculation formula of GCN is shown below. The representation of a node in GCN is usually calculated based on information from its neighboring nodes. The node representation of each layer can be calculated using the following formula. Let A represent the nodes at level l, A be the adjacency matrix of the graph, D be the degree matrix, and Dᵢ be the sum of the i-th row of A. It is the weight matrix of the previous layer l-1. It is an activation function (e.g., ReLU, Sigmoid). (4-8) In the task of extracting public information, the edges between entities can also carry information. In order to merge edge information (Edge Representation), an additional weight matrix E can be introduced, and the edge representation can be calculated as follows: Let E represent the edges in the l-th layer, and E be the weight matrix representing the edges. (4-9) During the aggregation step, an attention mechanism can be applied to capture the importance of neighboring nodes and edges. The attention coefficient can be calculated using the following formula. Indicates the attention coefficient. Indicates series connection. These are learnable parameters. , and It is a weight matrix.
[0068] (4-10) When Q-learning is combined with Graph Convolutional Networks (GCNs) to tune the GCN model, the Q-learning algorithm can be used to update the GCN parameters based on rewards obtained from the environment. The following are the key equations involved in tuning Q-learning in GCN. The Q-value represents the expected cumulative reward for taking a specific action in a given state. The Q-value is updated based on the estimated maximum Q-value of the current state, action, reward, and next state. The Q-value update equation is as follows: Q(s, a) represents the Q-value of state s and action a. γ is the learning rate (which controls the impact of each update), r is the reward obtained after taking action a in state s, and γ is the discount factor (which controls the weight of future rewards). It is the maximum Q-value among the possible actions to be taken in the next state s'.
[0069] (4-11) Next, the State Transition equation is used to determine the next state based on the current state and the action taken. In the context of GCN adjustment, it can represent the action-based changes in GCN parameters. The State Transition equation can be defined based on specific adjustments or modifications made to the GCN. To balance the exploration of new actions (Exploration-Exploitation Trade-off) and the utilization of learned knowledge, exploration strategies such as ε-greedy or softmax can be adopted. These strategies determine whether to choose the action with the highest Q value or a random action during the learning process. These equations form the basis for Q-learning used to adjust the GCN model. The Q value is iteratively updated based on the reward obtained from the environment, and the GCN model parameters can be adjusted accordingly, including the learning rate. ), discount factor ( ) and exploration strategies to achieve optimal performance when training GCN models.
[0070] The Transformer model is a key component in many natural language processing tasks, including open information extraction. The following are the key equations used in the Transformer model.
[0071] The self-attention mechanism in the Transformer model allows each word / token in the input sequence to pay attention to other words / tokens in the same sequence, capturing the dependencies and relationships between them. The attention score between the query vector (Q) and the key vector (K) is calculated as follows, where Q and K are the query vector and the key vector, respectively. The dimension of the value vector (V) is determined, and the attention score is used to weight the value vector (V), and a weighted sum is calculated to obtain the output of the self-attention layer. (4-12) The Transformer model employs multiple self-attention layers (Multi-HeadAttention), known as "multi-head attention". Each head learns different relationships and provides different attention representations. The outputs of multiple attention heads are cascaded and linearly transformed to obtain the final output.
[0072] Since the Transformer model lacks recursive or convolutional operations, it requires positional information to capture the order of tokens in the input sequence. Positional encoding is added to the input embedding to convey this information; it is typically represented by a sine function to encode the position of each token. The Transformer model uses a feedforward network to process the output of the self-attention layer. The feedforward network consists of two linear transformations with a non-linear activation function in between. Residual connections are employed around each sub-layer, including both self-attention and feedforward networks, to facilitate the flow of information between layers. Layer normalization is applied to normalize the output of each sub-layer. These equations form the core components of the Transformer model. By stacking multiple layers of self-attention and feedforward networks, the Transformer model can effectively capture long-range dependencies and learn public information extraction and other natural language processing tasks.
[0073] In summary, the Bert-GCN+Qlearning-Transformer model adopted in this invention achieves the task of extracting public information through the structuring of BERT text data, multiple contextual information extractions by GCN-Transformer, and structural optimization of the Qlearning external network. Specific Implementation Example 3:
[0075] Based on step S3, this invention conducts comparative experiments among CRF model, LSTM model, BiLSTM model, GCN model, BERT model, and Transformer model / combined model, and uses precision, recall, f1-score, and time consumption as indicators for comparison experiments, as shown in Table 1 below:
[0076] Table 1. Explanation of the Confusion Matrix
[0077]
[0078] Where TP stands for TruePositive, indicating a correctly predicted positive example (i.e., the actual value of the data is positive, and the predicted value is also positive); TN stands for TrueNegative, indicating a correctly predicted negative example (i.e., the actual value of the data is negative, and the predicted value is also negative); FP stands for FalsePositive, indicating a incorrectly predicted positive example (i.e., the actual value of the data is negative, but it was incorrectly predicted as positive); and FN stands for FalseNegative, indicating a incorrectly predicted negative example (i.e., the actual value of the data is positive, but it was incorrectly predicted as negative).
[0079] In this invention, precision, recall, and f1-score are calculated as follows: (4-13), (4-14), (4-15) In this invention, the data is divided into three parts: training set, test set, and validation set. The training set contains 3821 data points, the test set contains 463 data points, and the validation set contains 477 data points. The model is trained for 100 embouchures, and the best fit is taken as the final model. The Adam optimizer is used for all iterations, with an initial learning rate of 100%. The loss function is cross-entropy, as shown in Table 2 below:
[0080] Table 2 Comparison of ResumeNER datasets for various models
[0081]
[0082] The above research shows that using BERT as input to this word vector layer, then to the intermediate GCN model, and finally to the Transformer layer, the BERT+GCN+Transformer combination exhibits excellent experimental performance. The BERT model serves as the foundation for the word vector model, transforming the input into a high-dimensional word vector space. The structure of the BERT series model plus an intermediate model, finally embedded in the Transformer layer, demonstrates significant advantages in output regularization. GCN offers a more pronounced advantage over LSTM for intermediate context information extraction. Furthermore, Q-learning is used to adjust the structural and spatial complexity of GCN, resulting in substantial advantages in precision, recall, F1-score, and time savings in testing.
[0083] Based on step S4(1), this invention adopts the BERT-GCN+Qlearning-transformer model to achieve entity recognition of unstructured data. NER focuses on recognizing and classifying named entities in text, such as names, places, organizations, etc., with the goal of extracting specific entity mentions from text. The combination of the three can leverage the combined advantages of individual models to improve the performance of relation extraction tasks. The BERT model is pre-trained on a large amount of unlabeled text data and then fine-tuned on specific downstream tasks, such as NER. By incorporating GCN into the model architecture, the model can utilize the structural information of sentences to improve entity recognition. By combining BERT-GCN+Qlearning-transformer, this invention creates a model that leverages the expressive advantages of transformers to capture contextual relevance and utilizes graph-based representations to improve NER performance. This combination can potentially enhance the model's ability to accurately and effectively recognize named entities. Knowledge graph construction involves building a structured representation of information by recognizing entities, their attributes, and the relationships between them. It not only requires recognizing entity mentions but also extracting and linking additional information to populate the knowledge graph.
[0084] As shown in the pseudocode below, this invention uses the Python package `torch` to implement entity recognition. It combines linear layers of BERT, GCN, and NER, with the number of entities (`num_labels`) set to 10. These entities mainly include: innovative technology service personnel, innovative technology service institutions, innovative technology service personnel degrees, innovative technology service personnel published papers, innovative technology service personnel published patents, innovative technology service departments, innovative technology service content and technology fields, innovative technology service journals, innovative technology service paper rankings, and innovative technology service projects, as shown in Table 3.
[0085] Table 3 Entity Types Based on Knowledge Graph of Technological Innovation Services of R&D Institutions
[0086]
[0087] The ratio of training data, validation data, and test data is 7:2:1. For validation data, this invention uses 10-fold cross-entropy to calculate the loss and the Adam optimizer to optimize the model parameters. During the inference phase, we load the trained model and make predictions on the test dataset to obtain the predicted relation labels.
[0088] First, the necessary libraries are imported. This invention is implemented using the PyTorch framework, and the proposed BERT-GCN+Qlearning–transformer model is implemented. The main details are as follows.
[0089] (1): Define the data class, which describes the three components of the dataset (texts, labels, tokenizer).
[0090] (2): Define the BERT-GCN+Qlearning–transformer model structure, using BERT as the word vector model and adding a GCN layer;
[0091] (3): Define relevant parameters, where num_labels is the number of entities, Adam is used as the optimizer, cross-entropy is used as the loss function, and batch_size is 16.
[0092] (4): Define the Qlearning function for tuning GCN. The following is pseudocode 2:
[0093] Pseudocode 2: Entity recognition implemented using BERT-GCN + Q-learning-transformer model #Importnecessarylibrariesimporttorchimporttorch.nnasnnimporttorch.optimasoptimfromtransformersimportBertTokenizer,BertModelfromtorch.utils.dataimportDataLoaderfromtorch.nn.utils.rnnimportpad_sequence #Setdevicedevice=torch.device("cuda"iftorch.cuda.is_available()else"cpu") #DefinecustomdatasetclassNERDataset(torch.utils.data.Dataset):def__init__(self,texts,labels):self.texts=textsself.labels=labelsself.tokenizer=BertTokenizer.from_pretrained("bert-base-uncased") def__len__(self):returnlen(self.texts) def__getitem__(self,idx):text=self.texts[idx]label=self.labels[idx] encoding=self.tokenizer.encode_plus(text,add_special_tokens=True,truncation=True,padding="max_length",max_length=128,return_tensors="pt") input_ids=encoding["input_ids"].squeeze()attention_mask=encoding["attention_mask"].squeeze() returninput_ids,attention_mask,label #DefinetheNERmodelarchitectureclassNERModel(nn.Module):def__init__(self,bert_model,gcn_layers,num_labels):super(NERModel,self).__init__()self.bert_model=bert_modelself.gcn_layers=gcn_layersself.fc=nn.Linear(gcn_layers[-1],num_labels) defforward(self,input_ids,attention_mask,adjacency_matrix):bert_output=self.bert_model(input_ids=input_ids,attention_mask=attention_mask)[0]gcn_output=bert_output#PlaceholderforGCNoutput,assumingittakesBertoutputasinput forgcn_layerinself.gcn_layers:gcn_output=gcn_layer(gcn_output,adjacency_matrix) logits=self.fc(gcn_output)returnlogits#DefineQ-learningalgorithmdefq_learning(state,action):#PerformQ-learningupdatebasedoncurrentstateandaction#UpdateQ-valuesbasedonrewardandnewstate returnupdated_q_values #InstantiateBERT-GCN+Q-learning-Transformermodelmodel=BERT_GCN() #Sethyperparametersandinitializethemodelnum_labels=10#Numberofentitylabelsbert_model=BertModel.from_pretrained("bert-base-uncased")#Pre-trainedBertmodelgcn_layers=[GCNLayer(in_features=bert_model.config.hidden_size,out_features=64),GCNLayer(in_features=64,out_features=64)]model=NERModel(bert_model,gcn_layers,num_labels).to(device) #Definelossfunctionandoptimizercriterion=nn.CrossEntropyLoss()optimizer=optim.Adam(model.parameters(),lr=0.001) #Preprocessingstep:Tokenizeandencodethetextstexts=[...]#Listofinputtextslabels=[...]#Listofcorrespondinglabelsdataset=NERDataset(texts,labels) #Padsequenceswithinabatchdefcollate_fn(batch):input_ids,attention_masks,labels=zip(*batch)input_ids=pad_sequence(input_ids,batch_first=True)attention_masks=pad_sequence(attention_masks,batch_first=True)labels=torch.tensor(labels)returninput_ids,attention_masks,labels #Createdataloaderforbatchprocessingbatch_size=16dataloader=DataLoader(dataset,batch_size=batch_size,shuffle=True,collate_fn=collate_fn) #Definetrainingloopforepochinrange(num_epochs):#Iterateovertrainingdataforinput_ids,attention_mask,graph,labelsindataloader:#Forwardpassthroughthemodeltogetpredictionspredictions=model.forward(input_ids,attention_mask,graph) #Computelossbasedonpredictionsandgroundtruthlabelsloss=compute_loss(predictions,labels) #Backpropagationandoptimizationstepoptimizer.zero_grad()loss.backward()optimizer.step() #PerformQ-learningupdatebasedoncurrentstateandactionq_values=model.compute_q_values(input_ids,attention_mask,graph)updated_q_values=q_learning(state,action)model.update_q_values(updated_q_values) #Evaluatemodelperformanceonvalidationsetaccuracy=evaluate(model,validation_data)print("Epoch:",epoch,"Accuracy:",accuracy)#Savethetrainedmodelforfutureusemodel.save_model().
[0094] After correction, the model results are shown in the table below. This algorithm is effective in the NER task. As can be seen from Table 4 below, its model achieves an accuracy of up to 97.45%, demonstrating good performance. The innovation of this invention lies in controlling the graph convolutional network (GCN) used for entity recognition through a Q-learning external network, mainly including:
[0095] (1): Define the state space: Determine the state representation of the GCN for capturing the current state of the graph and entity recognition task. The state may include features such as node attributes, edge connections, entity labels, or any other relevant information.
[0096] (2): Define the action space: Determine a set of operations that can be taken to adjust the GCN for entity recognition. Actions may include modifying the graph structure, such as adding or removing edges, adjusting GCN hyperparameters, such as the number of layers or hidden cells, or any other related modifications.
[0097] (3): Define the Q table. Create a Q table to store Q values, where rows represent states and columns represent actions. Initialize the Q table with any initial value or zero.
[0098] (4): Define the reward function: Design a reward function to evaluate the performance of GCN for entity recognition given a state-action pair. The reward function should reflect the optimization objective, such as precision, recall, F1 score, or any other relevant metric. The reward function can be defined based on the improvement or deterioration of performance compared to previous state-action pairs.
[0099] (5): Implement the Q-learning loop: Initialize the current state using the initial state representation, and repeat the following steps until convergence or a predefined number of iterations is reached: Using an exploration strategy, such as ε-greedy, softmax, etc., select an action, perform the selected operation on the GCN, update its parameters or modify the graph structure, observe the new state generated by the action, calculate the reward based on the GCN's performance in entity recognition in the new state, update the Q value using the Q-learning update equation, update the current state using the new state, and repeat the Q-learning loop multiple times or until convergence. (4-16)
[0100] (6): Implement the learning policy: After training, you can use the learned Q value to select the best action to control the GCN in the new unseen state, apply the selected action to adjust the GCN and improve its entity recognition performance, as shown in Table 4 below:
[0101] Experimental results of the Bert-GCN+Qlearning-Transformer model on the NER task
[0102] .
[0103] Based on S4(2), this invention uses the BERT-GCN+Qlearning-transformerDE method to extract relations. The combination of BERT-GCN+Qlearning-transformer models is applied to relation extraction, and the advantages of a single model can also be used to improve the performance of relation extraction tasks. The pre-trained language model BERT is used to capture word representations of context. BERT is used to encode the input text and obtain rich word embeddings to capture the semantic and contextual information of words. GCN has advantages in capturing sequential dependencies in text data. By applying a GCN layer after BERT and using Qlearning to adjust parameters, sequence information can be modeled and long-range dependencies in the encoded representation can be captured. Transformer is a powerful model that is good at capturing global relevance and relationships in data. By merging a Transformer layer after GCN, the contextual relationships between encoded representations can be further captured, enabling the model to utilize local and global information.
[0104] The following pseudocode 3 sets the number of relations (num_labels) to 7, mainly including relation types: "degree type", "technical field", "belongs to", "published", "partition", "collaboration", "serves", as shown in Table 5 below;
[0105] Table 5. Relationship Types Based on Knowledge Graph of Technological Innovation Services of R&D Institutions
[0106]
[0107] The code defines a `RelationshipExtractionModel` class, which contains BERT for contextual embedding, an LSTM layer for sequential modeling, and a Transformer layer for capturing global dependencies. The model's forward pass takes `input_ids` and `attention_mmask` as inputs, passes through BERT, applies a GCN layer to the BERT output, feeds it into the Transformer layer, and finally passes through a fully connected layer to obtain the logits for each relation label. During training, the loss is calculated using 10-fold cross-entropy, and the model parameters are optimized using the Adam optimizer. During inference, the trained model is loaded, and predictions are made on the test dataset to obtain the predicted relation labels. The ratio of training data, validation data, and test data is 7:2:1.
[0108] First, the necessary libraries are imported. This invention is implemented using the PyTorch framework, and the proposed BERT-GCN+Qlearning–transformer model is implemented. The main details are as follows.
[0109] (1): Define the data class, which describes the three components of the dataset, including texts, labels, and tokenizer.
[0110] (2): Define the BERT-GCN+Qlearning–transformer model structure, using BERT as the word vector model and adding a GCN layer.
[0111] (3): Define relevant parameters, where num_labels is the number of relations, Adam is used as the optimizer, cross-entropy is used as the loss function, batch_size is 16, and the learning rate is... .
[0112] (4): Define the Qlearning function for tuning GCN. The following is pseudocode 3:
[0113] Pseudocode 3: Relation Extraction Implementation Using BERT-GCN + Q-learning-transformer Model importtorchimporttorch.nnasnnfromtransformersimportBertModel classRelationshipExtractionModel(nn.Module):def__init__(self,num_labels):super(RelationshipExtractionModel,self).__init__()self.bert_model=BertModel.from_pretrained("bert-base-uncased")self.gcn=gcn_layersself.transformer=nn.Transformer(d_model=256,nhead=4)self.fc=nn.Linear(256,num_labels) defforward(self,input_ids,attention_mask):bert_output=self.bert_model(input_ids=input_ids,attention_mask=attention_mask)[0]gcn_output,_=self.gcn(bert_output)transformer_input=gcn_output.transpose(0,1)transformer_output=self.transformer(transformer_input,transformer_input)pooled_output=transformer_output.mean(dim=0)logits=self.fc(pooled_output)returnlogits #Assumingyouhaveyourlabeleddatasetanddataloadersetup #DefineQ-learningalgorithmdefq_learning(state,action):#PerformQ-learningupdatebasedoncurrentstateandaction#UpdateQ-valuesbasedonrewardandnewstate returnupdated_q_values #InstantiateBERT-GCN+Q-learning-Transformermodelmodel=BERT_GCN() #Sethyperparametersandinitializethemodelnum_labels=7#Numberofrelationshiplabelsmodel=RelationshipExtractionModel(num_labels)criterion=nn.CrossEntropyLoss()optimizer=torch.optim.Adam(model.parameters(),lr=1e-5)batch_size=16 #Trainingloopforepochinrange(num_epochs):model.train()forinput_ids,attention_mask,labelsindataloader:optimizer.zero_grad()input_ids=input_ids.to(device)attention_mask=attention_mask.to(device)labels=labels.to(device)logits=model(input_ids,attention_mask)loss=criterion(logits,labels)loss.backward()optimizer.step() model.eval()withtorch.no_grad():forepochinrange(num_epochs):#Iterateovertrainingdataforinput_ids,attention_mask,graph,labelsindataloader:#Forwardpassthroughthemodeltogetpredictionspredictions=model.forward(input_ids,attention_mask,graph) #Computelossbasedonpredictionsandgroundtruthlabelsloss=compute_loss(predictions,labels) #Backpropagationandoptimizationstepoptimizer.zero_grad()loss.backward()optimizer.step() #PerformQ-learningupdatebasedoncurrentstateandactionq_values=model.compute_q_values(input_ids,attention_mask,graph)updated_q_values=q_learning(state,action)model.update_q_values(updated_q_values).
[0114] After correction, the model results are shown in Table 6 below. This algorithm is effective in RE tasks. As can be seen from the table, its model achieves an accuracy of up to 96.25%, demonstrating good performance.
[0115] Table 4-8 shows the experimental results of the BERT-GCN+Qlearning-transformer model in the RE task. Table 6 is below:
[0116]
[0117] Based on step S4(3): First, the necessary libraries are imported. This invention uses the PyTorch framework to implement the BERT-GCN+Qlearning-transformer model proposed in this invention. The main details are as follows.
[0118] (1): Define the data class, which describes the three components of the dataset, including texts, labels, and tokenizer.
[0119] (2): Define the BERT-GCN+Qlearning–transformer model structure, using BERT as the word vector model and adding a GCN layer.
[0120] (3): Define relevant parameters, where num_labels is the number of relations, Adam is used as the optimizer, cross-entropy is used as the loss function, and the learning rate is... .
[0121] (4) Define the Qlearning function for tuning GCN. The following is pseudocode 4:
[0122] Pseudocode 4: Entity disambiguation implemented using the BERT-GCNQ learning-transformer model #Importnecessarylibrariesandmodules #DefineBert-GCN-Qlearning-TransformermodelarchitectureclassBert_GCN_Qlearning_Transformer:def__init__(self):#InitializeBERTmodelself.bert=BERTModel() #InitializeGCNmodelself.gcn=GCNModel() #InitializeTransformermodelself.transformer=TransformerModel() #InitializeQ-learningcomponentsself.q_table=QTable()self.exploration_strategy=ExplorationStrategy() defforward(self,input_ids,attention_mask,graph):#ApplyBERTmodeltogetcontextualembeddingsbert_outputs=self.bert(input_ids,attention_mask) #ApplyGCNmodeltoprocessgraphandextractgraphembeddingsgraph_embeddings=self.gcn(graph,bert_outputs) #CombineBERTandgraphembeddingsusingTransformermodelcombined_embeddings=self.transformer(bert_outputs,graph_embeddings)returncombined_embeddings defq_learning_update(self,state,action,reward,next_state):#PerformQ-learningupdatebasedoncurrentstate,action,reward,andnextstateq_value=self.q_table.get_q_value(state,action)max_q_value=self.q_table.get_max_q_value(next_state)updated_q_value=q_value+learning_rate*(reward+discount_factor*max_q_value-q_value)self.q_table.update_q_value(state,action,updated_q_value) defselect_action(self,state):#Selectanactionusinganexplorationstrategy(e.g.,epsilon-greedy)returnself.exploration_strategy.select_action(state,self.q_table) #InstantiateBert-GCN-Qlearning-Transformermodelmodel=Bert_GCN_Qlearning_Transformer() #Definetrainingloopforepochinrange(num_epochs):total_reward=0.0 #Iterateovertrainingdataforinput_ids,attention_mask,graph,labelsintraining_data:#Forwardpassthroughthemodeltogetpredictionspredictions=model.forward(input_ids,attention_mask,graph) #Computerewardbasedonpredictionsandgroundtruthlabelsreward=compute_reward(predictions,labels)total_reward+=reward #Selectanactionusingtheexplorationstrategystate=construct_state(input_ids,attention_mask,graph)action=model.select_action(state) #Performtheselectedactiononthemodeltogetupdatedstateupdated_state=model.update_state(action) #PerformQ-learningupdatemodel.q_learning_update(state,action,reward,updated_state) #Evaluatemodelperformanceonvalidationsetaccuracy=evaluate(model,validation_data)average_reward=total_reward / len(training_data)print("Epoch:",epoch,"Accuracy:",accuracy,"AverageReward:",average_reward) #Savethetrainedmodelforfutureusemodel.save_model().
[0123] After correction, the model results are shown in the table below. This algorithm is effective in the EntityDisambiguation task, with an accuracy of up to 0.9625, demonstrating good performance. Table 7 is shown below:
[0124] Table 7: Experimental results of the BERT–GCN+Qlearning-transformer model on the ED task
[0125] .
[0126] Based on step S1: Taking R&D institutions as the research subjects, real-world data was collected from R&D institution A through interviews and questionnaires, covering 12 dimensions: departments, employees, technical fields, publications, patents, medical device certificates, vertical projects, vertical collaborations, and horizontal collaborations. A total of 12 departments, 70 employees, 100 technical fields, 45 publications, 148 patents, 3 medical device certificates, 30 vertical projects, 23 vertical collaborations, and 39 horizontal projects were collected. For R&D institution B, data was collected across three dimensions: employees, technical fields, and publications, covering 69 employees, 200 technical fields, 2859 publications, and 768 patents. Data cleaning primarily included handling duplicate values, missing values, and data consistency.
[0127] After processing in step S1, as shown in Table 7, a total of 12 types of data were collected, including: 12 departments, 139 employees, 4600 technical fields (including keywords from papers), 2904 academic papers, 916 patents, 3 medical device certificates, 30 vertical projects, 23 vertical collaborations, and 39 horizontal collaborations. Table 8 shows the data dimensions and details of the data content after overall data processing.
[0128] Table 7 Overview of Data Content
[0129] .
[0130] Table 8. Data Content Details and Data Dimensions
[0131] .
[0132] This invention uses visualization tools to visualize a knowledge graph of scientific and technological innovation services based on research and development institutions, and the results are as follows.
[0133] like Figure 3 As shown, the entire scale of the knowledge graph of scientific and technological innovation services based on R&D institutions is comprehensively demonstrated. On the right side of the image, the knowledge content contained within the knowledge graph is displayed.
[0134] like Figure 4 As shown, the knowledge graph is displayed in a second form – a circle, which will... Figure 3 In the graph, a node scale of 30,000 and a relationship scale of 60,000 are structurally transformed and displayed as a circle. Through 3D display, a more aesthetically pleasing overall display is provided.
[0135] like Figure 5 As shown, the knowledge graph presentation focuses on local details. By structurally expanding the two research institutions of this invention, namely Research Institution A and Research Institution B, the associated nodes of Research Institution A and Research Institution B are displayed using an attribute graph. In the above graph, different entity types are represented by different colors, showing four entity types: Institution, Field, Section, and Person. Different relation types are also represented by different colors, showing two relation types: Belong_to and Technical Field.
[0136] like Figure 6 As shown, the knowledge graph is displayed by focusing on local details. By structurally expanding the research institution, namely Research Institution B, in this invention, the papers published by Research Institution B are displayed.
[0137] like Figure 7 As shown, the knowledge graph is displayed by focusing on local details. By expanding the structure of the talent degrees in this invention, the figure above shows talents from two research institutions. Through the above-mentioned structural expansion, the educational relationship network of talents can be quickly located and constructed.
[0138] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of this invention is defined by the appended claims and their equivalents.
Claims
1. A method for constructing a knowledge graph system for scientific and technological innovation services of research institutions, characterized in that, The following are the construction steps: S1: Data Collection and Cleaning: Data collection includes real-world data collection across 12 dimensions—departments, staff, technical fields, publications, patents, medical device certificates, vertical projects, vertical collaborations, and horizontal collaborations—through interviews and questionnaires. Data cleaning includes duplicate value handling, missing value handling, and consistency processing. For duplicate value handling, only the first record of duplicate data is retained. For missing value handling, missing attribute values are filled in using the hyphen "-". For consistency processing, this includes journal quartile consistency processing and consistency processing between paper data and journal sections. S2: Bert-GCN+Qlearning-Transformer model construction: This includes extracting structured triples from text, where the triples are topic-relation-object; Open information extraction employs key information extraction technologies, including identifying and extracting structured information from unstructured or semi-structured data sources, which includes the following steps: A: Input encoding: The input sentence is tokenized and the tokens are encoded using word embeddings or sub-word embeddings that can capture semantic and contextual information about the words in the sentence; B: Sentence encoding: The encoded tokens generate fixed-size sentence representations through a neural network that can process tokens sequentially or in parallel based on their contextual dependencies. C: Relationship Extraction: Sentence representation is used to predict the relationships between entities in a sentence. The model can identify the span of entities in a sentence and predict the relationships between those entities. D: Triple generation: Based on the span of the identified entities and the relationship between the predicted entities, the OpenIE triple is generated in the form of triples through the model. The triples represent the structured information extracted from the input sentence. E: Post-processing: The generated triples undergo post-processing steps to refine and standardize the extracted information. Post-processing includes coreference resolution, entity disambiguation, or merging similar relationships to reduce redundancy. S3: Validation of the Advancement of the Bert-GCN+Qlearning-Transformer Model Based on the ResumeNER Dataset: To select a deep learning model for information extraction, comparative experiments were conducted on the CRF model, BILSTM model, BILSTM+CRF combined model, BERT+GCN+CRF combined model, BERT+LSTM+CRF combined model, Bert+LSTM+Transformer combined model, Bert+GCN+Transformer combined model, and Bert-GCN+Qlearning-Transformer model. All models were trained using the open-source Chinese data tagging corpus ResumeNER, which includes seven categories: name, nationality, place of origin, major, degree, institution, and professional title. The Bert-GCN+Qlearning-Transformer model comprises a BERT model, a GCN model, a Transformer model, and a Qlearning algorithm. By merging a Transformer model after the GCN model, the contextual relationships between encoded representations can be captured, enabling the model to utilize both local and global information. S4: Construction of a Knowledge Graph for Technological Innovation Services of R&D Institutions: Based on the Bert-GCN+Qlearning-Transformer model, entity recognition, relation extraction, and entity disambiguation are performed to build a knowledge graph for technological innovation services of R&D institutions, which includes: (1) The BERT-GCN+Qlearning-transformer model is used for entity recognition of unstructured data, including the recognition and classification of named entities in text. The goal is to extract specific entities from the text. The BERT model is pre-trained on unlabeled text data and fine-tuned on the corresponding downstream tasks. GCN is a neural network architecture that operates on graph structure data. In the context, words or tags in a sentence are regarded as nodes in the graph. GCN can be used to capture the dependencies between nodes in the graph and the relationships between nodes in the graph. By incorporating the GCN model into the model architecture, the BERT-GCN+Qlearning-transformer model can utilize the structural information of the sentence to improve entity recognition. Transformer is a self-attention-based neural network architecture that has been proven to be effective in various NLP tasks. Transformer allows the model to capture contextual information and the dependencies between words in the sentence. By combining the BERT model, GCN model, Qlearning algorithm and transformer model, the BERT-GCN+Qlearning-Transformer model can be created. (2) The BERT-GCN+Qlearning-transformer model is used for relation extraction. The BERT pre-trained language model is used to capture the word representation of the context. The input text is encoded using BERT and word embeddings are obtained to capture the semantic and contextual information of the words. By applying the GCN layer after BERT, the Qlearning algorithm is used to adjust the parameters, model the sequence information, and capture the long-range dependencies in the encoded representation. (3) Entity disambiguation using the Bert-GCN+Qlearning-Transformer model: The ambiguous words in the Chinese ambiguous dictionary database are traversed. The BERT model is used to encode the input text, the GCN model propagates information through a graph structure, and the transformation layer captures global dependencies. This Bert-GCN+Qlearning-Transformer model is trained using cross-entropy loss and optimized using the Adam optimizer. The research steps include: a: Matching entity mapping dictionary preparation: Build a labeled ambiguous dictionary dataset, in which each ambiguous mention is associated with its correct entity; b: Word embeddings: Words in the dataset are represented using word embeddings, and pre-trained BERT embeddings are used; c: Construct the GCN+Qlearning-Transformer neural network architecture using steps a and b, as the neural network architecture for the entity disambiguation task; d: Training: Using 10-fold classification cross-entropy and an optimizer to train the model, the neural network is trained on a labeled dataset. During training, the model learns to predict the correct entity given the mention context. The training data is traversed, and the parameters of the model are updated using backpropagation and the optimizer. e: Evaluation: Evaluate the trained model on the validation set to assess its performance, and calculate evaluation metrics to measure disambiguation performance, including accuracy, precision, recall, or F1 score. f: Inference: After training and evaluating the model, it can be used to eliminate entity ambiguity on new, unseen data. Given a new mention, the surrounding context is fed into the trained model, which predicts the entity corresponding to the mention based on learned patterns and associations. The predicted entity is compared with the real-world label to evaluate the model's accuracy. The specific implementations of BERT, GCN, Transformer, Q-learning components, data preprocessing, reward function, exploration strategy, learning rate, discount factor, and evaluation metrics are customized according to specific needs. S5: Knowledge Graph Storage and Visualization for Technological Innovation Services in R&D Institutions: This involves using NoSQL (NoSQL) unstructured data storage tools for knowledge storage and visualizing the knowledge graph. This includes selecting a NoSQL database, designing a data model, storing knowledge data, extracting data for visualization, visualizing the knowledge graph, configuring visualization settings, and enabling knowledge graph interaction. NoSQL databases include MongoDB, Cassandra, Redis, and Neo4. The data model design defines the structure of the knowledge data and designs the NoSQL storage mode. Storing the knowledge data involves storing it in the selected NoSQL database and converting the knowledge data into a preset format. The process involves: inserting the knowledge data into a database using the provided API or library; extracting data for visualization, including: defining a mapping strategy to convert the extracted data into a Neo4j-compatible graph structure to create entity nodes; creating relationships between entities and assigning attributes to entities; visualizing the knowledge graph by configuring visualization settings, including node styles, relationship types, and layout algorithms, using Neo4j's visualization tools or third-party libraries to create a representation of the knowledge graph; and implementing interactive functionality to allow users to explore and query the knowledge graph through visualization, enabling users to traverse the graph, expand nodes, view node details, and perform Cypher queries to retrieve specific information.
2. The method for constructing a knowledge graph system for scientific and technological innovation services of R&D institutions according to claim 1, characterized in that: The journal partitioning consistency processing includes: when there are multiple partition types in a journal, the partitions are written in an incremental manner, and the partitions are separated by commas ("".) in the consistency processing of paper data and talent data, if there are multiple technical field keywords, the technical field keywords are separated by commas ("".) 3.The method of claim 1, wherein, The BERT-GCN+Qlearning–transformer model is implemented based on the PyTorch framework, including: Define a data class to describe the three components of the dataset: texts, labels, and tokenizer. Define the BERT-GCN+Qlearning–transformer model structure, using BERT as the word vector model and adding a GCN layer; The related parameters are defined, wherein num_labels is the number of relations, Adam is used as the optimizer, cross-entropy is used as the loss function, and the learning rate is ; Define the Qlearning function for tuning the GCN.
Citation Information
Patent Citations
Scientific and technological character knowledge graph construction method and device based on deep learning model, and terminal
CN113254667A
Knowledge graph construction, retrieval and visualization method and system for science and technology service
CN115309885A