CN117271701A - Method and system for extracting system operation abnormal event relation based on TGGAT and CNN - Google Patents
Method and system for extracting system operation abnormal event relation based on TGGAT and CNN Download PDFInfo
- Publication number
- CN117271701A CN117271701A CN202311178825.8A CN202311178825A CN117271701A CN 117271701 A CN117271701 A CN 117271701A CN 202311178825 A CN202311178825 A CN 202311178825A CN 117271701 A CN117271701 A CN 117271701A
- Authority
- CN
- China
- Prior art keywords
- vector matrix
- matrix
- vector
- sentence
- attention
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 230000002159 abnormal effect Effects 0.000 title claims abstract description 15
- 238000000034 method Methods 0.000 title claims description 16
- 239000011159 matrix material Substances 0.000 claims abstract description 82
- 238000013527 convolutional neural network Methods 0.000 claims abstract description 28
- 238000000605 extraction Methods 0.000 claims abstract description 26
- 238000007781 pre-processing Methods 0.000 claims abstract description 10
- 238000012545 processing Methods 0.000 claims abstract description 6
- 238000012512 characterization method Methods 0.000 claims abstract 6
- 230000006870 function Effects 0.000 claims description 9
- 238000004364 calculation method Methods 0.000 claims description 7
- 239000010410 layer Substances 0.000 claims description 6
- 238000011176 pooling Methods 0.000 claims description 6
- 230000004913 activation Effects 0.000 claims description 3
- 238000010606 normalization Methods 0.000 claims description 3
- 239000002356 single layer Substances 0.000 claims description 3
- 238000004590 computer program Methods 0.000 claims 4
- 230000004931 aggregating effect Effects 0.000 claims 1
- 230000007246 mechanism Effects 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 230000002123 temporal effect Effects 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 239000000284 extract Substances 0.000 description 4
- 230000001364 causal effect Effects 0.000 description 3
- 230000002776 aggregation Effects 0.000 description 2
- 238000004220 aggregation Methods 0.000 description 2
- 230000008901 benefit Effects 0.000 description 2
- 238000004140 cleaning Methods 0.000 description 2
- 230000000717 retained effect Effects 0.000 description 2
- 238000012549 training Methods 0.000 description 2
- 238000012546 transfer Methods 0.000 description 2
- 238000013528 artificial neural network Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000015556 catabolic process Effects 0.000 description 1
- 238000013145 classification model Methods 0.000 description 1
- 230000000295 complement effect Effects 0.000 description 1
- 238000006731 degradation reaction Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000003058 natural language processing Methods 0.000 description 1
- 230000002787 reinforcement Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 238000010200 validation analysis Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/3331—Query processing
- G06F16/334—Query execution
- G06F16/3344—Query execution using natural language analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/35—Clustering; Classification
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/205—Parsing
- G06F40/211—Syntactic parsing, e.g. based on context-free grammar [CFG] or unification grammars
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/30—Semantic analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0464—Convolutional networks [CNN, ConvNet]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Artificial Intelligence (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Databases & Information Systems (AREA)
- Life Sciences & Earth Sciences (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Evolutionary Computation (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Machine Translation (AREA)
Abstract
Description
技术领域Technical field
本发明涉及文本数据识别,具体是涉及一种基于TGGAT和CNN的系统运行异常事件关系抽取方法及系统。The present invention relates to text data recognition, specifically to a method and system for extracting abnormal event relationships in system operation based on TGGAT and CNN.
背景技术Background technique
事件关系提取是事件知识图谱中的一个重要步骤,它对信息提取、投资策略和问题解答等自然语言处理应用大有裨益。通过捕捉关联关系,相关事件可以相辅相成,充分发挥其价值。Event relationship extraction is an important step in the event knowledge graph, which is of great benefit to natural language processing applications such as information extraction, investment strategies, and question answering. By capturing related relationships, related events can complement each other and fully realize their value.
目前,在事件关系提取的任务中,大多数研究集中在提取因果关系和时间关系上。机器学习在提取事件关系的任务中得到了广泛应用。Kruengkrai等人采用多列卷积神经网络处理多个背景知识源,以提取缺乏明确线索表明事件因果关系存在的因果关系。Ning等人结合整数线性规划和常识知识提取时间关系。Hu等人使用预训练的语言模型自适应地聚类化时间关系特征。Jiang等人提出了一种在分类中结合句法树结构的模型。为了提高分类效果,Fan等人提出了一种关系分类模型,利用双线神经网络提取句法信息来完成关系分类任务。人们还提出了处理文档级事件因果关系的不同思路,Trong等人设计了一种强化学习机制来从文档中选择关键上下文。Currently, in the task of event relationship extraction, most research focuses on extracting causal relationships and temporal relationships. Machine learning is widely used in the task of extracting event relationships. Kruengkrai et al. employed multi-column convolutional neural networks to process multiple sources of background knowledge to extract causal relationships that lack clear clues indicating the existence of event causality. Ning et al. combined integer linear programming and common sense knowledge to extract temporal relationships. Hu et al. use pre-trained language models to adaptively cluster temporal relationship features. Jiang et al. proposed a model that incorporates syntactic tree structures in classification. In order to improve the classification effect, Fan et al. proposed a relationship classification model that uses a dual-line neural network to extract syntactic information to complete the relationship classification task. Different ideas for handling document-level event causality have also been proposed, and Trong et al. designed a reinforcement learning mechanism to select key context from documents.
由于丰富的语言知识包含在句法依赖中,因此有很多基于句法依赖的方法被提出。Aldawsari等人使用依赖树中另一事件的祖先事件,同时融合话语和叙事特征,以获得更丰富的事件表示。Meng等人使用序列编码器对事件之间最短的依赖路径进行编码,以识别它们之间的关系。由于序列编码器不能很好地学习结构信息,因此有人提出了一些基于图的方法来完成这项任务。Wang等人提出了不同的约束条件来提取时间关系和子事件关系。Zhang等人提出使用图转换器来捕捉语法图中的时间知识。Mathur等人和Tran等人在使用句法依赖性的同时,还引入了修辞、话语和语义等其他知识,通过不同图中节点之间的交互来丰富事件的表示。Since rich language knowledge is contained in syntactic dependencies, many methods based on syntactic dependencies have been proposed. Aldawsari et al. use an ancestor event of another event in a dependency tree while fusing discourse and narrative features to obtain a richer event representation. Meng et al. use a sequence encoder to encode the shortest dependency paths between events to identify relationships between them. Since sequence encoders cannot learn structural information well, some graph-based methods have been proposed to accomplish this task. Wang et al. proposed different constraints to extract temporal relationships and sub-event relationships. Zhang et al. proposed using graph transformers to capture temporal knowledge in syntax graphs. While using syntactic dependencies, Mathur et al. and Tran et al. also introduced other knowledge such as rhetoric, discourse, and semantics to enrich the representation of events through interactions between nodes in different graphs.
这些关系抽取模型部分是通用的关系抽取方法,部分用于金融领域的关系抽取模型,并没有针对数据库运维领域设计的关系抽取方法。另外,大多数现有的基于依赖关系的方法在对事件之间的语义上下文进行建模时,通常平等地对待不同类型的依赖关系,导致事件关系提取的性能下降。Some of these relationship extraction models are general relationship extraction methods, and some are relationship extraction models used in the financial field. There are no relationship extraction methods designed for the database operation and maintenance field. In addition, most existing dependency-based methods usually treat different types of dependencies equally when modeling the semantic context between events, leading to performance degradation in event relationship extraction.
发明内容Contents of the invention
发明目的:针对以上缺点,本发明提供一种基于TGGAT和CNN的系统运行异常事件关系抽取方法,包括以下步骤:Purpose of the invention: In view of the above shortcomings, the present invention provides a method for extracting abnormal event relationships in system operation based on TGGAT and CNN, which includes the following steps:
(1)获取文本数据,并进行预处理;(1) Obtain text data and perform preprocessing;
(2)运用BERT模型处理预处理后的文本数据,生成特征向量矩阵;(2) Use the BERT model to process the preprocessed text data and generate a feature vector matrix;
(3)将特征向量矩阵输入多尺度卷积神经网络CNN,提取句子的局部特征;将特征向量矩阵输入类型引导图注意网络TGGAT,提取句子的全局特征;(3) Input the feature vector matrix into the multi-scale convolutional neural network CNN to extract the local features of the sentence; input the feature vector matrix into the type guided graph attention network TGGAT to extract the global features of the sentence;
(4)将局部特征和全局特征进行拼接,然后通过自注意力得到经过注意力值加权后的表征向量矩阵;(4) Splice local features and global features, and then obtain a representation vector matrix weighted by attention values through self-attention;
(5)使用softmax分类器对加权后的表征向量矩阵进行事件关系分类。(5) Use the softmax classifier to classify event relationships on the weighted representation vector matrix.
进一步的,所述步骤(1)中获取数据库系统告警日志文本数据进行预处理:在多个业务系统上的数据库中获取十多年报警日志记录的上万条文本数据。Further, in step (1), the database system alarm log text data is obtained for preprocessing: tens of thousands of text data of alarm log records for more than ten years are obtained from databases on multiple business systems.
进一步的,所述步骤(2)中生成的特征向量矩阵V的表达式如下:Further, the expression of the feature vector matrix V generated in step (2) is as follows:
其中,t表示序列长度,768表示单词向量的维度,cls表示句子的初始标签,seq表示句子的结尾标签,v表示单词向量矩阵。Among them, t represents the sequence length, 768 represents the dimension of the word vector, cls represents the initial label of the sentence, seq represents the end label of the sentence, and v represents the word vector matrix.
进一步的,所述步骤(3)中将特征向量矩阵输入多尺度卷积神经网络CNN,提取句子的局部特征具体包括:Further, in step (3), the feature vector matrix is input into the multi-scale convolutional neural network CNN, and the extraction of local features of the sentence specifically includes:
(3.11)对输入的特征向量矩阵进行一维卷积,形成局部特征向量fi:(3.11) Perform one-dimensional convolution on the input eigenvector matrix to form local eigenvector f i :
fi=ReLu(kivt:t+j-1+b)fi=ReLu(k i v t:t+j-1 +b)
其中,v表示输入的单词向量矩阵,j表示卷积核ki的窗口大小,b表示偏置值;Among them, v represents the input word vector matrix, j represents the window size of the convolution kernel k i , and b represents the bias value;
(3.12)针对n个卷积核对输入的特征向量矩阵进行n个卷积运算,形成单词向量vt上下文特征集合的高维向量Ft:(3.12) Perform n convolution operations on the input feature vector matrix for n convolution kernels to form a high-dimensional vector F t of the word vector v t context feature set:
Ft={f1,f2,...,fn}F t ={f 1 ,f 2 ,...,f n }
(3.13)对高维向量Ft进行降低维数的最大池化运算,形成单词向量vt的局部上下文特征Mt:(3.13) Perform a maximum pooling operation to reduce the dimensionality of the high-dimensional vector F t to form the local context feature M t of the word vector v t :
Mt=max(Ft),M t =max(F t ),
(3.14)对于输入长度为t的特征向量矩阵,使用卷积集K扫描整个文本,形成整个文本的局部特征集S:(3.14) For an input feature vector matrix of length t, use the convolution set K to scan the entire text to form a local feature set S of the entire text:
S={M1,M2,...,Mt}S={M 1 ,M 2 ,...,M t }
进一步的,所述步骤(3)中通过Stanford CoreNLP工具获得输入特征向量矩阵中句子的句法依赖树,通过在句法依赖树中构建输入句子的句法结构,将句子转换为图结构进行表示,其中将单词表示为节点,将句法依赖树构造单词之间的依赖关系表示为边;Further, in step (3), the Stanford CoreNLP tool is used to obtain the syntactic dependency tree of the sentence in the input feature vector matrix, and by constructing the syntactic structure of the input sentence in the syntactic dependency tree, the sentence is converted into a graph structure for representation, where Words are represented as nodes, and the dependencies between words constructed from a syntactic dependency tree are represented as edges;
将特征向量矩阵输入类型引导图注意网络TGGAT,提取句子的全局特征具体包括:Input the feature vector matrix into the type guided graph attention network TGGAT, and extract the global features of the sentence, including:
(3.21)使用TGGAT通过类型引导对句子的句法依赖树进行建模,获得与句子中每个单词相关的句法知识,然后利用依赖路径来转移和聚合句子中的单词信息,得到每个节点和所有相邻单词的注意力值为:(3.21) Use TGGAT to model the syntactic dependency tree of the sentence through type guidance, obtain the syntactic knowledge related to each word in the sentence, and then use the dependency path to transfer and aggregate the word information in the sentence to obtain each node and all The attention value of adjacent words is:
其中,W表示可学习的权重矩阵,a表示单层前馈反馈网络,表示节点i的语义向量,/>表示节点j的语义向量,/>表示节点i和节点j的依赖路径;Among them, W represents the learnable weight matrix, a represents a single-layer feedforward feedback network, Represents the semantic vector of node i, /> Represents the semantic vector of node j, /> Represents the dependency path of node i and node j;
(3.22)使用SoftMax函数对注意力值进行归一化,得到注意力系数:(3.22) Use the SoftMax function to normalize the attention value and obtain the attention coefficient:
αi,r,j=softmax(di,r,t)α i,r,j =softmax(d i,r,t )
(3.23)通过注意力系数的加权求和,以及将原始节点i的初始信息相加,聚合计算得到节点i的新向量特征 (3.23) Through the weighted summation of attention coefficients and the addition of the initial information of the original node i, the new vector feature of the node i is obtained by aggregation calculation
其中,σ表示激活函数,Wr、W0表示可学习的权重,Ni是节点i在句法依赖图中所有邻居节点j的集合,R是节点i在句法依赖图中所有边的集合;Among them, σ represents the activation function, W r and W 0 represent the learnable weights, Ni is the set of all neighbor nodes j of node i in the syntactic dependency graph, and R is the set of all edges of node i in the syntactic dependence graph;
(3.24)句子的全局特征如下:(3.24) The global characteristics of the sentence are as follows:
进一步的,所述步骤(4)中将局部特征和全局特征进行拼接,然后通过自注意力得到经过注意力值加权后的表征向量矩阵,具体公式如下:Further, in step (4), local features and global features are spliced, and then a representation vector matrix weighted by attention values is obtained through self-attention. The specific formula is as follows:
HS=contact(H,S)HS=contact(H,S)
Q=Wq·HSQ=W q ·HS
K=Wk·HSK= Wk ·HS
V=Wv·HSV= Wv ·HS
A′=softmax(KT·Q)A′=softmax(K T ·Q)
O=V·A′O=V·A′
其中,contact表示拼接函数,Q表示查询向量,Wq表示查询矩阵,K表示键向量,Wk表示键矩阵,V表示值向量,Wv表示值矩阵,A′表示对查询向量和键向量计算内积并缩放归一化得到的权重,O表示表征向量矩阵。Among them, contact represents the splicing function, Q represents the query vector, W q represents the query matrix, K represents the key vector, W k represents the key matrix, V represents the value vector, W v represents the value matrix, and A′ represents the calculation of the query vector and key vector. Inner product and scale the weights obtained by normalization, O represents the representation vector matrix.
进一步的,所述步骤(5)中使用softmax分类器来预测文本中事件对的关系,并输出y以获得事件关系分类:Further, in step (5), a softmax classifier is used to predict the relationship between event pairs in the text, and y is output to obtain event relationship classification:
y=relu(O·w+b)y=relu(O·w+b)
其中,w和b是全连接层的参数和偏置条目。Among them, w and b are the parameters and bias entries of the fully connected layer.
本发明还采用一种基于TGGAT和CNN的系统运行异常事件关系抽取系统,包括:The present invention also adopts a system operation abnormal event relationship extraction system based on TGGAT and CNN, including:
获取模块,用于获取文本数据,并进行预处理;Obtain module, used to obtain text data and perform preprocessing;
处理模块,用于运用BERT模型处理预处理后的文本数据,生成特征向量矩阵;将特征向量矩阵输入多尺度卷积神经网络CNN,提取句子的局部特征;将特征向量矩阵输入类型引导图注意网络TGGAT,提取句子的全局特征;The processing module is used to process the preprocessed text data using the BERT model and generate a feature vector matrix; input the feature vector matrix into the multi-scale convolutional neural network CNN to extract the local features of the sentence; input the feature vector matrix into the type guidance graph attention network TGGAT, extracts global features of sentences;
拼接模块,用于将局部特征和全局特征进行拼接,然后通过自注意力得到经过注意力值加权后的表征向量矩阵;The splicing module is used to splice local features and global features, and then obtain a representation vector matrix weighted by attention values through self-attention;
分类模块,用于使用softmax分类器对加权后的表征向量矩阵进行事件关系分类。The classification module is used to classify event relationships using a softmax classifier on the weighted representation vector matrix.
有益效果:本发明相对于现有技术,其显著优点是通过类型引导图注意网络不仅可以捕获长程句法依赖关系,还可以捕获类型信息,这对于捕获事件的全局上下文语义信息至关重要。事件关系提取任务中的大多数句子属于长程难句,其中两个相关单词可能相距遥远,句法结构复杂,不同类型的依赖关系可能会有不同的贡献,使得仅使用句子的表面信息难以准确捕捉全局事件知识。因此,引入句法信息来整理句子的结构,并对句法中的类型相关知识进行建模,以进一步捕捉全局特征。Beneficial effects: Compared with the existing technology, the significant advantage of the present invention is that the type-guided graph attention network can not only capture long-range syntactic dependencies, but also capture type information, which is crucial for capturing global contextual semantic information of events. Most sentences in the event relationship extraction task are long-range difficult sentences, in which two related words may be far apart, the syntactic structure is complex, and different types of dependencies may have different contributions, making it difficult to accurately capture the overall situation using only the surface information of the sentence. Event knowledge. Therefore, syntactic information is introduced to organize the structure of sentences, and type-related knowledge in syntax is modeled to further capture global features.
附图说明Description of the drawings
图1为本发明数据库异常事件关系抽取流程示意图;Figure 1 is a schematic diagram of the database abnormal event relationship extraction process of the present invention;
图2为本发明事件关系抽取系统结构框图;Figure 2 is a structural block diagram of the event relationship extraction system of the present invention;
图3为本发明示例句子的句法依赖树示意图;Figure 3 is a schematic diagram of a syntactic dependency tree of an example sentence of the present invention;
图4为本发明中TGGAT的注意力机制的原理结构图。Figure 4 is a schematic structural diagram of the attention mechanism of TGGAT in the present invention.
具体实施方式Detailed ways
实施例1Example 1
如图1所示,本实施例中一种基于TGGAT和CNN的系统运行异常事件关系抽取方法,包括以下步骤:As shown in Figure 1, in this embodiment, a system operation abnormal event relationship extraction method based on TGGAT and CNN includes the following steps:
(1)在多个业务系统上的Oracle数据库中获取十多年报警日志记录的上万条文本数据。(1) Obtain tens of thousands of text data recorded in alarm logs for more than ten years from Oracle databases on multiple business systems.
(2)对步骤(1)获取的Oracle数据库日志文本数据进行数据清洗与预处理。数据清洗包括主要包括去除不需要的字段、格式不一致的文本;对清洗后的数据库系统日志文本数据进行预处理,将日告警日志划分为句子,并使用BERT+CRF模型提取触发词。例如“由于事务[等待]资源会导致队列资源[陷入]僵局”,其中“等待”和“陷入”是触发单词。然后,根据事件对的类型、原因、伴随、处置、携带和子事件类别,将其标记为五类,分别用数字0、1、2、3和4表示形成数据集。最后,将数据集按8:1:1的比例划分为训练集、验证集和测试集,用于Oracle数据库事件关系提取的模型训练。(2) Perform data cleaning and preprocessing on the Oracle database log text data obtained in step (1). Data cleaning mainly includes removing unnecessary fields and text with inconsistent formats; preprocessing the cleaned database system log text data, dividing daily alarm logs into sentences, and using the BERT+CRF model to extract trigger words. For example, "The queue resource [is] deadlocked due to the transaction [waiting] for the resource", where "waiting" and "trapped" are the trigger words. Then, according to the type, cause, accompanying, disposition, carrying and sub-event categories of the event pairs, they are marked into five categories, respectively represented by numbers 0, 1, 2, 3 and 4 to form a data set. Finally, the data set is divided into a training set, a validation set and a test set in a ratio of 8:1:1 for model training of Oracle database event relationship extraction.
(3)将预处理后的数据输入编码器。运用BERT模型处理预处理后的文本数据。将输入的告警文本语句{w1,w2,…,wt}生成为特征向量矩阵V。特征向量矩阵V的表达式如下:(3) Input the preprocessed data into the encoder. Use the BERT model to process preprocessed text data. Generate the input alarm text sentence {w 1 , w 2 ,..., w t } into a feature vector matrix V. The expression of the eigenvector matrix V is as follows:
其中,t是序列长度,768是单词向量的维度,cls是句子的初始标签,seq是句子的结尾标签,v表示单词向量矩阵,并且可以通过Bert模型将输入的每个句子转换为特征向量矩阵。Among them, t is the sequence length, 768 is the dimension of the word vector, cls is the initial label of the sentence, seq is the end label of the sentence, v represents the word vector matrix, and each input sentence can be converted into a feature vector matrix through the Bert model .
(4)将步骤(3)中生成的特征向量矩阵V输入到多尺度卷积神经网络CNN层,提取句子的局部特征。使用卷积核K对特征向量矩阵V进行卷积计算,对得到局部特征Ft设计池化层降低其维度,最终得到词向量的句法特征。在事件关系提取任务中,K={k1,k2,…,kn}是卷积核的集合,n是卷积核数。具体包括:(4) Input the feature vector matrix V generated in step (3) to the multi-scale convolutional neural network CNN layer to extract the local features of the sentence. The convolution kernel K is used to perform convolution calculation on the feature vector matrix V, and a pooling layer is designed to reduce the dimension of the obtained local feature F t , and finally the syntactic features of the word vector are obtained. In the event relationship extraction task, K = {k 1 , k 2 ,..., k n } is a set of convolution kernels, and n is the number of convolution kernels. Specifically include:
(4.11)对输入的特征向量矩阵进行一维卷积,目标词向量可以形成局部特征向量fi。具体公式如下:(4.11) Perform one-dimensional convolution on the input feature vector matrix, and the target word vector can form a local feature vector fi . The specific formula is as follows:
fi=ReLu(kivt:t+j-1+b)f i =ReLu(k i v t:t+j-1 +b)
其中,v表示输入的单词向量矩阵,j表示卷积核ki的窗口大小,b表示偏置值。Among them, v represents the input word vector matrix, j represents the window size of the convolution kernel k i , and b represents the bias value.
(4.12)卷积核的整个集合K作用于窗口中心词向量,并形成该词向量vt的不同局部特征,得到单词向量vt上下文特征集合的高维向量Ft。n个卷积运算表示如下:(4.12) The entire set K of convolution kernels acts on the window center word vector and forms different local features of the word vector v t , obtaining a high-dimensional vector F t of the context feature set of the word vector v t . n convolution operations are expressed as follows:
vt=Ft={f1,f2,...,fn}v t =F t ={f 1 ,f 2 ,...,f n }
其中,Ft是在n次卷积运算之后由目标词vt形成的上下文特征的集合。Among them, F t is the set of contextual features formed by the target word v t after n convolution operations.
(4.13)由于Ft是一个多特征的高维向量,使用池化操作来降低其维数。作为显著特征的因果语义角色词可以使用最大池化运算作为特征保留,其表达式为:(4.13) Since F t is a high-dimensional vector with multiple features, pooling operations are used to reduce its dimensionality. Causal semantic role words as salient features can be retained as features using the max pooling operation, and its expression is:
Mt=max(Ft)M t =max(F t )
(4.14)每个局部特征向量fi在最大池化操作之后保留的特征m被完全连接以固定其维度输出,并最终形成中心词向量vt的局部上下文表示,其表达式为:(4.14) The features m retained after each local feature vector f i after the max pooling operation are fully connected to fix its dimension output, and finally form the local context representation of the central word vector v t , whose expression is:
Vt=Mt={m1,m2,...,mn}V t =M t ={m 1 ,m 2 ,...,m n }
(4.15)对于输入长度为t的特征向量矩阵,使用卷积集K扫描整个文本,以形成具有以下表达式的整个文本的局部特征集S:(4.15) For an input feature vector matrix of length t, the entire text is scanned using the convolution set K to form a local feature set S of the entire text with the following expression:
S={V1,V2,...,Vt}={M1,M2,...,Mt}S={V 1 , V 2 ,..., V t }={M 1 , M 2 ,..., M t }
(5)将步骤(3)中生成的特征向量矩阵V输入到TGGAT模型中,将类型依赖性添加到图注意力机制计算中,聚合文本的关键信息。使用Stanford CoreNLP工具获得输入句子的句法依赖树。例如,“由于事务等待资源会导致队列资源陷入僵局”的句法依赖树如图3所示。引入句法信息来整理句子的结构,并对句法中的类型相关知识进行建模,以进一步捕捉全局特征。在BERT编码层之后,使用TGGAT对句法树进行编码,不仅提取单词的语义特征,还提取句法依赖特征,以增强模型对句子的理解,使关系提取更加准确。(5) Input the feature vector matrix V generated in step (3) into the TGGAT model, add type dependency to the calculation of the graph attention mechanism, and aggregate the key information of the text. Use the Stanford CoreNLP tool to obtain the syntactic dependency tree of the input sentence. For example, the syntactic dependency tree of "queue resources will be deadlocked due to transactions waiting for resources" is shown in Figure 3. Syntactic information is introduced to organize the structure of sentences, and type-related knowledge in syntax is modeled to further capture global features. After the BERT encoding layer, TGGAT is used to encode the syntactic tree to extract not only the semantic features of the words, but also the syntactic dependency features to enhance the model's understanding of the sentence and make the relationship extraction more accurate.
通过在句法依赖树中构建输入句子的句法结构,将单词表示为节点,将句法依赖树构造单词之间的依赖关系表示为边,可以将句子转换为图结构进行表示。也就是说,在图中,本文通过句法依赖树将文本中的类型依赖信息转换为相应的邻接矩阵A。矩阵中的每个元素ai,j表示第i个词和第j个词之间是否存在依赖关系。如果两个单词之间存在依赖关系,则ai,j=1,否则ai,j=0,如图4所示。By constructing the syntactic structure of the input sentence in a syntactic dependency tree, representing words as nodes, and expressing the dependency relationships between words constructed in the syntactic dependency tree as edges, the sentence can be converted into a graph structure for representation. That is to say, in the figure, this article converts the type dependency information in the text into the corresponding adjacency matrix A through the syntactic dependency tree. Each element a i,j in the matrix indicates whether there is a dependency relationship between the i-th word and the j-th word. If there is a dependency relationship between two words, then a i,j =1, otherwise a i,j =0, as shown in Figure 4.
将特征向量矩阵输入类型引导图注意网络TGGAT,提取句子的全局特征具体包括:Input the feature vector matrix into the type guided graph attention network TGGAT, and extract the global features of the sentence, including:
(5.11)为了充分利用句子的句法信息,使用TGGAT通过类型引导对句子的句法依赖树进行建模,以获得与句子中每个单词相关的句法知识,然后有效地利用依赖路径来转移和聚合句子中的单词信息。从而增强了单词的特征表示。每个节点和所有相邻单词的注意力值为:(5.11) In order to fully utilize the syntactic information of the sentence, use TGGAT to model the syntactic dependency tree of the sentence through type guidance to obtain the syntactic knowledge related to each word in the sentence, and then effectively utilize the dependency path to transfer and aggregate the sentences word information in . This enhances the feature representation of words. The attention value of each node and all adjacent words is:
其中,W表示可学习的权重矩阵,a表示单层前馈反馈网络,表示节点i的语义向量,/>表示节点j的语义向量,/>表示节点i和节点j的依赖路径。Among them, W represents the learnable weight matrix, a represents a single-layer feedforward feedback network, Represents the semantic vector of node i, /> Represents the semantic vector of node j, /> Represents the dependency path of node i and node j.
(5.12)使用SoftMax函数对中心节点和所有相邻实体的注意力值进行归一化,归一化后的注意力权重是最终的注意力系数:(5.12) Use the SoftMax function to normalize the attention values of the central node and all adjacent entities. The normalized attention weight is the final attention coefficient:
(5.13)节点的新向量表示是计算出的注意力系数的加权求和,并将原始节点的初始信息相加。聚合计算得到节点i的新向量特征 (5.13) The new vector representation of a node is a weighted summation of the calculated attention coefficients, summed with the initial information of the original node. Aggregation calculation obtains the new vector feature of node i
其中,σ表示激活函数,Wr、W0表示可学习的权重,Ni是节点i在句法依赖图中所有邻居节点j的集合,R是节点i在句法依赖图中所有边的集合。Among them, σ represents the activation function, W r and W 0 represent the learnable weights, Ni is the set of all neighbor nodes j of node i in the syntactic dependency graph, and R is the set of all edges of node i in the syntactic dependence graph.
(5.14)为了进一步区分不同语境特征的重要性,本方案增加了多头注意机制。注意机制可以满足区分不同上下文的需要,帮助模型关注句子中的一些重要信息,而忽略不相关的上下文信息:(5.14) In order to further distinguish the importance of different contextual features, this solution adds a multi-head attention mechanism. The attention mechanism can meet the need to distinguish different contexts and help the model focus on some important information in the sentence while ignoring irrelevant contextual information:
(5.15)输入文本的全局特征矩阵如下:(5.15) The global feature matrix of the input text is as follows:
(6)将步骤(4)中得到的局部特征向量和步骤(5)中得到的全局特征向量进行拼接,使用自注意力来计算文本中每个单词与其他单词之间的注意力值,使单词之间相互关联,从而使每个单词具有不同的重要性,得到加权后的表征向量矩阵,具体公式如下:(6) Splice the local feature vector obtained in step (4) and the global feature vector obtained in step (5), and use self-attention to calculate the attention value between each word and other words in the text, so that Words are related to each other, so that each word has different importance, and a weighted representation vector matrix is obtained. The specific formula is as follows:
HS=contact(H,S)HS=contact(H,S)
Q=Wq·HSQ=W q ·HS
K=Wk·HSK= Wk ·HS
V=Wv·HSV= Wv ·HS
A′=softmax(KT·Q)A′=softmax(K T ·Q)
O=V·A′O=V·A′
其中,contact表示拼接函数,Q表示查询向量,Wq表示查询矩阵,K表示键向量,Wk表示键矩阵,V表示值向量,Wv表示值矩阵,A′表示对查询向量和键向量计算内积并缩放归一化得到的权重,O表示表征向量矩阵。Among them, contact represents the splicing function, Q represents the query vector, W q represents the query matrix, K represents the key vector, W k represents the key matrix, V represents the value vector, W v represents the value matrix, and A′ represents the calculation of the query vector and key vector. Inner product and scale the weights obtained by normalization, O represents the representation vector matrix.
(7)使用softmax分类器对加权后的表征向量矩阵进行事件关系分类,输出y以获得事件关系分类:(7) Use the softmax classifier to classify the event relationship on the weighted representation vector matrix, and output y to obtain the event relationship classification:
y=relu(O·w+b)y=relu(O·w+b)
其中,w和b是全连接层的参数和偏置条目。Among them, w and b are the parameters and bias entries of the fully connected layer.
实施例2Example 2
如图2所示,本实施例中一种基于类型引导图注意网络(type-guided graphattention network,TGGAT)和CNN的系统运行异常事件关系抽取系统,包括获取模块,用于获取文本数据,并进行预处理;处理模块,用于运用BERT模型处理预处理后的文本数据,生成特征向量矩阵;将特征向量矩阵输入多尺度卷积神经网络CNN,提取句子的局部特征;将特征向量矩阵输入类型引导图注意网络TGGAT,提取句子的全局特征;拼接模块,用于将局部特征和全局特征进行拼接,然后通过自注意力得到经过注意力值加权后的表征向量矩阵;分类模块,用于使用softmax分类器对加权后的表征向量矩阵进行事件关系分类。As shown in Figure 2, in this embodiment, a system based on type-guided graph attention network (TGGAT) and CNN runs an abnormal event relationship extraction system, including an acquisition module for acquiring text data and performing Preprocessing; processing module, used to use the BERT model to process preprocessed text data and generate a feature vector matrix; input the feature vector matrix into the multi-scale convolutional neural network CNN to extract the local features of the sentence; guide the input type of the feature vector matrix The graph attention network TGGAT extracts the global features of the sentence; the splicing module is used to splice local features and global features, and then obtains the representation vector matrix weighted by the attention value through self-attention; the classification module is used to classify using softmax The device classifies event relationships on the weighted representation vector matrix.
运用BERT模型对输入文本进行编码,得到语义特征向量矩阵。然后,为了提取全局信息,类型引导图注意网络以类型依赖知识为引导信号,对文本的句法依赖树进行编码。同时,CNN用于提取局部信息,以增强文本的代表性。Use the BERT model to encode the input text and obtain a semantic feature vector matrix. Then, in order to extract global information, the type-guided graph attention network uses type dependency knowledge as the guiding signal to encode the syntactic dependency tree of the text. At the same time, CNN is used to extract local information to enhance the representativeness of the text.
通过类型引导图注意网络不仅可以捕获长程句法依赖关系,还可以捕获类型信息,这对于捕获事件的全局上下文语义信息至关重要。事件关系提取任务中的大多数句子属于长程难句,其中两个相关单词可能相距遥远,句法结构复杂,使得仅使用句子的表面信息难以准确捕捉全局事件知识。因此,引入句法信息来整理句子的结构,并对句法中的类型相关知识进行建模,以进一步捕捉全局特征。The type-guided graph attention network not only captures long-range syntactic dependencies but also type information, which is crucial for capturing global contextual semantic information of events. Most sentences in the event relationship extraction task are long-range difficult sentences, in which two related words may be far apart and have complex syntactic structures, making it difficult to accurately capture global event knowledge using only the surface information of the sentence. Therefore, syntactic information is introduced to organize the structure of sentences, and type-related knowledge in syntax is modeled to further capture global features.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311178825.8A CN117271701A (en) | 2023-09-13 | 2023-09-13 | Method and system for extracting system operation abnormal event relation based on TGGAT and CNN |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311178825.8A CN117271701A (en) | 2023-09-13 | 2023-09-13 | Method and system for extracting system operation abnormal event relation based on TGGAT and CNN |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117271701A true CN117271701A (en) | 2023-12-22 |
Family
ID=89207307
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311178825.8A Pending CN117271701A (en) | 2023-09-13 | 2023-09-13 | Method and system for extracting system operation abnormal event relation based on TGGAT and CNN |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117271701A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117725468A (en) * | 2024-02-06 | 2024-03-19 | 四川鸿霖科技有限公司 | Intelligent medical electric guarantee method and system |
-
2023
- 2023-09-13 CN CN202311178825.8A patent/CN117271701A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117725468A (en) * | 2024-02-06 | 2024-03-19 | 四川鸿霖科技有限公司 | Intelligent medical electric guarantee method and system |
CN117725468B (en) * | 2024-02-06 | 2024-04-26 | 四川鸿霖科技有限公司 | Intelligent medical electric guarantee method and system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Deshmukh et al. | Towards accurate duplicate bug retrieval using deep learning techniques | |
CN111191002B (en) | Neural code searching method and device based on hierarchical embedding | |
CN111274405A (en) | A text classification method based on GCN | |
CN109446341A (en) | The construction method and device of knowledge mapping | |
CN114547298B (en) | Biomedical relation extraction method, device and medium based on combination of multi-head attention and graph convolution network and R-Drop mechanism | |
CN113255320A (en) | Entity relation extraction method and device based on syntax tree and graph attention machine mechanism | |
CN111984791B (en) | Attention mechanism-based long text classification method | |
CN113254675B (en) | Knowledge graph construction method based on adaptive few-shot relation extraction | |
CN114896388A (en) | A Hierarchical Multi-Label Text Classification Method Based on Mixed Attention | |
CN113742733B (en) | Method and device for extracting trigger words of reading and understanding vulnerability event and identifying vulnerability type | |
CN113407660A (en) | Unstructured text event extraction method | |
CN116304748B (en) | Method, system, device and medium for calculating text similarity | |
CN114897167A (en) | Method and device for constructing knowledge graph in biological field | |
CN114648029A (en) | A Named Entity Recognition Method in Electric Power Field Based on BiLSTM-CRF Model | |
CN110851593A (en) | Complex value word vector construction method based on position and semantics | |
Ogaga et al. | Evaluation and Comparison of SVM, Deep Learning, and Naïve Bayes Performances for Natural Language Processing Text Classification Task | |
CN118964648B (en) | Enhanced retrieval method and system for power vector knowledge base based on artificial intelligence | |
CN117271701A (en) | Method and system for extracting system operation abnormal event relation based on TGGAT and CNN | |
CN113569014A (en) | Operation and maintenance project management method based on multi-granularity text semantic information | |
CN117651066A (en) | Manufacturing service recommendation method based on bidirectional sequence features and topic semantic model | |
CN117573869A (en) | Network connection resource key element extraction method | |
CN114580738B (en) | A social media crisis event prediction method and system | |
CN111767388B (en) | Candidate pool generation method | |
CN115759095A (en) | Named entity recognition method and device for tobacco plant diseases and insect pests | |
CN114595324A (en) | Method, device, terminal and non-transitory storage medium for power grid service data domain division |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |