Causal analysis method, device and apparatus combining expert knowledge and differentiable structure
The causal analysis method integrates expert knowledge with a differentiable structure to enhance the accuracy and adaptability of causal relationship modeling in clinical data, addressing the limitations of traditional methods by iteratively updating the NOTEARS algorithm with edge constraints.
Patent Information
- Application Number
- CN202411419402.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-12
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2044-10-12
AI Technical Summary
Traditional machine learning methods struggle to accurately model complex causal relationships in clinical data due to focusing on correlation rather than causation, leading to poor model interpretability and difficulty in capturing subtle changes, while existing causal analysis tools like Bayesian networks are inadequate in dynamic environments and resource-limited settings.
A causal analysis method combining expert knowledge and a differentiable structure, using the NOTEARS algorithm to iteratively update a weighted adjacency matrix based on expert feedback, converting combinatorial optimization into continuous optimization, and integrating edge constraints to enhance model adaptability and accuracy.
The method improves causal relationship modeling accuracy and adaptability by leveraging expert knowledge, reducing resource consumption, and maintaining model adaptability in dynamic environments, enhancing the flexibility and scalability of causal discovery.
Smart Images

Figure CN118917421B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of medical information technology and data analysis, and in particular to a causal analysis method, device and equipment combining expert knowledge and a differentiable structure. Background Art
[0002] Clinical causal analysis is the core of analyzing the complex relationship between health factors and outcomes, and is crucial for guiding precision medical decision-making. However, traditional machine learning methods focus on correlation analysis, which makes it difficult to reveal causal mechanisms, resulting in poor model interpretability and difficulty in capturing the deep causes of clinical phenomena. Bayesian networks, as traditional causal analysis tools, are effective but easily overlook subtle causal changes in clinical data, affecting a comprehensive understanding of causal dynamics. In recent years, the rise of differentiable structured learning and the NOTEARS algorithm has brought innovation to causal discovery, enhancing flexibility and scalability through continuous learning of causal structures. However, in the face of unobserved factors, noise, and the complexity of the clinical environment, accurately reproducing causal mechanisms from data remains a major challenge.
[0003] In real systems, causal relationships can be very complex, involving multiple variables and interactions. Correctly modeling these relationships and extracting meaningful causal information from them is a technical challenge. In addition, some advanced models may require a lot of computing resources, which may be a problem in resource-limited environments. Optimizing algorithms to improve efficiency and reduce resource consumption is an important research direction. At the same time, adaptability to dynamic environments is also an issue. Systems in the real world often change dynamically. Models need to be able to adapt to these changes to maintain the accuracy of their predictions and diagnoses. Summary of the invention
[0004] The present invention proposes a causal analysis method, device and apparatus combining expert knowledge and differentiable structure to overcome the above problems.
[0005] In one aspect of the present invention, a causal analysis method combining expert knowledge and a differentiable structure is provided, wherein the method is used to analyze the causal relationship between multiple target variables, and the method comprises:
[0006] S1. Obtain a data set, an initial prior knowledge base, and an initial causal relationship diagram, wherein the data set includes multiple groups of data samples, and each group of data samples contains specific parameters of each target variable;
[0007] S2. Obtain expert evaluation information on the current causal relationship diagram, and iteratively update the prior knowledge base according to the evaluation information;
[0008] S3, iteratively updating the first NOTEARS algorithm model according to the updated prior knowledge base;
[0009] S4, inputting the data set into the updated first NOTEARS algorithm model, performing NOTEARS iterative optimization calculation, so as to iteratively update the weighted adjacency matrix, and iteratively update the causal relationship graph according to the updated weighted adjacency matrix; wherein the weighted adjacency matrix is used to characterize the connection relationship between each target variable, and the first NOTEARS algorithm model is used to convert the combinatorial optimization problem of the weighted adjacency matrix into a continuous optimization problem to iteratively optimize the weighted adjacency matrix;
[0010] S5, judging whether the updated causal relationship graph satisfies the preset causal relationship evaluation condition, and if not, returning to step S2;
[0011] S6. If the preset causal relationship evaluation conditions are met, the updated causal relationship diagram is used as the target causal relationship diagram.
[0012] Further, the first NOTEARS algorithm model is expressed as:
[0013]
[0014]
[0015] in, is the total loss function of the differentiable structure, W is the weighted adjacency matrix, X is the data set, and W c is the edge constraint matrix, is the data approximation term, is the edge constraint function is the regularization term, h(W) is the constraint condition;
[0016] in,
[0017] The data approximation term is expressed as:
[0018]
[0019] Where: m is the number of data samples, is the i-th data sample in the data set, represents the Frobenius norm;
[0020] The edge constraint function is expressed as:
[0021]
[0022] Where: θ is the threshold of the weighted adjacency matrix, Support side , Indicates the existence of an edge , Indicates that the edge is prohibited , and is the target variable;
[0023] The regularization term is expressed as:
[0024]
[0025] in: is the regularization parameter, , represents regularization;
[0026] The constraints are expressed as:
[0027]
[0028] in: is the Hadamard product, tr represents the trace of the matrix, and n is the number of target variables.
[0029] Furthermore, the prior knowledge base is expressed as:
[0030]
[0031] Where: V represents all target variables, the set Contains all existing edges, the set Include all forbidden edges;
[0032] The iterative updating of the first NOTEARS algorithm model according to the updated prior knowledge base includes:
[0033] The edge constraint matrix is iteratively updated according to the updated prior knowledge base so that the updated edge constraint matrix is consistent with the set The corresponding matrix position is 1, which is consistent with the set The corresponding matrix position is 0;
[0034] The updated edge constraint matrix is input into the edge constraint function to iteratively update the first NOTEARS algorithm model.
[0035] Furthermore, obtaining an initial causal relationship diagram includes:
[0036] The data set is input into the second NOTEARS algorithm model, and NOTEARS iterative optimization calculation is performed to obtain an initial weighted adjacency matrix, and the initial weighted adjacency matrix is converted into an initial causal relationship graph; wherein,
[0037] The second NOTEARS algorithm model is expressed as:
[0038]
[0039] in: is the initial differentiable structural loss function.
[0040] Furthermore, the NOTEARS iterative optimization calculation method of the first NOTEARS algorithm model and the second NOTEARS algorithm model is the same, and the NOTEARS iterative optimization calculation includes:
[0041] S01. Convert the first NOTEARS algorithm model or the second NOTEARS algorithm model into an enhanced Lagrangian algorithm model. The enhanced Lagrangian algorithm model is expressed as:
[0042]
[0043]
[0044] in: Indicates that W is an n×n matrix, express or , α is the Lagrange multiplier, ρ is the penalty parameter;
[0045] S02, inputting an initial transition weighted adjacency matrix and an initial Lagrangian multiplier into the enhanced Lagrangian algorithm model,
[0046] S03, iteratively optimizing the current transition weighted adjacency matrix:
[0047] ,
[0048] in, Expressed as finding formula The minimum value of W in ρ satisfies , c is the progress rate, t is the number of iterations t=0,1,2,...;
[0049] S04, performing iterative optimization calculation on the Lagrange multiplier:
[0050]
[0051] S05. Judgment Is it less than the preset tolerance parameter? If not, return to step S03;
[0052] S06, S06, if If the value is less than the preset tolerance parameter, the NOTEARS iterative optimization calculation is interrupted and the current transition weighted adjacency matrix is The weighted adjacency matrix obtained as a result of the NOTEARS iterative optimization calculation.
[0053] Furthermore, the iterative optimization calculation of the current transition weighted adjacency matrix includes:
[0054] The enhanced Lagrangian algorithm model is transformed into a typical minimization problem model on real vectors:
[0055]
[0056]
[0057] The L-BFGS optimization algorithm is used to perform iterative optimization calculation on the typical minimization problem model on the real vector.
[0058] Another aspect of the present invention provides a causal analysis device combining expert knowledge and a differentiable structure, the device being used to analyze the causal relationship between a plurality of target variables, the device comprising:
[0059] An acquisition module is used to acquire a data set, an initial prior knowledge base and an initial causal relationship diagram, wherein the data set includes multiple groups of data samples, and each group of data samples includes specific parameters of each target variable;
[0060] An expert correction module is used to obtain expert evaluation information on the current causal relationship diagram and iteratively update the prior knowledge base according to the evaluation information;
[0061] A model updating module, used for iteratively updating the first NOTEARS algorithm model according to the updated prior knowledge base;
[0062] A first optimization calculation module, used for inputting the data set into the updated first NOTEARS algorithm model, performing NOTEARS iterative optimization calculation, so as to iteratively update the weighted adjacency matrix, and iteratively update the causal relationship graph according to the updated weighted adjacency matrix; wherein the weighted adjacency matrix is used to characterize the connection relationship between each target variable, and the first NOTEARS algorithm model is used to convert the combinatorial optimization problem of the weighted adjacency matrix into a continuous optimization problem to iteratively optimize the weighted adjacency matrix;
[0063] A judgment module is used to judge whether the updated causal relationship diagram meets the preset causal relationship evaluation conditions, and if it does not meet the preset causal relationship evaluation conditions, it returns to the expert correction module;
[0064] The causal relationship determination module is used to use the updated causal relationship graph as the target causal relationship graph if the preset causal relationship evaluation conditions are met.
[0065] Further,
[0066] The first NOTEARS algorithm model is expressed as:
[0067]
[0068]
[0069] in, is the total loss function of the differentiable structure, W is the weighted adjacency matrix, X is the data set, and W c is the edge constraint matrix, is the data approximation term, is the edge constraint function is the regularization term, h(W) is the constraint condition;
[0070] Wherein, the data approximation term is expressed as:
[0071]
[0072] Where: m is the number of data samples, is the i-th data sample in the data set, represents the Frobenius norm;
[0073] The edge constraint function is expressed as:
[0074]
[0075] Where: θ is the threshold of the weighted adjacency matrix, Support side , Indicates the existence of an edge , Indicates that the edge is prohibited , and is the target variable;
[0076] The regularization term is expressed as:
[0077]
[0078] in: is the regularization parameter, , represents regularization;
[0079] The constraints are expressed as:
[0080]
[0081] in: is the Hadamard product, tr represents the trace of the matrix, and n is the number of target variables;
[0082] The prior knowledge base is expressed as:
[0083]
[0084] Where: V represents all target variables, the set Contains all existing edges, the set Include all forbidden edges;
[0085] The model updating module comprises:
[0086] The edge constraint matrix update submodule is used to iteratively update the edge constraint matrix according to the updated prior knowledge base, so that the updated edge constraint matrix is consistent with the set The corresponding matrix position is 1, which is consistent with the set The corresponding matrix position is 0;
[0087] The model updating submodule is used to input the updated edge constraint matrix into the edge constraint function to iteratively update the first NOTEARS algorithm model.
[0088] Furthermore, the acquisition module includes:
[0089] The second optimization calculation module is used to input the data set into the second NOTEARS algorithm model, perform NOTEARS iterative optimization calculation to obtain an initial weighted adjacency matrix, and convert the initial weighted adjacency matrix into an initial causal relationship graph; wherein,
[0090] The second NOTEARS algorithm model is expressed as:
[0091]
[0092] in: is the initial differentiable structural loss function.
[0093] Another aspect of the present invention provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor; when the computer program is executed by the processor, the steps of the causal analysis method combining expert knowledge and differentiable structure as described in any one of the above items are implemented.
[0094] The present application provides a causal analysis method, device and equipment combining expert knowledge and differentiable structure. The method iteratively updates the first NOTEARS algorithm model based on the prior knowledge base obtained by expert evaluation, and then inputs the data set into the first NOTEARS algorithm model for NOTEARS iterative optimization calculation to obtain the weighted adjacency matrix after iterative update. The present invention integrates expert knowledge into the data-driven causal discovery process, which not only utilizes the advantages of big data, but also combines the valuable experience of experts in the field to improve the accuracy and reliability of causal relationships. In addition, the present invention can continuously learn and optimize to better reflect the latest causal relationship discoveries, and has high flexibility and scalability.
[0095] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0096] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only used for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. In the accompanying drawings:
[0097] Figure 1 A flow chart of a causal analysis method combining expert knowledge and differentiable structure according to an embodiment of the present invention;
[0098] Figure 2 It is a schematic diagram of the structure of a causal analysis device combining expert knowledge and differentiable structure according to an embodiment of the present invention. DETAILED DESCRIPTION
[0099] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0100] Those skilled in the art will understand that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as generally understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined.
[0101] Embodiment 1
[0102] The embodiment of the present invention provides a causal analysis method combining expert knowledge and differentiable structure, which is used to analyze the causal relationship between multiple target variables. In addition to being suitable for the causal relationship between various target variables in the medical field, it can also be applied to other fields.
[0103] like Figure 1 As shown, the causal analysis method combining expert knowledge and differentiable structure includes the following steps:
[0104] S1. Obtain a data set, an initial prior knowledge base, and an initial causal relationship diagram, wherein the data set includes multiple groups of data samples, and each group of data samples contains specific parameters of each target variable;
[0105] The causal relationship graph in the embodiment of the present invention is represented by G, also known as a directed acyclic graph, which is a directed graph consisting of vertices and edges, in which each edge has a clear direction, and there is no path in the entire graph that can start from a vertex and return to the vertex after passing through a series of edges, that is, there is no cycle in the graph. The vertices are the target variables. When there are edges in the causal relationship graph, , which indicates the target variable For the target variable There is a causal relationship.
[0106] S2. Obtain expert evaluation information on the current causal relationship diagram, and iteratively update the prior knowledge base according to the evaluation information;
[0107] In the embodiment of the present invention, the expert's evaluation information on the causal relationship diagram may specifically be the expert's addition of new causal relationships, deletion of erroneous causal relationships, and adjustment of the direction of causal relationships based on professional knowledge.
[0108] S3, iteratively updating the first NOTEARS algorithm model according to the updated prior knowledge base;
[0109] In an embodiment of the present invention, the iterative update of the first NOTEARS algorithm model according to the updated prior knowledge base mainly updates the edge constraint matrix in the edge constraint function in the first NOTEARS algorithm model. The present invention introduces edge constraints in the causal relationship graph based on new information fed back by experts, and integrates expert medical knowledge into the data-driven causal discovery process. It not only utilizes the advantages of big data, but also combines the valuable experience of experts in the field to improve the accuracy and reliability of causal relationships.
[0110] S4, inputting the data set into the updated first NOTEARS algorithm model, performing NOTEARS iterative optimization calculation, so as to iteratively update the weighted adjacency matrix, and iteratively update the causal relationship graph according to the updated weighted adjacency matrix; wherein the weighted adjacency matrix is used to characterize the connection relationship between each target variable, and the first NOTEARS algorithm model is used to convert the combinatorial optimization problem of the weighted adjacency matrix into a continuous optimization problem to iteratively optimize the weighted adjacency matrix;
[0111] In the embodiment of the present invention, the weighted adjacency matrix is represented as W, which is used to represent the connection relationship and weights between vertices in the causal relationship graph, wherein the vertex set is V, the edge set is E, and each edge e∈E has a weight w(e). Then the weighted adjacency matrix W is a matrix of |V|×|V|, where Represents a vertex and The weight of the edge between .
[0112] S5, judging whether the updated causal relationship graph satisfies the preset causal relationship evaluation condition, and if not, returning to step S2;
[0113] S6. If the preset causal relationship evaluation conditions are met, the updated causal relationship diagram is used as the target causal relationship diagram.
[0114] In the embodiment of the present invention, the causal relationship evaluation condition may be a preset stability standard and / or accuracy standard, or may be a standard that experts or stakeholders consider to be necessary for further iteration. That is, when the target causal relationship diagram is obtained, it is considered that the accurate causal relationship between the target variables has been obtained.
[0115] The causal relationship analysis method of the embodiment of the present invention has a flexible framework structure and can be applied to different fields and causal discoveries. At the same time, with the continuous updating of specific professional field knowledge and the accumulation of data, the framework can continue to learn and optimize to better reflect the latest causal relationship discoveries, so the present invention has high flexibility and scalability.
[0116] The causal analysis method combining expert knowledge and differentiable structure of the present invention is further introduced in detail below.
[0117] It should be noted that the present invention involves one layer of iterative calculation of the NOTEARS algorithm when calculating the initial causal relationship graph, and involves two layers of iteration when calculating the target causal relationship graph. The iteration in the outer layer is the evaluation optimization iteration based on expert knowledge, and each evaluation optimization iteration of expert knowledge involves multiple iterative calculations of the NOTEARS optimization algorithm. Therefore, the evaluation optimization iteration of expert knowledge is represented by T, T=0,1,2,..., and the number of iterations of each iterative calculation of the NOTEARS algorithm is represented by t, t=0,1,2,...,
[0118] In step S1, after obtaining the data set, the data set needs to be cleaned to process the missing values in the data and normalize the data. In the present invention, non-numeric target variables can also be converted into numerical values for representation, for example, male is replaced by the numerical value 0 and female is replaced by the numerical value 1.
[0119] The initial causal relationship diagram in the embodiment of the present invention is obtained by iteratively updating the second NOTEARS algorithm model. The second NOTEARS algorithm model is expressed as:
[0120] (1)
[0121] in: is the initial differentiable structural loss function, W is the weighted adjacency matrix, X is the data set, is the data approximation term, is the regularization term, h(W) is the constraint condition;
[0122] Specifically, the data approximation term is expressed as:
[0123] (2)
[0124] Where: m is the number of data samples, is the i-th data sample in the data set, represents the Frobenius norm;
[0125] The regularization term is expressed as:
[0126] (3)
[0127] in: is the regularization parameter, , represents regularization;
[0128] The constraints are expressed as:
[0129] (4)
[0130] in: is the Hadamard product, tr represents the trace of the matrix, and n is the number of target variables.
[0131] In the embodiment of the present invention, the data set is input into the second NOTEARS algorithm model for iterative update calculation, so as to obtain the initial weighted adjacency matrix W0 and the initial causal relationship graph G0.
[0132] Furthermore, in step S2, iterative updating of the prior knowledge base according to the expert evaluation information can be expressed as:
[0133] (5)
[0134] Where T is the number of iterations in the iterative update process of expert evaluation, Used to represent expert evaluation information.
[0135] Furthermore, the form of the prior knowledge base P is defined as a triple, which can be specifically expressed as:
[0136] (6)
[0137] in, and A collection respectively. Contains all existing edges, each edge is an ordered pair ( , ), indicating the slave node To Node There is a causal relationship. It contains all forbidden edges, and each edge is also an ordered pair ( , ), indicating the slave node To Node There is no causal relationship.
[0138] In step S3, the first NOTEARS algorithm model is expressed as:
[0139]
[0140] (7)
[0141] in, is the total loss function of the differentiable structure, W c is the edge constraint matrix, represents the edge constraint function.
[0142] Specifically, the edge constraint function is:
[0143] (8)
[0144] Where: θ is the threshold of the weighted adjacency matrix, Support side , Indicates the existence of an edge , Indicates that the edge is prohibited .
[0145] From formula (8), we can see that the edge constraint matrix and the prior knowledge base have the same meaning. The updated prior knowledge base can be converted into the edge constraint matrix. Therefore, the edge constraint matrix is iteratively updated according to the updated prior knowledge base, so that the updated edge constraint matrix is consistent with the set The corresponding matrix position is 1, which is consistent with the set The corresponding matrix position is 0, and the edges not involved in the edge constraint matrix are also filled with 0; the updated edge constraint matrix is input into the edge constraint function, and the first NOTEARS algorithm model can be iteratively updated.
[0146] Compared with the first NOTEARS algorithm model and the second NOTEARS algorithm model in the embodiment of the present invention, the first NOTEARS algorithm model adds an edge constraint function. The first NOTEARS algorithm model takes the integrated edge constraint as the optimization target, which can not only introduce the expert's experience knowledge into the model, but also avoid the influence of non-existent edges on the iterative optimization of the model, accelerate the iterative optimization process of the model, and reduce the waste of computing resources.
[0147] Specifically, the first NOTEARS algorithm model and the second NOTEARS algorithm model of the embodiment of the present invention have the same NOTEARS iterative optimization calculation method, and the NOTEARS iterative optimization calculation includes the following steps:
[0148] S01. Convert the first NOTEARS algorithm model or the second NOTEARS algorithm model into an enhanced Lagrangian algorithm model. The enhanced Lagrangian algorithm model is expressed as:
[0149]
[0150] (9)
[0151] in: Indicates that W is an n×n matrix, express or , α is the Lagrange multiplier, ρ is the penalty parameter;
[0152] S02, inputting the initial transition weighted adjacency matrix and the initial Lagrangian multiplier into the enhanced Lagrangian algorithm model
[0153] S03, iteratively optimizing the current transition weighted adjacency matrix:
[0154] (10)
[0155] in, Expressed as finding formula The minimum value of W in ρ satisfies , c is the progress rate, t is the number of iterations t=0,1,2,...;
[0156] S04, performing iterative optimization calculation on the Lagrange multiplier:
[0157] (11)
[0158] S05. Judgment Is it less than the preset tolerance parameter? If not, return to step S03;
[0159] S06, if If the value is less than the preset tolerance parameter, the NOTEARS iterative optimization calculation is interrupted and the current transition weighted adjacency matrix is The weighted adjacency matrix obtained as a result of the NOTEARS iterative optimization calculation.
[0160] It should be noted here that in order to distinguish the iterative calculation of the evaluation optimization based on expert knowledge and the iterative calculation of the NOTEARS optimization algorithm, the weighted adjacency matrix obtained in the NOTEARS iterative optimization calculation process is called the transition weighted adjacency matrix in the present invention. W represents the transition weighted adjacency matrix obtained at the tth iteration level in the NOTEARS iterative optimization calculation process. The matrix finally output by the NOTEARS iterative optimization calculation is called the weighted adjacency matrix. T Represents the weighted adjacency matrix obtained at the Tth iteration level in the expert knowledge-based evaluation optimization iterative process.
[0161] Furthermore, performing iterative optimization calculation on the current transition weighted adjacency matrix includes: converting the enhanced Lagrangian algorithm model into a typical minimization problem model on a real vector:
[0162]
[0163] (12)
[0164] The L-BFGS optimization algorithm is used to optimize the iterative calculation of the typical minimization problem model on the real vector. The L-BFGS optimization algorithm used in the present invention is a popular quasi-Newton method that can avoid the high cost of directly calculating the Hessian matrix while ensuring computational efficiency. The selection of this optimization algorithm enables the model to estimate the weight matrix more accurately, thereby improving the recognition accuracy of causal relationships. The use of the L-BFGS optimization algorithm is a prior art and will not be repeated in the present invention.
[0165] The causal graph obtained by the present invention not only has higher accuracy, but is also easier to be understood and accepted by experts, which helps to apply the results of causal discovery to actual decision-making and improve the quality and efficiency of expert decision-making.
[0166] The causal analysis method combining expert knowledge and differentiable structure of the present invention is further described in detail below with a specific embodiment in the clinical field:
[0167] For example, in the clinical field, a set of clinical data is obtained: X = {(4.5mg / L, 23 years old, 23, 123mmHg), (4.0mg / L, 30 years old, 31, 133mmHg), (5.5mg / L, 20 years old, 21, 125mmHg)}. The set of target variables (also called feature set or vertex combination) is: V = {blood sugar content, age, BMI, blood pressure}. Clean the data, process the missing values in the data and normalize it. The normalized data set is:
[0168] (13)
[0169] Among them, the initial prior knowledge base is expressed as ,
[0170] (14)
[0171] Furthermore, the initial causal relationship diagram is obtained through the second NOTEARS algorithm model:
[0172] The data set in formula (13) is input into the second NOTEARS algorithm model for iterative update, and the initial transition weighted adjacency matrix W is input (0) :
[0173] (14)
[0174] Enter the initial Lagrange multiplier α (0) =0, set progress rate c=0.25, tolerance parameter =10 -8 , penalty parameter ρ=1.
[0175] Furthermore, the transition weighted adjacency matrix is calculated using formula (10): Perform iterative optimization calculations to obtain:
[0176] (15)
[0177] Using formula (11) to calculate the Lagrange multiplier Perform iterative optimization calculations to obtain:
[0178] (16)
[0179] At this point, assuming that a weighted adjacency matrix that meets the calculation requirements is obtained after one iteration, set and interrupt the loop,
[0180] The matrix Assign to matrix ,
[0181]
[0182] Then complete this causal learning, That is the weighted adjacency matrix W T The initial weighted adjacency matrix when T=0 W 0 , generate a causal relationship graph based on the initial weighted adjacency matrix G T The initial causal relationship diagram at T=0 G 0 =(V,E) ,in, =0.89, there is an edge ; =0.23, there is an edge ; =0.69, there is an edge , and finally obtain E ( G 0 )={(age, blood sugar level),(age, blood pressure),(BMI, age)}.
[0183] Furthermore, experts evaluate the initial causal relationship graph G0 and provide feedback, including newly added causal relationships, deleted erroneous relationships, and adjustments to the relationship direction.
[0184] Further, the prior knowledge is updated, and the prior knowledge base P1 is updated according to the feedback, where:
[0185]
[0186]
[0187] Convert P1 into an edge constraint matrix:
[0188]
[0189] at this time, Indicates the existence of an edge , Indicates that the edge is prohibited .
[0190] Furthermore, the threshold of the weighted adjacency matrix is set to θ=0.3. Support side .
[0191] Formula (8) is used to express the restriction on the edge of the causal relationship graph, and the integrated edge constraint is used as the optimization target. As the optimization goal, the updated weighted adjacency matrix at T=1 is obtained by inputting the data set into the first NOTEARS algorithm model for iterative optimization (the iterative optimization calculation process of the first NOTEARS algorithm model is omitted here). W 1 , and generate a new causal relationship diagram when T=1 G 1 =(V,E) , E ( G 1 )={(age, blood sugar content),(age, blood pressure),(age, MBI),(BMI, blood pressure),(BMI, blood sugar content)}. If the predefined accuracy standard is met after one iteration, the iteration is stopped. G 1 This is the target cause-effect diagram.
[0192] For the method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0193] Embodiment 2
[0194] Figure 2 The schematic diagram of the structure of a causal analysis device combining expert knowledge and a differentiable structure is shown schematically in an embodiment of the present invention. Figure 2The causal analysis device combining expert knowledge and differentiable structure according to the embodiment of the present invention specifically includes an acquisition module 201, an expert correction module 202, a model update module 203, a first optimization calculation module 204, a judgment module 205 and a causal relationship determination module 206, wherein:
[0195] An acquisition module 201 is used to acquire a data set, an initial prior knowledge base, and an initial causal relationship diagram, wherein the data set includes multiple groups of data samples, and each group of data samples includes specific parameters of each target variable;
[0196] An expert correction module 202 is used to obtain expert evaluation information on the current causal relationship diagram, and iteratively update the prior knowledge base according to the evaluation information;
[0197] A model updating module 203, configured to iteratively update the first NOTEARS algorithm model according to the updated prior knowledge base;
[0198] The first optimization calculation module 204 is used to input the data set into the updated first NOTEARS algorithm model, perform NOTEARS iterative optimization calculation, iteratively update the weighted adjacency matrix, and iteratively update the causal relationship graph according to the updated weighted adjacency matrix; wherein the weighted adjacency matrix is used to characterize the connection relationship between each target variable, and the first NOTEARS algorithm model is used to convert the combinatorial optimization problem of the weighted adjacency matrix into a continuous optimization problem to iteratively optimize the weighted adjacency matrix;
[0199] The judgment module 205 is used to judge whether the updated causal relationship diagram meets the preset causal relationship evaluation condition. If it does not meet the preset causal relationship evaluation condition, it returns to the expert correction module 202;
[0200] The causal relationship determination module 206 is configured to use the updated causal relationship graph as the target causal relationship graph if the preset causal relationship evaluation condition is met.
[0201] The model updating module 203 includes:
[0202] The edge constraint matrix update submodule is used to iteratively update the edge constraint matrix according to the updated prior knowledge base, so that the updated edge constraint matrix is consistent with the set The corresponding matrix position is 1, which is consistent with the set The corresponding matrix position is 0;
[0203] The model updating submodule is used to input the updated edge constraint matrix into the edge constraint function to iteratively update the first NOTEARS algorithm model.
[0204] Furthermore, the acquisition module 201 includes:
[0205] The second optimization calculation module is used to input the data set into the second NOTEARS algorithm model, perform NOTEARS iterative optimization calculation to obtain an initial weighted adjacency matrix, and convert the initial weighted adjacency matrix into an initial causal relationship graph.
[0206] Furthermore, the first optimization calculation module 204 and the second optimization calculation module have the same structure, and respectively include:
[0207] The model conversion submodule is used to convert the first NOTEARS algorithm model or the second NOTEARS algorithm model into an enhanced Lagrangian algorithm model. The enhanced Lagrangian algorithm model is expressed as:
[0208]
[0209]
[0210] in: Indicates that W is an n×n matrix, express or , α is the Lagrange multiplier, ρ is the penalty parameter;
[0211] Initialization submodule, used to input the initial transition weighted adjacency matrix into the enhanced Lagrangian algorithm model Initial Lagrange multiplier
[0212] The transition weighted matrix calculation submodule is used to iteratively optimize the current transition weighted adjacency matrix:
[0213] ,
[0214] in, Expressed as finding formula The minimum value of W in ρ satisfies , c is the progress rate, t is the number of iterations t=0,1,2,...;
[0215] The Lagrange multiplier calculation submodule is used to perform iterative optimization calculation on the Lagrange multiplier:
[0216]
[0217] Judgment submodule, used to judge Is it less than the preset tolerance parameter? If not, return to the transition weight matrix calculation submodule;
[0218] Iteration result output module is used if If the value is less than the preset tolerance parameter, the NOTEARS iterative optimization calculation is interrupted and the current transition weighted adjacency matrix is The weighted adjacency matrix obtained as a result of the NOTEARS iterative optimization calculation.
[0219] Furthermore, the transition weight matrix calculation submodule is specifically used for:
[0220] The enhanced Lagrangian algorithm model is transformed into a typical minimization problem model on real vectors:
[0221]
[0222]
[0223] The L-BFGS optimization algorithm is used to perform iterative optimization calculation on the typical minimization problem model on the real vector.
[0224] The embodiment of the present application provides a causal analysis method and device combining expert knowledge and differentiable structure. The method iteratively updates the first NOTEARS algorithm model based on the prior knowledge base obtained by expert evaluation, and then inputs the data set into the first NOTEARS algorithm model to perform NOTEARS iterative optimization calculation, and iteratively updates the weighted adjacency matrix, and integrates expert knowledge into the data-driven causal discovery process, which not only takes advantage of big data, but also combines the valuable experience of experts in the field, and improves the accuracy and reliability of causal relationships. The present invention can continuously learn and optimize to better reflect the latest causal relationship discoveries, iteratively updates the prior knowledge base based on the expert's evaluation information on the causal relationship graph, and has high flexibility and scalability.
[0225] Embodiment 3
[0226] An embodiment of the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps in the above-mentioned causal analysis method combining expert knowledge and differentiable structure are implemented, for example Figure 1 Alternatively, when the processor executes the computer program, the functions of each module / unit in the above-mentioned causal analysis device or gateway system embodiment combining expert knowledge and differentiable structure are realized, for example Figure 2 The obtained module 201, the expert correction module 202, the model updating module 203, the first optimization calculation module 204, the judgment module 205 and the cause-effect relationship determination module 206 are shown.
[0227] In addition, those skilled in the art will appreciate that, although some embodiments herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, any one of the claimed embodiments may be used in any combination.
[0228] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A causal analysis method combining expert knowledge and differentiable structures, It is characterized in that The method is used to analyze the causal relationship between multiple target variables, and the method includes: S1. Obtain a data set, an initial prior knowledge base, and an initial causal relationship diagram, wherein the data set includes multiple groups of data samples, and each group of data samples contains specific parameters of each target variable; Among them, obtaining the initial causal relationship diagram includes: The data set is input into the second NOTEARS algorithm model, and NOTEARS iterative optimization calculation is performed to obtain an initial weighted adjacency matrix, and the initial weighted adjacency matrix is converted into an initial causal relationship graph; wherein, The second NOTEARS algorithm model is expressed as: in: is the initial differentiable structural loss function; S2. Obtain expert evaluation information on the current causal relationship diagram, and iteratively update the prior knowledge base according to the evaluation information; S3, iteratively updating the first NOTEARS algorithm model according to the updated prior knowledge base; Wherein, the first NOTEARS algorithm model is expressed as: in, is the total loss function of the differentiable structure, W is the weighted adjacency matrix, X For the data set, W c is the edge constraint matrix, is the data approximation term, is the edge constraint function is the regularization term, h(W) is a constraint condition; in, The data approximation term is expressed as: in: m is the number of data samples, For the data set i data samples, represents the Frobenius norm; The edge constraint function is expressed as: in: θ is the threshold of the weighted adjacency matrix, Support side , Indicates the existence of an edge , Indicates that the edge is prohibited , and is the target variable; The regularization term is expressed as: in: is the regularization parameter, , represents regularization; The constraints are expressed as: in: For Hadamard, tr represents the trace of the matrix, n is the number of target variables; S4, inputting the data set into the updated first NOTEARS algorithm model, performing NOTEARS iterative optimization calculation, so as to iteratively update the weighted adjacency matrix, and iteratively update the causal relationship graph according to the updated weighted adjacency matrix; wherein the weighted adjacency matrix is used to characterize the connection relationship between each target variable, and the first NOTEARS algorithm model is used to convert the combinatorial optimization problem of the weighted adjacency matrix into a continuous optimization problem to iteratively optimize the weighted adjacency matrix; S5, judging whether the updated causal relationship graph satisfies the preset causal relationship evaluation condition, and if not, returning to step S2; S6. If the preset causal relationship evaluation condition is met, the updated causal relationship graph is used as the target causal relationship graph; The first NOTEARS algorithm model and the second NOTEARS algorithm model have the same NOTEARS iterative optimization calculation method, and the NOTEARS iterative optimization calculation includes: S01. Convert the first NOTEARS algorithm model or the second NOTEARS algorithm model into an enhanced Lagrangian algorithm model. The enhanced Lagrangian algorithm model is expressed as: in: express W for n×n The matrix of order, express or , α is the Lagrange multiplier, ρ is the penalty parameter; S02, inputting an initial transition weighted adjacency matrix and an initial Lagrangian multiplier into the enhanced Lagrangian algorithm model; S03, iteratively optimizing the current transition weighted adjacency matrix: , in, Expressed as finding formula middle W The minimum value of ρ satisfy , c is the progress rate, t is the number of iterations t=0,1,2,...; S04, performing iterative optimization calculation on the Lagrange multiplier: S05. Judgment Is it less than the preset tolerance parameter? If not, return to step S03; S06, if If the value is less than the preset tolerance parameter, the NOTEARS iterative optimization calculation is interrupted and the current transition weighted adjacency matrix is The weighted adjacency matrix obtained as a result of the NOTEARS iterative optimization calculation.
2. The method according to claim 1, It is characterized in that The prior knowledge base is expressed as: Where: V represents all target variables, the set Contains all existing edges, the set Include all forbidden edges; The iterative updating of the first NOTEARS algorithm model according to the updated prior knowledge base includes: The edge constraint matrix is iteratively updated according to the updated prior knowledge base so that the updated edge constraint matrix is consistent with the set The corresponding matrix position is 1, which is consistent with the set The corresponding matrix position is 0; The updated edge constraint matrix is input into the edge constraint function to iteratively update the first NOTEARS algorithm model.
3. The method according to claim 1, It is characterized in that The iterative optimization calculation of the current transition weighted adjacency matrix includes: The enhanced Lagrangian algorithm model is transformed into a typical minimization problem model on real vectors: The L-BFGS optimization algorithm is used to perform iterative optimization calculation on the typical minimization problem model on the real vector.
4. A causal analysis device combining expert knowledge and a differentiable structure, comprising a functional module for implementing the causal analysis method combining expert knowledge and a differentiable structure as claimed in any one of claims 1 to 3, It is characterized in that The device is used to analyze the causal relationship between multiple target variables, and the device includes: An acquisition module is used to acquire a data set, an initial prior knowledge base and an initial causal relationship diagram, wherein the data set includes multiple groups of data samples, and each group of data samples includes specific parameters of each target variable; An expert correction module is used to obtain expert evaluation information on the current causal relationship diagram and iteratively update the prior knowledge base according to the evaluation information; A model updating module, used for iteratively updating the first NOTEARS algorithm model according to the updated prior knowledge base; A first optimization calculation module, used for inputting the data set into the updated first NOTEARS algorithm model, performing NOTEARS iterative optimization calculation, so as to iteratively update the weighted adjacency matrix, and iteratively update the causal relationship graph according to the updated weighted adjacency matrix; wherein the weighted adjacency matrix is used to characterize the connection relationship between each target variable, and the first NOTEARS algorithm model is used to convert the combinatorial optimization problem of the weighted adjacency matrix into a continuous optimization problem to iteratively optimize the weighted adjacency matrix; A judgment module is used to judge whether the updated causal relationship diagram meets the preset causal relationship evaluation conditions, and if it does not meet the preset causal relationship evaluation conditions, it returns to the expert correction module; The causal relationship determination module is used to use the updated causal relationship graph as the target causal relationship graph if the preset causal relationship evaluation conditions are met.
5. The device according to claim 4, It is characterized in that The first NOTEARS algorithm model is expressed as: in, is the total loss function of the differentiable structure, W is the weighted adjacency matrix, X For the data set, W c is the edge constraint matrix, is the data approximation term, is the edge constraint function is the regularization term, h(W) is a constraint condition; in, The data approximation term is expressed as: in: m is the number of data samples, For the data set i data samples, represents the Frobenius norm; The edge constraint function is expressed as: in: θ is the threshold of the weighted adjacency matrix, Support side , Indicates the existence of an edge , Indicates that the edge is prohibited , and is the target variable; The regularization term is expressed as: in: is the regularization parameter, , represents regularization; The constraints are expressed as: in: For Hadamard, tr represents the trace of the matrix, n is the number of target variables; The prior knowledge base is expressed as: Where: V represents all target variables, the set Contains all existing edges, the set Include all forbidden edges; The model updating module comprises: The edge constraint matrix update submodule is used to iteratively update the edge constraint matrix according to the updated prior knowledge base, so that the updated edge constraint matrix is consistent with the set The corresponding matrix position is 1, which is consistent with the set The corresponding matrix position is 0; The model updating submodule is used to input the updated edge constraint matrix into the edge constraint function to iteratively update the first NOTEARS algorithm model.
6. The device according to claim 5, It is characterized in that The acquisition module comprises: The second optimization calculation module is used to input the data set into the second NOTEARS algorithm model, perform NOTEARS iterative optimization calculation to obtain an initial weighted adjacency matrix, and convert the initial weighted adjacency matrix into an initial causal relationship graph; wherein, The second NOTEARS algorithm model is expressed as: in: is the initial differentiable structural loss function.
7. A computer device, It is characterized in that The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor; when the computer program is executed by the processor, the causal analysis method combining expert knowledge and a differentiable structure as described in any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Directed acyclic graph machine learning system
US11443198B1
Using Typed Data for Causal Fault Discovery in Networks
US20230075799A1
