Method, device and apparatus for determining result event
By utilizing a directed hyperbolic graph attention layer to enhance causal reasoning in financial risk analysis, the method addresses the limitations of Bayesian networks, improving prediction accuracy by reflecting complex hierarchical event structures.
Patent Information
- Application Number
- CN202210707394.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-21
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2042-06-21
AI Technical Summary
Existing methods for causal reasoning in Bayesian networks fail to accurately reflect the complex hierarchical structure information between events, leading to poor prediction accuracy in financial risk analysis.
Employing a directed hyperbolic graph attention layer to aggregate and update information in a hyperbolic space, which better reflects the complex hierarchical structure information between events, using hyperbolic projection to enhance prediction accuracy.
Improves the accuracy of prediction results by effectively capturing the hierarchical relationships between events, enhancing the reliability of financial risk analysis.
Smart Images

Figure CN115098697B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to artificial intelligence technology, and more particularly to a method, device, and apparatus for determining a result event. Background Art
[0002] With the development and progress of science and technology and society, it is very necessary to predict financial risks in advance in order to ensure the stable development of the economy. In particular, when a risk event occurs, it is necessary to quickly infer the outcome of the risk event through a model to provide guidance for investment and risk control.
[0003] In the prior art, for causal reasoning between events, the fitting coefficients of the Bayesian network between multivariate time series are used as an adjacency matrix to represent the causality between variables.
[0004] However, the prediction results of the above method are not accurate enough. Summary of the invention
[0005] The present disclosure provides a method, device, and apparatus for determining a result event to improve the accuracy of prediction results.
[0006] According to a first aspect of the present disclosure, a method for determining a result event is provided, comprising:
[0007] Obtain an event to be predicted, and determine a sub-graph in a preset event graph according to the event to be predicted; wherein the graph includes a plurality of event nodes, the event nodes are connected by edges, and the event nodes connected by the edges have causal relationship strength information;
[0008] Encode each event node in the sub-graph to obtain a first encoding vector of the event node;
[0009] Mapping the first encoding vector to a hyperbolic space to obtain a second encoding vector for each event node in the subgraph;
[0010] Determine a first alternative vector and a second alternative vector of an event node in the sub-graph according to the causal relationship between event nodes in the sub-graph and the second encoding vector of the event node; wherein the first alternative vector of the event node includes information of a result event node of the event node, and the second alternative vector of the event node includes information of a cause event node of the event node;
[0011] According to the first replacement vector and the second replacement vector of the event node in the sub-graph, a result event of the event to be predicted is determined in the event node of the sub-graph.
[0012] According to a second aspect of the present disclosure, a device for determining a result event is provided, comprising:
[0013] A sub-graph determination unit is used to obtain an event to be predicted, and determine a sub-graph in a preset event graph according to the event to be predicted; wherein the graph includes a plurality of event nodes, the event nodes are connected by edges, and the event nodes connected by the edges have causal relationship strength information;
[0014] An encoding unit, used for encoding each event node in the sub-graph to obtain a first encoding vector of the event node;
[0015] A coding updating unit, used for mapping the first coding vector to a hyperbolic space to obtain a second coding vector for each event node in the sub-graph;
[0016] The encoding update unit is further used to determine a first alternative vector and a second alternative vector of an event node in the sub-graph according to the causal relationship between the event nodes in the sub-graph and the second encoding vector of the event node; wherein the first alternative vector of the event node includes information of a result event node of the event node, and the second alternative vector of the event node includes information of a cause event node of the event node;
[0017] A prediction unit is used to determine a result event of the event to be predicted in the event node of the sub-graph according to the first replacement vector and the second replacement vector of the event node in the sub-graph.
[0018] According to a third aspect of the present disclosure, an electronic device is provided, including a memory and a processor; wherein:
[0019] The memory is used to store computer programs;
[0020] The processor is used to read the computer program stored in the memory and execute the method for determining the result event as described in the first aspect according to the computer program in the memory.
[0021] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the method for determining a result event as described in the first aspect is implemented.
[0022] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program, which, when executed by a processor, implements the method for determining a result event as described in the first aspect.
[0023] The method, device and equipment for determining the result event provided by the present disclosure include: obtaining the event to be predicted, and determining a sub-graph in a preset cause-and-effect graph according to the event to be predicted; wherein the graph includes multiple event nodes, the event nodes are connected by edges, and the event nodes connected by the edges have causal relationship strength information; encoding each event node in the sub-graph to obtain a first encoding vector of the event node; mapping the first encoding vector to a hyperbolic space to obtain a second encoding vector of each event node in the sub-graph; determining a first replacement vector and a second replacement vector of the event node in the sub-graph according to the causal relationship between the event nodes in the sub-graph and the second encoding vector of the event node; wherein the first replacement vector of the event node includes information on the result event node of the event node, and the second replacement vector of the event node includes information on the cause event node of the event node; determining the result event of the event to be predicted in the event node of the sub-graph according to the first replacement vector and the second replacement vector of the event node in the sub-graph. In the method, device, and equipment for determining the result event provided by this solution, through hyperbolic projection, a directed hyperbolic graph attention layer is used to aggregate and update information in the hyperbolic space, which can better reflect the complex hierarchical structure information between events, thereby improving the accuracy of the prediction results. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 A flowchart of a method for determining a result event is shown as an exemplary embodiment of the present disclosure;
[0025] Figure 2 A flowchart of a method for determining a result event is shown as another exemplary embodiment of the present disclosure;
[0026] Figure 3 A schematic diagram of a process for determining a result event according to an exemplary embodiment of the present disclosure;
[0027] Figure 4 A structural diagram of a device for determining a result event according to an exemplary embodiment of the present disclosure;
[0028] Figure 5 The present invention is a structural diagram of an electronic device according to an exemplary embodiment of the present invention. DETAILED DESCRIPTION
[0029] With the development and progress of science and technology and society, it is very necessary to predict financial risks in advance in order to ensure the stable development of the economy. In particular, when a risk event occurs, it is necessary to quickly infer the result event of the risk event through the model to provide guidance for investment and risk control. The core problem of its reasoning is how to better embed causal events so that this embedding can reflect the hierarchical information between events. In the prior art, for causal reasoning between events (causal reasoning means that given a cause-result pair constructed by a premise and one of the conjectures, the prediction model needs to give the probability that the causal relationship between the cause-result pair is established), the Bayesian network fitting coefficients between multivariate time series are used as the adjacency matrix to represent the causality between variables.
[0030] However, the vector autoregression constrained by Bayesian network essentially reflects the Granger causality between variables, emphasizing the causal relationship in data rather than logic; the causal reasoning of Bayesian network reflects the Granger causality between event information, and does not reflect the complex hierarchical structure information between events well. The above problems lead to poor accuracy of prediction results.
[0031] In order to solve the above technical problems, in the solution provided by the present disclosure, through hyperbolic projection, a directed hyperbolic graph attention layer is used to aggregate and update information in the hyperbolic space, which can better reflect the complex hierarchical structure information between events and thus improve the accuracy of the prediction results.
[0032] Figure 1 The present invention is a flowchart of a method for determining a result event according to an exemplary embodiment of the present invention.
[0033] like Figure 1 As shown, the method for determining the result event provided in this embodiment includes:
[0034] Step 101, obtain the event to be predicted, and determine a sub-graph in a preset causal graph according to the event to be predicted; wherein the graph includes multiple event nodes, the event nodes are connected by edges, and the event nodes connected by the edges have causal relationship strength information.
[0035] The method provided by the present disclosure may be executed by an electronic device with computing capability, such as a computer, etc. The electronic device is capable of acquiring an event to be predicted and determining a sub-graph in a preset event graph according to the event to be predicted.
[0036] Specifically, the graph includes a preset causal graph and a sub-graph, that is, both the causal graph and the sub-graph include multiple event nodes, the event nodes are connected by edges, and the event nodes connected by the edges have causal relationship strength information.
[0037] Specifically, the event graph is pre-set. The event graph is a logical knowledge base of events, which describes the evolution rules and patterns between events. The structure is a directed cyclic graph, where nodes represent events and directed edges represent the sequence, cause and effect, and hierarchy between events. The event graph involved in this solution mainly focuses on cause and effect relationships.
[0038] Specifically, for example, in the event graph, event node A is: the dollar rises; event node B is: the oil price falls. Event node A can lead to event node B. In the event graph, event node A and event node B are connected by an edge. Event nodes A and B connected by the edge have causal relationship strength information.
[0039] Specifically, according to the event to be predicted, events that are causally related to the event to be predicted can be searched in a preset causal graph; and a sub-graph is formed by the event to be predicted and the searched events that are causally related to the event to be predicted.
[0040] Step 102, encode each event node in the sub-graph to obtain a first encoding vector of the event node.
[0041] Specifically, the sub-graph is in text form. An encoder can be used to encode each event node of the sub-graph in text form to obtain a first encoding vector of the event node. The sub-graph is converted into a vector representation.
[0042] Furthermore, the encoder can use a pre-trained language model, namely Bidirectional Encoder Representation from Transformers (BERT). BERT is a bidirectional encoder network that can obtain better dynamic embedding of the language model.
[0043] Step 103, mapping the first encoding vector to the hyperbolic space to obtain the second encoding vector of each event node in the sub-graph.
[0044] Specifically, a hyperbolic space projector can be used to transform a representation matrix X (i.e., the first encoding vector) of an event in a d-dimensional Euclidean space into a dimensional hyperbolic space matrix (i.e., the second encoding vector). Specifically, we first use a linear transformation on the event representation matrix X to map the event representation matrix to dimensional Euclidean space, and then apply an exponential transformation to project the transformed event representation matrix into dimensional hyperbolic space, the calculation method is as follows:
[0045]
[0046] Among them, W is a dimensional and trainable matrix, b is the offset term; X is the representation matrix of events in d-dimensional Euclidean space; for The representation matrix of events in the 2-dimensional hyperbolic space; O represents the Euclidean space; C represents the hyperbolic space; exp represents the exponential function with the natural constant e as the base.
[0047] Step 104, based on the causal relationship between the event nodes in the sub-graph and the second encoding vector of the event node, determine the first alternative vector and the second alternative vector of the event node in the sub-graph; wherein the first alternative vector of the event node includes information of the result event node of the event node, and the second alternative vector of the event node includes information of the cause event node of the event node.
[0048] Specifically, the evidence information can be transferred and updated from two directions (from the cause event node to the result event node; and from the result event node to the cause event node). Specifically, multiple rounds of information updates can be performed, and each round of information update can use a directed hyperbolic graph attention layer (DHGAT) to aggregate and update information in the hyperbolic space. Then, the first replacement vector and the second replacement vector of the event node in the subgraph obtained from the two directions are determined.
[0049] Among them, the first replacement vector is obtained by processing the second encoding vector through a directed hyperbolic graph attention layer from the cause event node to the result event node.
[0050] Among them, the second replacement vector is obtained by processing the second encoding vector through a directed hyperbolic graph attention layer from the result event node to the cause event node.
[0051] Specifically, since the subgraph is directed and the causal relationship is also directed, this scheme transmits and updates the evidence information from two directions, which can better reflect the complex hierarchical structure information between events.
[0052] The directed hyperbolic graph attention layer refers to the information transmission and aggregation in the hyperbolic space using graph attention, including: (1) calculating an attention score for the vector representation of the central node and neighboring nodes; (2) using the attention weight to perform weighted summation of the neighboring nodes and update the representation of the central node.
[0053] Among them, hyperbolic space is a two-dimensional curved space with uniform negative curvature everywhere. Unlike the finite sphere, it has an infinite area.
[0054] Among them, graph representation learning refers to mapping nodes into vector representations and retaining as much topological information of the graph as possible.
[0055] Among them, the attention mechanism can be considered as a resource allocation mechanism, which redistributes resources that were originally evenly distributed according to the importance of objects.
[0056] Step 105 , determining a result event of the event to be predicted in the event node of the sub-graph according to the first replacement vector and the second replacement vector of the event node in the sub-graph.
[0057] Specifically, the first replacement vector and the second replacement vector may be concatenated together to predict the result event of the event to be predicted.
[0058] Specifically, the probability of a causal relationship between the event to be predicted and each event in the sub-graph can be calculated, and the top N events with the highest probability can be determined as the result events of the event to be predicted.
[0059] Furthermore, the method for determining the result event provided by the present solution may use a pre-trained result event recognition model, input the event to be predicted into the result event recognition model, and the result event recognition model outputs the result event of the event to be predicted.
[0060] Specifically, the result event recognition model can be trained using a training data set. The training data set includes a preset event graph. The event graph includes a plurality of event nodes, and the event nodes are connected by edges, and the event nodes connected by the edges have causal relationship strength information.
[0061] The method for determining the result event provided by the present disclosure includes: obtaining the event to be predicted, determining a sub-graph in a preset event graph according to the event to be predicted; wherein the graph includes multiple event nodes, the event nodes are connected by edges, and the event nodes connected by edges have causal relationship strength information; encoding each event node in the sub-graph to obtain a first encoding vector of the event node; mapping the first encoding vector to a hyperbolic space to obtain a second encoding vector of each event node in the sub-graph; determining a first replacement vector and a second replacement vector of the event node in the sub-graph according to the causal relationship between the event nodes in the sub-graph and the second encoding vector of the event node; wherein the first replacement vector of the event node includes information of the result event node of the event node, and the second replacement vector of the event node includes information of the cause event node of the event node; determining the result event of the event to be predicted in the event node of the sub-graph according to the first replacement vector and the second replacement vector of the event node in the sub-graph. In the method adopted by the present disclosure, the information can be aggregated and updated in the hyperbolic space by using a directed hyperbolic graph attention layer through hyperbolic projection, which can better reflect the complex hierarchical structure information between events, thereby improving the accuracy of the prediction result.
[0062] Figure 2 The present invention is a flowchart of a method for determining a result event according to another exemplary embodiment of the present invention.
[0063] like Figure 2 As shown, the method for determining the result event provided in this embodiment includes:
[0064] Step 201, obtaining original text data.
[0065] The original text data may be, for example, original financial corpus.
[0066] Step 202: extract events and causal relationships between events from the original text data, and determine the strength information of the causal relationships.
[0067] Among them, the event can be a risk event, such as a loss event, a financial fraud event, a reduction of holdings event, etc.
[0068] Furthermore, elements may be extracted, wherein the elements may include the subject and time of the event.
[0069] Specifically, named entity recognition (NER) models can be used to extract events and elements from raw text data. NER (also known as entity recognition, entity segmentation, and entity extraction) is a subtask of information extraction that aims to locate and classify named entities in text into predefined categories, such as people, organizations, locations, time expressions, quantities, monetary values, percentages, etc.
[0070] Then, the NER model is used to extract the causal relationship between events and the strength information of the causal relationship.
[0071] Step 203, determining a cause-and-effect graph based on events and information on the strength of causal relationships between events.
[0072] Specifically, a causal graph is constructed based on the extracted events and the causal relationship between the events. The data is integrated into triples in the form of points, edges, and attributes and imported into the graph database for storage. (Here, triples refer to the form of "starting point-edge-end point").
[0073] Specifically, the event graph includes: multiple event nodes, the event nodes are connected by edges, and the event nodes connected by edges have causal relationship strength information.
[0074] Among them, the attribute is the strength of the causal relationship between event nodes, which can be calculated based on the semantic strength between event nodes.
[0075] Step 204, obtain the event to be predicted, and determine the anchor event similar to the event to be predicted in the event graph; wherein the graph includes multiple event nodes, the event nodes are connected by edges, and the event nodes connected by the edges have causal relationship strength information.
[0076] Specifically, one or more events similar to the premise event and the guessed event are obtained, and the specific retrieval method can use the Best Match 25 (BM25) algorithm. Among them, the BM25 algorithm is an algorithm used to evaluate the relevance between search terms and documents, and it is an algorithm proposed based on a probabilistic retrieval model.
[0077] Among them, obtaining one or more events similar to the premise event means considering the event to be predicted as the cause event, and searching the cause event connected to the event to be predicted through an edge in the event graph (the cause event and the result event are connected through one edge, which is called one hop; the cause event and the result event are connected through two edges, which is called two hops). Among them, obtaining one or more events similar to the conjectured event means considering the event to be predicted as the result event, and searching the cause event connected to the event to be predicted through an edge in the event graph.
[0078] Specifically, the premise event and the conjecture event are represented as P and H. Taking the premise event P as an example, for any event e in the set of all events in the event graph, the calculation method of its BM25 score with the premise event P is as follows:
[0079]
[0080]
[0081] Where t represents a word; k1 represents the standardized parameter of qtf; k3 represents the standardized parameter of tf; N represents the total number of events; df represents the number of events containing t; b represents an adjustable parameter; qtf is the frequency of t in event P, tf is the frequency of t in event e, l d is the length of the document, avg l is the average length of an event.
[0082] Specifically, several events related to premise P or hypothesis H obtained by using the BM25 algorithm are taken as anchor events.
[0083] Step 205, determine the evidence events related to the anchor event in the event graph.
[0084] Specifically, a breadth-first algorithm can be used based on the anchor event to search for the cause and result events within a preset number of hops in the event graph, which are called evidence events.
[0085] The preset hop count is a hop value preset according to actual conditions.
[0086] Step 206, generating a sub-graph based on the anchor event, the event to be predicted, and the evidence event.
[0087] Specifically, the evidence events, anchor events, events to be predicted, and their causal relationships (including the strength information of the causal relationships) are connected to form a sub-graph of a factual graph.
[0088] Step 207, generating an event sequence according to the causal relationship between the nodes in the sub-graph.
[0089] Specifically, according to the causal relationship between the nodes in the subgraph, the generated event sequence can be expressed as:
[0090] [CLS]C[SEP]I1...[SEP]I n [SEP]E[SEP]
[0091] Where [CLS] is the character representing the entire sequence, [SEP] serves to separate different events and can also be used as the character representing each event, C is the cause. If the target event is the cause, then C is the conjecture event. If the target event is the result, then C is the premise event. I = {I1, ..., I n} is a series of evidence events, E is the result. If the target event is the cause, E is the premise event; if the target event is the result, E is the conjecture event.
[0092] Step 208: Input the event sequence into the pre-trained language model to obtain a first encoding vector of the event sequence in the Euclidean space.
[0093] Specifically, the event sequence can be input into the pre-trained language model BERT. After obtaining the output of BERT, we use the representation vector of the [SEP] character after each event as the representation vector of this event. The representation vector of all events (i.e., the first encoding vector of the event sequence in the Euclidean space) is recorded as x = {x1, ..., x i ,...x n+2}, where x i ∈R d is the vector representation of the ith event in the subgraph, and x1 is the vector representation of the cause event, x n+2 is the vector representation of the result event; where R d Represents Euclidean space.
[0094] Step 209, mapping the first encoding vector to the hyperbolic space to obtain the second encoding vector of each event node in the sub-graph.
[0095] Specifically, the principle and implementation of step 209 are similar to those of step 103 and will not be described in detail.
[0096] Specifically, step 210A or step 210B may be executed after step 209 .
[0097] Step 210A, generating a cause-to-result graph based on the causal relationship between event nodes in the sub-graph, wherein the node representing the cause event in the cause-to-result graph points to the node representing the result event.
[0098] Specifically, a cause-to-effect graph is generated based on the causal relationship between event nodes in the sub-graph, and then the cause-to-effect graph can be used to transfer and update evidence information from the cause event node to the result event node.
[0099] Step 211, determining the first neighboring node of the first central node according to the pointing relationship of the event nodes in the cause-to-effect graph; wherein the first central node points to the first adjacent point.
[0100] The first central node is a cause node, and the first neighbor node is a result node of the first central node.
[0101] Step 212, determining a first replacement vector of the first central node according to the second encoding vector of the first central node and the second encoding vector of the first neighboring node; wherein the first replacement vector of the event node includes information of the result event node of the event node.
[0102] Specifically, step 215 is executed after step 212.
[0103] The first replacement vector is obtained by processing the second encoding vector through a directed hyperbolic graph attention layer from the cause event node to the result event node. The first replacement vector of the event node includes information about the result event node of the event node.
[0104] In one implementable manner, an attention weight between the first central node and each first neighboring node is determined according to the second encoding vector of the first central node and the second encoding vector of each first neighboring node;
[0105] Specifically, let the second encoding vector of the i-th event in the hyperbolic space (let it be the first central node) be And the second encoding vector of the jth event (let it be the first neighbor node) is The second encoding vector needs to be calculated in hyperbolic space With the second encoding vector Specifically, the second encoding vector With the second encoding vector Project back to Euclidean tangent space And calculate the attention weights between them, and treat the attention weights calculated in Euclidean space as an approximation of the attention weights calculated in hyperbolic space. The calculation method is shown in the following formula:
[0106]
[0107] Among them, Eff(i) represents the result event of event i; O represents Euclidean space; C represents hyperbolic space; MLP is a fully connected layer; i and j are positive integers; softmax represents a normalization algorithm.
[0108] A first replacement vector of the first central node is determined according to the second encoding vectors of the first neighboring nodes of the first central node and the attention weights corresponding to the first neighboring nodes.
[0109] Optionally, converting the second encoding vector of the first neighboring node into Euclidean space to obtain a third encoding vector;
[0110] Specifically, the formula for calculating the third encoding vector is as follows:
[0111]
[0112] in, is the second encoding vector of the ith event in the hyperbolic space (let it be the first central node); is the second encoding vector of the jth event (let it be the first neighboring node); C represents the hyperbolic space.
[0113] Using the attention weight of the first neighboring node, weighted sum is performed on the third encoding vectors of each first neighboring node to obtain an aggregate vector in the Euclidean space;
[0114] Specifically, the aggregation vector of the Euclidean space is as follows:
[0115]
[0116] Where Eff(i) represents the result event of event i; w ij represents the attention weight of the first neighbor node; i and j are positive integers; is the second encoding vector of the ith event in the hyperbolic space (let it be the first central node); is the second encoding vector of the jth event (let it be the first neighboring node); C represents the hyperbolic space.
[0117] The aggregate vector is mapped to the hyperbolic space to obtain the first replacement vector of the first central node.
[0118] Specifically, the first replacement vector of the first central node is as follows:
[0119]
[0120] Among them, u i Represents the aggregation vector of Euclidean space; i is a positive integer; is the second encoding vector of the ith event in the hyperbolic space (let it be the first central node); exp represents the exponential function with the natural constant e as the base; C represents the hyperbolic space.
[0121] Optionally, a plurality of hyperbolic graph attention layers are pre-set, and based on each hyperbolic graph attention layer, the second encoding vector of the first central node and the second encoding vector of the first neighboring node are processed to obtain a plurality of attention weights between the first central node and the first neighboring node;
[0122] Determine a first child replacement vector of the first central node according to the second encoding vector of the first neighboring node and the attention weight of the first neighboring node obtained by the same hyperbolic graph attention layer;
[0123] Specifically, the first child replacement vector of the first central node is as follows:
[0124]
[0125] Where Eff(i) represents the result event of event i; w ij represents the attention weight of the first neighbor node; i and j are positive integers; is the second encoding vector of the ith event in the hyperbolic space (let it be the first central node); is the second encoding vector of the jth event (let it be the first neighboring node); C represents the hyperbolic space.
[0126] A first replacement vector of a first central node is determined according to each sub-replacement vector and a preset aggregation matrix.
[0127] Specifically, the first replacement vector of the first central node is as shown in the following formula:
[0128]
[0129] Where m∈[1,k]; represents the i-th event u i About the output of the mth head in the multi-head attention mechanism; It means concatenating the vectors in brackets; is the preset aggregation matrix, which is the parameter of the neural network; ReLU is the linear rectification function, which is a commonly used activation function in artificial neural networks.
[0130] Step 210B, generating a result-to-cause graph based on the causal relationship between event nodes in the sub-graph, wherein the node representing the result event in the result-to-cause graph points to the node representing the cause event.
[0131] Specifically, according to the causal relationship between the event nodes in the sub-graph, a result-to-cause graph is generated, and then the result-to-cause graph can be used to transfer and update evidence information from the result event node to the cause event node.
[0132] Step 213, determining the second neighboring node of the second central node according to the pointing relationship of the event nodes in the result-inferred cause graph; wherein the second central node points to the second adjacent point.
[0133] The first central node is a result node, and the first neighbor node is a cause node of the first central node.
[0134] Step 214, determining a second replacement vector of the second central node according to the second encoding vector of the second central node and the second encoding vector of the second neighboring node; the second replacement vector of the event node includes information of the cause event node of the event node.
[0135] The second replacement vector is obtained by processing the second encoding vector through a directed hyperbolic graph attention layer from the result event node to the cause event node. The second replacement vector of the event node includes information about the cause event node of the event node.
[0136] In one implementable manner, determining an attention weight between the second central node and each second neighboring node according to the second encoding vector of the second central node and the second encoding vector of each second neighboring node;
[0137] Specifically, let the second encoding vector of the i-th event in the hyperbolic space (let it be the second central node) be And the second encoding vector of the jth event (let it be the second neighbor node) is The second encoding vector needs to be calculated in hyperbolic space With the second encoding vector Specifically, the second encoding vector With the second encoding vector Project back to Euclidean tangent space And calculate the attention weights between them, and treat the attention weights calculated in Euclidean space as an approximation of the attention weights calculated in hyperbolic space. The calculation method is shown in the following formula:
[0138]
[0139] Among them, Eff(i) represents the cause event of event i; O represents Euclidean space; C represents hyperbolic space; MLP is the fully connected layer; i and j are positive integers; softmax represents the normalization algorithm.
[0140] A second replacement vector of the second central node is determined according to the second encoding vectors of each second neighboring node of the second central node and the attention weights corresponding to the second neighboring nodes.
[0141] Optionally, converting the second encoding vector of the second neighboring node into Euclidean space to obtain a fourth encoding vector;
[0142] Specifically, the formula for calculating the third encoding vector is as follows:
[0143]
[0144] in, is the second encoding vector of the ith event in the hyperbolic space (let it be the second central node); is the second encoding vector of the jth event (let it be the second neighboring node); C represents the hyperbolic space.
[0145] Using the attention weight of the second neighboring node, weighted sum is performed on the fourth encoding vectors of each second neighboring node to obtain an aggregate vector in the Euclidean space;
[0146] Specifically, the aggregation vector of the Euclidean space is as follows:
[0147]
[0148] Where Eff(i) represents the result event of event i; w ij represents the attention weight of the second neighboring node; i and j are positive integers; is the second encoding vector of the ith event in the hyperbolic space (let it be the second central node); is the second encoding vector of the jth event (let it be the second neighboring node); C represents the hyperbolic space.
[0149] The aggregate vector is mapped to the hyperbolic space to obtain a second replacement vector of the second central node.
[0150] Specifically, the second replacement vector of the second central node is as follows:
[0151]
[0152] Among them, u i Represents the aggregation vector of Euclidean space; i is a positive integer; is the second encoding vector of the ith event in the hyperbolic space (let it be the second central node); exp represents the exponential function with the natural constant e as the base; C represents the hyperbolic space.
[0153] Optionally, a plurality of hyperbolic graph attention layers are pre-set, and based on each hyperbolic graph attention layer, the second encoding vector of the second central node and the second encoding vector of the second neighboring node are processed to obtain a plurality of attention weights between the second central node and the second neighboring node;
[0154] Determine a second child replacement vector of the second center node according to a second encoding vector of the second neighboring node and an attention weight of the second neighboring node obtained by the same hyperbolic graph attention layer;
[0155] Specifically, the second child replacement vector of the second central node is as follows:
[0156]
[0157] Where Eff(i) represents the result event of event i; w ij represents the attention weight of the second neighboring node; i and j are positive integers; is the second encoding vector of the ith event in the hyperbolic space (let it be the second central node); is the second encoding vector of the jth event (let it be the second neighboring node); C represents the hyperbolic space.
[0158] A second replacement vector of the second central node is determined according to each second sub-replacement vector and a preset aggregation matrix.
[0159] Specifically, the first replacement vector of the first central node is as shown in the following formula:
[0160]
[0161] Where m∈[1,k]; represents the i-th event u i About the output of the mth head in the multi-head attention mechanism; It means concatenating the vectors in brackets; is the preset aggregation matrix, which is the parameter of the neural network; ReLU is the linear rectification function, which is a commonly used activation function in artificial neural networks.
[0162] Specifically, after the information of the cause event is used to update the information of the result event through the DHGAT layer, and the information of the result event is used to update the information of the cause event, the representation update of the evidence information of all events in the sub-graph is obtained.
[0163] Step 215 , concatenate the first alternative vector and the second alternative vector of the same event node in the sub-graph to obtain the target vector of the event node.
[0164] Specifically, let u′ de Represents the vector representation of the result event in the subgraph after the deductive reasoning (cause information updates result information) is partially updated (i.e., the first replacement vector); let u′ ab A vector representation (i.e., the second replacement vector) of the cause event in the subgraph after the abductive reasoning (result information updates cause information) part is updated.
[0165] Specifically, considering the representation u′ of the cause event ab and the representation of the resulting event u′ de It is a vector representation in hyperbolic space. In order to facilitate the task of predicting the result event, u′ ab with u′ de Transformed into Euclidean space, as shown below:
[0166]
[0167] Among them, O represents Euclidean space; C represents hyperbolic space; u′ ab is the vector representation of the cause event in the hyperbolic space; u′ de is the vector representation of the resulting event in hyperbolic space.
[0168] Further, splicing u ab and u de , get the target vector of the event node.
[0169] Step 216, determining the causal probability between each event node in the sub-graph and the event to be predicted based on the target vector.
[0170] Specifically, the formula for calculating the causal probability between each event node in the subgraph and the event to be predicted is as follows:
[0171] Y = softmax(W y [u ab ,u de ]+b y )
[0172] Among them, softmax represents normalized calculation; u ab is the vector representation of the event to be predicted; u de is the vector representation of any event node in the subgraph; W y is the preset parameter; b y are preset parameters.
[0173] Step 217: determine the events indicated by the first N event nodes with the largest causal probabilities as the predicted result events of the event to be predicted.
[0174] Here, N is a preset value, for example, it can be set to 10.
[0175] Furthermore, in actual usage scenarios, after obtaining the prediction result event of the event to be predicted, the prediction probability of the prediction result event can be converted into a score in the business application for use by business personnel.
[0176] Figure 3 The figure is a schematic diagram of a process of determining a result event according to an exemplary embodiment of the present disclosure.
[0177] like Figure 3 As shown, a causal graph can be pre-constructed. Specifically, events, elements, and causal relationships between events can be extracted from the original financial corpus, and the strength information of the causal relationship can be determined to construct a causal graph;
[0178] Then, the events related to the event to be predicted are retrieved from the logical graph to obtain a sub-graph;
[0179] Encode the events in the sub-graph using an encoder to obtain a first encoding vector;
[0180] The first encoding vector is mapped to the hyperbolic space to obtain the second encoding vector of each event node in the sub-graph; the second encoding vector is processed according to the directed hyperbolic graph attention layer to obtain the first replacement vector and the second replacement vector;
[0181] Concatenate the first alternative vector and the second alternative vector of the same event node in the sub-graph to obtain the target vector of the event node;
[0182] According to the target vector, the causal probability between each event node in the sub-graph and the event to be predicted is determined; the events indicated by the first N event nodes with the largest causal probabilities are determined as the predicted result events of the event to be predicted;
[0183] After obtaining the prediction result event of the event to be predicted, the prediction probability of the prediction result event can be converted into a score in the business application for use by business personnel.
[0184] Figure 4 The present invention is a structural diagram of a device for determining a result event according to an exemplary embodiment of the present invention.
[0185] like Figure 4 As shown, the result event determination device 400 provided by the present disclosure includes:
[0186] The sub-graph determination unit 410 is used to obtain the event to be predicted, and determine the sub-graph in the preset event graph according to the event to be predicted; wherein the graph includes a plurality of event nodes, the event nodes are connected by edges, and the event nodes connected by the edges have causal relationship strength information;
[0187] The encoding unit 420 is used to encode each event node in the sub-graph to obtain a first encoding vector of the event node;
[0188] A coding updating unit 430, configured to map the first coding vector to a hyperbolic space to obtain a second coding vector for each event node in the sub-graph;
[0189] The coding updating unit 430 is further used to determine a first alternative vector and a second alternative vector of the event node in the sub-graph according to the causal relationship between the event nodes in the sub-graph and the second coding vector of the event node; wherein the first alternative vector of the event node includes information of the result event node of the event node, and the second alternative vector of the event node includes information of the cause event node of the event node;
[0190] The prediction unit 440 is used to determine the result event of the event to be predicted in the event node of the sub-graph according to the first replacement vector and the second replacement vector of the event node in the sub-graph.
[0191] The sub-graph determination unit 410 is specifically used to determine, in the event graph, an anchor event similar to the event to be predicted;
[0192] Identify the evidential events related to the anchor event in the event map;
[0193] A sub-graph is generated based on anchor events, events to be predicted, and evidence events.
[0194] The encoding unit 420 is specifically used to generate an event sequence according to the causal relationship between the nodes in the sub-graph;
[0195] The event sequence is input into the pre-trained language model to obtain the first encoding vector of the event sequence in the Euclidean space.
[0196] The coding update unit 430 is specifically used to generate a cause-to-result graph according to the causal relationship between the event nodes in the sub-graph, wherein the node representing the cause event in the cause-to-result graph points to the node representing the result event;
[0197] Determine the first neighboring node of the first central node according to the pointing relationship of the event nodes in the cause-to-result graph; wherein the first central node points to the first neighboring node;
[0198] A first replacement vector of the first central node is determined according to the second encoding vector of the first central node and the second encoding vector of the first neighboring node.
[0199] The coding updating unit 430 is specifically configured to determine the attention weight between the first central node and each first neighboring node according to the second coding vector of the first central node and the second coding vector of each first neighboring node;
[0200] A first replacement vector of the first central node is determined according to the second encoding vectors of the first neighboring nodes of the first central node and the attention weights corresponding to the first neighboring nodes.
[0201] The coding updating unit 430 is specifically configured to convert the second coding vector of the first neighboring node into the Euclidean space to obtain a third coding vector;
[0202] Using the attention weight of the first neighboring node, weighted sum is performed on the third encoding vectors of each first neighboring node to obtain an aggregate vector in the Euclidean space;
[0203] The aggregate vector is mapped to the hyperbolic space to obtain the first replacement vector of the first central node.
[0204] The encoding update unit 430 is specifically configured to pre-set a plurality of hyperbolic graph attention layers, process the second encoding vector of the first central node and the second encoding vector of the first neighboring node based on each hyperbolic graph attention layer, and obtain a plurality of attention weights between the first central node and the first neighboring node; determine a first sub-replacement vector of the first central node according to the second encoding vector of the first neighboring node and the attention weight of the first neighboring node obtained through the same hyperbolic graph attention layer;
[0205] A first replacement vector of a first central node is determined according to each sub-replacement vector and a preset aggregation matrix.
[0206] The coding update unit 430 is specifically used to generate a result-to-cause graph according to the causal relationship between the event nodes in the sub-graph, wherein the node representing the result event in the result-to-cause graph points to the node representing the cause event;
[0207] Determine the second neighboring node of the second central node according to the pointing relationship of the event node in the result-inferred cause graph; wherein the second central node points to the second neighboring node;
[0208] A second replacement vector of the second central node is determined according to the second encoding vector of the second central node and the second encoding vector of the second neighboring node.
[0209] The coding updating unit 430 is specifically configured to determine the attention weight between the second central node and each second neighboring node according to the second coding vector of the second central node and the second coding vector of each second neighboring node;
[0210] A second replacement vector of the second central node is determined according to the second encoding vectors of each second neighboring node of the second central node and the attention weights corresponding to the second neighboring nodes.
[0211] The coding updating unit 430 is specifically configured to convert the second coding vector of the second neighboring node into the Euclidean space to obtain a fourth coding vector;
[0212] Using the attention weight of the second neighboring node, weighted sum is performed on the fourth encoding vectors of each second neighboring node to obtain an aggregate vector in the Euclidean space;
[0213] The aggregate vector is mapped to the hyperbolic space to obtain a second replacement vector of the second central node.
[0214] The encoding update unit 430 is specifically configured to pre-set a plurality of hyperbolic graph attention layers, and process the second encoding vector of the second central node and the second encoding vector of the second neighboring node based on each hyperbolic graph attention layer to obtain a plurality of attention weights between the second central node and the second neighboring node;
[0215] Determine a second child replacement vector of the second center node according to a second encoding vector of the second neighboring node and an attention weight of the second neighboring node obtained by the same hyperbolic graph attention layer;
[0216] A second replacement vector of the second central node is determined according to each second sub-replacement vector and a preset aggregation matrix.
[0217] The prediction unit 440 is specifically used to concatenate the first alternative vector and the second alternative vector of the same event node in the sub-graph to obtain a target vector of the event node;
[0218] According to the target vector, determine the causal probability between each event node in the sub-graph and the event to be predicted;
[0219] The events indicated by the first N event nodes with the largest causal probabilities are determined as the predicted result events of the event to be predicted.
[0220] The result event determination device 400 provided by the present disclosure further includes:
[0221] A matter-of-fact graph determination unit 450 is used to obtain original text data;
[0222] Extracting events, elements, and causal strength information between events from raw text data;
[0223] The event graph is determined based on events, elements, and the strength of causal relationships between events. Figure 5 The present invention is a structural diagram of an electronic device according to an exemplary embodiment of the present invention.
[0224] like Figure 5 As shown, the electronic device provided in this embodiment includes:
[0225] Memory 501;
[0226] Processor 502; and
[0227] Computer programs;
[0228] The computer program is stored in the memory 501 and is configured to be executed by the processor 502 to implement any of the above methods for determining a result event.
[0229] This embodiment also provides a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor to implement any of the above methods for determining a result event.
[0230] This embodiment also provides a computer program product, including a computer program, which, when executed by a processor, implements any of the above-mentioned methods for determining a result event.
[0231] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0232] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for determining a result event, characterized in that: include: Obtain an event to be predicted, and determine a sub-graph in a preset event graph according to the event to be predicted; wherein the graph includes a plurality of event nodes, the event nodes are connected by edges, and the event nodes connected by the edges have causal relationship strength information; Encode each event node in the sub-graph to obtain a first encoding vector of the event node; Mapping the first encoding vector to a hyperbolic space to obtain a second encoding vector for each event node in the subgraph; Determine a first alternative vector and a second alternative vector of an event node in the sub-graph according to the causal relationship between event nodes in the sub-graph and the second encoding vector of the event node; wherein the first alternative vector of the event node includes information of a result event node of the event node, and the second alternative vector of the event node includes information of a cause event node of the event node; Determining a result event of the event to be predicted in the event node of the sub-graph according to a first replacement vector and a second replacement vector of the event node in the sub-graph; Determining a sub-graph in a preset event graph according to the event to be predicted includes: In the event graph, determining an anchor event similar to the event to be predicted; Determining in the event graph the evidential event related to the anchor event; Generate the sub-graph according to the anchor event, the event to be predicted, and the evidence event; The encoding of each event node in the sub-graph to obtain a first encoding vector of the event node includes: Generate an event sequence according to the causal relationship between the nodes in the sub-graph; Inputting the event sequence into a pre-trained language model to obtain a first encoding vector of the event sequence in a Euclidean space; The determining, according to the causal relationship between the event nodes in the sub-graph and the second encoding vector of the event node, a first replacement vector of the event node in the sub-graph comprises: Generate a cause-to-result graph according to the causal relationship between the event nodes in the sub-graph, wherein the node representing the cause event in the cause-to-result graph points to the node representing the result event; Determine a first neighboring node of a first central node according to the pointing relationship of event nodes in the cause-to-result graph; wherein the first central node points to the first neighboring node; Determine a first replacement vector of the first central node according to the second encoding vector of the first central node and the second encoding vector of the first neighboring node; The determining, according to the causal relationship between the event nodes in the sub-graph and the second encoding vector of the event node, the second replacement vector of the event node in the sub-graph comprises: Generate a result-to-cause graph according to the causal relationship between the event nodes in the sub-graph, wherein the node representing the result event in the result-to-cause graph points to the node representing the cause event; Determine a second neighboring node of a second central node according to the pointing relationship of event nodes in the result-inferred cause graph; wherein the second central node points to the second neighboring node; Determine a second replacement vector of the second central node according to the second encoding vector of the second central node and the second encoding vector of the second neighboring node; The determining, in the event node of the sub-graph according to the first replacement vector and the second replacement vector of the event node in the sub-graph, the result event of the event to be predicted comprises: splicing the first alternative vector and the second alternative vector of the same event node in the sub-graph to obtain a target vector of the event node; Determine the causal probability between each event node in the sub-graph and the event to be predicted according to the target vector; The events indicated by the first N event nodes with the largest causal probabilities are determined as the predicted result events of the event to be predicted.
2. The method according to claim 1, characterized in that The determining, according to the second encoding vector of the first central node and the second encoding vector of the first neighboring node, a first replacement vector of the first central node comprises: Determine an attention weight between the first central node and each of the first neighboring nodes according to the second encoding vector of the first central node and the second encoding vector of each of the first neighboring nodes; A first replacement vector of the first central node is determined according to the second encoding vectors of the first neighboring nodes of the first central node and the attention weights corresponding to the first neighboring nodes.
3. The method according to claim 2, characterized in that The determining, according to the second encoding vectors of the first neighboring nodes of the first central node and the attention weights corresponding to the first neighboring nodes, a first replacement vector of the first central node comprises: Convert the second encoding vector of the first neighboring node into Euclidean space to obtain a third encoding vector; Using the attention weights of the first neighboring nodes, weighted summation is performed on the third encoding vectors of the first neighboring nodes to obtain an aggregate vector in the Euclidean space; The aggregation vector is mapped to a hyperbolic space to obtain a first replacement vector of the first central node.
4. The method according to claim 2 or 3, characterized in that: A plurality of hyperbolic graph attention layers are pre-set, and determining the attention weight between the first central node and each of the first neighboring nodes according to the second encoding vector of the first central node and the second encoding vector of each of the first neighboring nodes includes: Processing the second encoding vector of the first central node and the second encoding vector of the first neighboring node based on each of the hyperbolic graph attention layers to obtain a plurality of attention weights between the first central node and the first neighboring node; Correspondingly, determining the first replacement vector of the first central node according to the second encoding vectors of the first neighboring nodes of the first central node and the attention weights corresponding to the first neighboring nodes includes: Determine a first child replacement vector of the first central node according to the second encoding vector of the first neighboring node and the attention weight of the first neighboring node obtained by the same hyperbolic graph attention layer; A first replacement vector of the first central node is determined according to each sub-replacement vector and a preset aggregation matrix.
5. The method according to claim 1, characterized in that The determining, according to the second encoding vector of the second central node and the second encoding vector of the second neighboring node, a second replacement vector of the second central node comprises: Determine an attention weight between the second central node and each of the second neighboring nodes according to the second encoding vector of the second central node and the second encoding vector of each of the second neighboring nodes; A second replacement vector of the second central node is determined according to the second encoding vectors of each of the second neighboring nodes of the second central node and the attention weights corresponding to the second neighboring nodes.
6. The method according to claim 5, characterized in that The determining, according to the second encoding vectors of the second neighboring nodes of the second central node and the attention weights corresponding to the second neighboring nodes, a second replacement vector of the second central node comprises: Convert the second encoding vector of the second neighboring node into Euclidean space to obtain a fourth encoding vector; Using the attention weights of the second neighboring nodes, weighted summation is performed on the fourth encoding vectors of each of the second neighboring nodes to obtain an aggregate vector in the Euclidean space; The aggregate vector is mapped to a hyperbolic space to obtain a second replacement vector of the second central node.
7. The method according to claim 5 or 6, characterized in that: A plurality of hyperbolic graph attention layers are pre-set, and the determining, according to the second encoding vector of the second central node and the second encoding vector of each of the second neighboring nodes, the attention weight between the second central node and each of the second neighboring nodes comprises: Processing the second encoding vector of the second central node and the second encoding vector of the second neighboring node based on each of the hyperbolic graph attention layers to obtain a plurality of attention weights between the second central node and the second neighboring node; Accordingly, determining the second replacement vector of the second central node according to the second encoding vectors of each of the second neighboring nodes of the second central node and the attention weights corresponding to the second neighboring nodes includes: Determine a second child replacement vector of the second central node according to the second encoding vector of the second neighboring node and the attention weight of the second neighboring node obtained by the same hyperbolic graph attention layer; A second replacement vector of the second central node is determined according to each second sub-replacement vector and a preset aggregation matrix.
8. The method according to claim 1, characterized in that Also includes: Get the original text data; Extracting events and causal relationships between events from the original text data, and determining strength information of the causal relationships; A cause-and-effect graph is determined based on the events and the causal relationship strength information between the events.
9. A device for determining a result event, characterized in that: include: A sub-graph determination unit is used to obtain an event to be predicted, and determine a sub-graph in a preset event graph according to the event to be predicted; wherein the graph includes a plurality of event nodes, the event nodes are connected by edges, and the event nodes connected by the edges have causal relationship strength information; An encoding unit, used for encoding each event node in the sub-graph to obtain a first encoding vector of the event node; A coding update unit, used for mapping the first coding vector to a hyperbolic space to obtain a second coding vector for each event node in the sub-graph; The encoding update unit is further used to determine a first alternative vector and a second alternative vector of an event node in the sub-graph according to the causal relationship between the event nodes in the sub-graph and the second encoding vector of the event node; wherein the first alternative vector of the event node includes information of a result event node of the event node, and the second alternative vector of the event node includes information of a cause event node of the event node; A prediction unit, configured to determine a result event of the event to be predicted in the event node of the sub-graph according to a first replacement vector and a second replacement vector of the event node in the sub-graph; The sub-graph determination unit is specifically used to determine, in the event graph, an anchor event similar to the event to be predicted; Determining in the event graph the evidential event related to the anchor event; Generate the sub-graph according to the anchor event, the event to be predicted, and the evidence event; The encoding unit is specifically used to generate an event sequence according to the causal relationship between the nodes in the sub-graph; Inputting the event sequence into a pre-trained language model to obtain a first encoding vector of the event sequence in a Euclidean space; The encoding update unit is specifically used to generate a cause-to-result graph according to the causal relationship between the event nodes in the sub-graph, wherein the node representing the cause event in the cause-to-result graph points to the node representing the result event; Determine a first neighboring node of a first central node according to the pointing relationship of event nodes in the cause-to-result graph; wherein the first central node points to the first neighboring node; Determine a first replacement vector of the first central node according to the second encoding vector of the first central node and the second encoding vector of the first neighboring node; The encoding update unit is specifically used to generate a result-to-cause graph according to the causal relationship between the event nodes in the sub-graph, wherein the node representing the result event in the result-to-cause graph points to the node representing the cause event; Determine a second neighboring node of a second central node according to the pointing relationship of event nodes in the result-inferred cause graph; wherein the second central node points to the second neighboring node; Determine a second replacement vector of the second central node according to the second encoding vector of the second central node and the second encoding vector of the second neighboring node; The prediction unit is specifically used to concatenate the first alternative vector and the second alternative vector of the same event node in the sub-graph to obtain the target vector of the event node; Determine the causal probability between each event node in the sub-graph and the event to be predicted according to the target vector; The events indicated by the first N event nodes with the largest causal probabilities are determined as the predicted result events of the event to be predicted.
10. An electronic device, characterized in that: comprising a memory and a processor; wherein, The memory is used to store computer programs; The processor is used to read the computer program stored in the memory and execute the method according to any one of claims 1 to 8 according to the computer program in the memory.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the method described in any one of claims 1 to 8 is implemented.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method described in any one of claims 1 to 8 is implemented.
