Data processing method and device based on causal graph model, equipment and storage medium
By deeply integrating causal graph models and graph neural network technology, a structured causal graph is constructed and counterfactual reasoning is performed, which solves the problem of insufficient causal modeling of high-dimensional nonlinear data, realizes causal interpretability output, improves the efficiency of data analysis, and can be applied in fields such as medicine, finance, intelligent manufacturing and meteorology.
Patent Information
- Application Number
- CN202511197343.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-22
- Publication Date
- 2025-10-28
AI Technical Summary
Existing technologies are insufficient in modeling causal relationships when processing high-dimensional nonlinear data, resulting in a lack of causal interpretability in diagnostic and assessment results in the medical and financial fields. Furthermore, the output results of graph neural networks lack causal interpretability and cannot be used for counterfactual reasoning.
It deeply integrates causal graph models and graph neural network technology, introduces a counterfactual reasoning module, constructs a structured causal graph through a causal constraint graph network learning mechanism, and generates explanatory results through counterfactual reasoning.
It enables accurate causal modeling and interpretation of high-dimensional nonlinear data, improves the application efficiency of data analysis and artificial intelligence, provides causal interpretability output, and supports decision-making in fields such as healthcare, finance, intelligent manufacturing, and meteorology.
Smart Images

Figure CN120851229A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to data processing methods, apparatus, devices and storage media based on causal graph models. Background Technology
[0002] In today's data analytics and artificial intelligence fields, causal relationship modeling and graph structure data processing are two important research directions. However, existing technologies still have significant limitations in terms of integration depth and practical application effectiveness.
[0003] Traditional causal graph models, centered on Pearl's causal graph theory, encompass classic causal discovery methods such as the PC algorithm (Peter-Clark algorithm, a classic Bayesian network structure learning method) and the IC algorithm (Inferred Causation, used to infer causal structures from probability distributions), as well as the Do-Calculus intervention tool (a core tool for causal inference, connecting observed correlations with intervention predictions through three inference rules). These techniques construct causal structures solely through statistical constraints or scoring functions, without incorporating deep learning models, making them ill-suited for handling high-dimensional, nonlinear data. For example, in the medical field, when analyzing the pathogenic factors of complex diseases (such as polygenic inherited diseases), hundreds or even thousands of high-dimensional variables involving genes, environment, and lifestyle habits are involved, and complex nonlinear interactions exist between these variables. Traditional causal graph models often fail to accurately capture the causal relationships, impacting the accuracy of disease diagnosis and treatment planning. Similarly, in the financial field, when analyzing the factors influencing financial market fluctuations, traditional causal graph models struggle to handle massive amounts of nonlinearly correlated economic indicators and market transaction data, failing to accurately identify key causal factors causing market volatility, which can pose significant risks to investment decisions.
[0004] Graph Neural Network (GNN) technologies, such as GraphSAGE and GAT, can process graph-structured data, but they are essentially correlation-based pattern recognition methods that lack causal modeling mechanisms, resulting in outputs that lack causal interpretability. For example, in the medical field, when using GNNs to construct graph structures from patient medical records and examination results for disease prediction, the model might use features that appear related to the disease but have no actual causal relationship as the basis for judgment, leading to inexplicable predictions that doctors find difficult to trust and accept. Similarly, in the financial field, when using GNNs to analyze and evaluate corporate credit data, the model might give incorrect credit scores based on data that is unrelated to creditworthiness but correlated with it, and the basis for these scores cannot be explained, increasing the credit risk for financial institutions.
[0005] Some studies, such as causal convolutional networks and causal attention models, attempt to introduce causal thinking into deep learning, but they have significant limitations. First, they do not use structured causal graphs as priors, but only indirectly represent the correlation through attention weights. Second, they lack counterfactual reasoning modules, making it impossible to generate explanatory conclusions such as "what would happen if X changed?". Currently, no technology or product has achieved a three-in-one architecture of "causal graph model + deep fusion of GNN + counterfactual reasoning." For example, in the medical field, when studying the impact of a drug on a patient's condition, existing preliminary techniques cannot clarify the causal path between the drug and the condition based on structured causal graphs, nor can they perform counterfactual reasoning, i.e., they cannot answer "how would the condition develop if the patient did not use the drug?", affecting drug efficacy evaluation and personalized treatment plan development. Similarly, in the financial field, when analyzing the impact of a factor on the market, these technologies cannot construct clear causal graphs to show the relationship between the factor and market variables, nor can they simulate "how the market would behave if the factor were not implemented," making the factor effect evaluation lack reliable evidence and hindering factor optimization and adjustment. Summary of the Invention
[0006] This invention provides a data processing method, apparatus, computer device, and storage medium based on a causal graph model. It aims to solve the problems of existing technologies in processing high-dimensional nonlinear data and lack of causal interpretability in output results by deeply integrating causal graph models and graph neural network technology and introducing a counterfactual reasoning module.
[0007] In a first aspect, embodiments of the present invention provide a data processing method based on a causal graph model, comprising:
[0008] Obtain the target data and the corresponding reasoning results to be explained, and construct a causal graph based on the target data to obtain the corresponding structured causal graph;
[0009] A causal constraint-based graph network learning mechanism is used to apply causal constraints to the structured causal graph, resulting in an optimized causal graph.
[0010] Based on the optimized causal graph, counterfactual reasoning is performed on the reasoning results, and an explanation of the target data is generated based on the results of the counterfactual reasoning.
[0011] Secondly, embodiments of the present invention provide a data processing apparatus based on a causal graph model, comprising:
[0012] The data acquisition unit is used to acquire target data and corresponding inference results to be explained, and to construct a causal graph based on the target data to obtain the corresponding structured causal graph.
[0013] The causal constraint unit is used to apply causal constraints to the structured causal graph using a causal constraint graph network learning mechanism to obtain an optimized causal graph.
[0014] The reasoning generation unit is used to perform counterfactual reasoning on the reasoning result based on the optimized causal graph, and generate an explanation result of the target data based on the result of the counterfactual reasoning.
[0015] Thirdly, embodiments of the present invention provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the data processing method based on the causal graph model as described in the first aspect.
[0016] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the data processing method based on a causal graph model as described in the first aspect.
[0017] This invention provides a data processing method, apparatus, computer device, and storage medium based on a causal graph model. The method includes: acquiring target data and corresponding inference results to be explained; constructing a causal graph based on the target data to obtain a corresponding structured causal graph; applying causal constraints to the structured causal graph using a causal constraint graph network learning mechanism to obtain an optimized causal graph; performing counterfactual inference on the inference results based on the optimized causal graph; and generating an explanation result for the target data based on the result of the counterfactual inference. This invention deeply integrates causal graph models and graph neural network technology, and introduces a counterfactual inference module to achieve accurate causal modeling and explanation of high-dimensional nonlinear data, thereby improving the application efficiency in data analysis and artificial intelligence fields. Specifically, this invention first constructs a structured causal graph based on the target data to provide a foundation for subsequent processing; secondly, it optimizes the structured causal graph using a causal constraint graph network learning mechanism to enhance the model's causal expression capability; and finally, it performs counterfactual inference based on the optimized causal graph to generate an explanation result for the target data, providing an output with causal interpretability. The embodiments of this invention, through a three-level architecture of "causal graph structured modeling + GNN deep feature learning + counterfactual reasoning interpretation generation", not only break through the limitations of traditional causal graph models in processing high-dimensional nonlinear data, but also make up for the lack of causal interpretability of graph neural network output results, providing a brand-new idea and method for the development of data analysis and artificial intelligence. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 A schematic flowchart of a data processing method based on a causal graph model provided in an embodiment of the present invention;
[0020] Figure 2 This is a schematic diagram of a sub-process of a data processing method based on a causal graph model provided in an embodiment of the present invention;
[0021] Figure 3 This is a schematic diagram of another sub-process of a data processing method based on a causal graph model provided in an embodiment of the present invention;
[0022] Figure 4 A schematic block diagram of a data processing device based on a causal graph model provided in an embodiment of the present invention;
[0023] Figure 5 A schematic block diagram of a data processing device based on a causal graph model provided in an embodiment of the present invention;
[0024] Figure 6 Another schematic block diagram of a data processing device based on a causal graph model provided in an embodiment of the present invention;
[0025] Figure 7 This is a schematic block diagram of a computer device provided in an embodiment of the present invention. Detailed Implementation
[0026] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0027] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0028] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0029] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0030] The data processing method based on a causal graph model provided in this invention can be applied in an application environment where a client and a server interact, wherein the client communicates with the server via a network. The server acquires target data and the corresponding inference result to be explained, and constructs a causal graph based on the target data to obtain a corresponding structured causal graph. A causal constraint graph network learning mechanism is used to apply causal constraints to the structured causal graph to obtain an optimized causal graph. Based on the optimized causal graph, counterfactual inference is performed on the inference result, and an explanation result for the target data is generated based on the result of the counterfactual inference. The client can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The server can be implemented using a standalone server or a server cluster consisting of multiple servers. The invention will be described in detail below through specific embodiments.
[0031] Please see below. Figure 1 This invention provides a data processing method based on a causal graph model, specifically including steps S101 to S103.
[0032] Step S101: Obtain the target data and the corresponding reasoning results to be explained, and construct a causal graph based on the target data to obtain the corresponding structured causal graph;
[0033] Step S102: Apply causal constraints to the structured causal graph using a causal constraint graph network learning mechanism to obtain an optimized causal graph;
[0034] Step S103: Based on the optimized causal graph, perform counterfactual reasoning on the reasoning result, and generate an explanation result for the target data based on the result of the counterfactual reasoning.
[0035] In this embodiment, a structured causal graph is first constructed based on the target data to provide a foundation for subsequent processing. Secondly, a causal constraint graph network learning mechanism is used to optimize the structured causal graph, enhancing the model's causal expressive power. Finally, counterfactual reasoning is performed based on the optimized causal graph to generate explanations of the target data, providing causally explanatory outputs.
[0036] This embodiment deeply integrates causal graph models and graph neural network technology, and introduces a counterfactual reasoning module to construct a three-tiered architecture of "causal graph structured modeling + GNN deep feature learning + counterfactual reasoning interpretation generation." This enables accurate causal modeling and interpretation of high-dimensional nonlinear data, improving the application efficiency in data analysis and artificial intelligence. The data processing method based on causal graph models provided in this embodiment not only overcomes the limitations of traditional causal graph models in processing high-dimensional nonlinear data, but also compensates for the lack of causal interpretability in graph neural network outputs, providing a new approach and methodology for the development of data analysis and artificial intelligence.
[0037] In particular, the data processing method based on the causal graph model provided in this embodiment can be applied to different domain scenarios. For example:
[0038] (1) Healthcare
[0039] Disease diagnosis and etiology analysis: Input the patient's physical signs (such as blood pressure, blood sugar, genetic test results), medical history, medication records, etc., and output the causal path of the disease (such as "obesity → insulin resistance → diabetes") and counterfactual intervention suggestions (such as "if weight is reduced by 5kg, the probability of diabetes remission increases by 40%), which can help doctors develop personalized treatment plans.
[0040] Drug side effect tracing: Analyze variables such as drug components, patient constitution, and concurrent medications to trace the key causal chain of "drug → side effect" (e.g., "aspirin → gastric mucosal damage → gastric ulcer"), providing interpretable evidence for drug safety assessment.
[0041] (2) Financial risk control field
[0042] Credit default early warning: Integrating user income, debt, credit records and other data, it generates causal paths such as "declining income → insufficient repayment ability → default", and simulates counterfactual results such as "if income sources are increased, the probability of default will decrease by 25%", which can help financial institutions accurately assess risks and formulate intervention strategies (such as adjusting repayment terms).
[0043] (3) Intelligent manufacturing field
[0044] Equipment fault diagnosis: Input equipment operating parameters (such as temperature, pressure, vibration frequency), maintenance records and other data to deduce the causal relationship of "insufficient lubrication → component wear → failure and downtime", and predict "if lubrication is strengthened, the failure interval will be extended to 3 times the original", which can guide the factory to optimize the equipment maintenance plan.
[0045] (4) Meteorology and Environment
[0046] Extreme weather cause analysis: By integrating meteorological data such as temperature, humidity, and ocean currents, a causal diagram of "rising ocean temperature → abnormal atmospheric circulation → extreme precipitation" is constructed. Through counterfactual simulation, "if the ocean temperature decreases by 1°C, the probability of extreme precipitation decreases by 15%", providing quantitative support for climate intervention research.
[0047] Accordingly, based on the aforementioned scenarios, the target data described in this embodiment can specifically be medical data, such as patients' physiological indicators, medical history records, and gene sequencing results, used to reveal the mechanisms and influencing factors of disease occurrence; it can also be financial data, covering users' credit records, transaction behavior, and asset and liability status, used to assess credit risk and default probability; it can also be equipment operation data and maintenance logs in the industrial manufacturing field, used to diagnose equipment failures and optimize production plans; or it can be meteorological observation data, including temperature, humidity, air pressure, wind direction, and wind speed, used to analyze the causes of extreme weather and predict climate change trends. The method provided in this embodiment enables accurate causal modeling and interpretation of these complex, high-dimensional data, providing powerful decision support and intelligent services for multiple fields such as healthcare, financial risk control, intelligent manufacturing, meteorology, and the environment. Of course, this embodiment is also applicable to many other scenarios, such as traffic flow prediction, air quality improvement strategy formulation, and natural disaster risk assessment.
[0048] In one embodiment, step S101 includes:
[0049] An improved PC algorithm is used to extract latent causal variables from the target data, and an initial directed causal graph is generated based on the latent causal variables; wherein, the improved PC algorithm is equipped with a dynamic adjustment mechanism for the mutual information threshold;
[0050] The initial directed causal graph is causal structure encoded to obtain the structured causal graph.
[0051] In this embodiment, a causal graph is initialized based on the target data. Specifically, an improved PC algorithm is first employed. This algorithm introduces a dynamic adjustment mechanism for the mutual information threshold, enabling it to mine potential causal relationships between variables from the data, thereby generating an initial directed causal graph. Nodes represent variables, such as age or smoking status; directed edges represent potential cause-effect relationships. Compared to the traditional PC algorithm, this improved algorithm reduces false positives for spurious causal edges. Next, the constructed causal graph is converted into computer-processable structured data, resulting in a structured causal graph.
[0052] In a specific embodiment, the step of performing causal structure encoding on the initial directed causal graph to obtain the structured causal graph includes:
[0053] Based on the initial directed causal graph, an adjacency matrix is set;
[0054] The node feature matrix is set according to the principle that each row corresponds to a feature vector of a variable and each column corresponds to a sample;
[0055] The structured causal graph is constructed by combining the adjacency matrix and the node feature matrix.
[0056] The structured causal graph constructed in this embodiment specifically includes an adjacency matrix A and a node feature matrix X. In the adjacency matrix A, A[i][j] = 1 indicates that there is a causal edge between variable i and j, and A[i][j] = 0 indicates that there is no causal edge. In the node feature matrix X, each row corresponds to the feature vector of a variable (such as the standardized value of a continuous variable or the one-hot encoding of a discrete variable), and each column corresponds to a sample.
[0057] In practical applications, structured causal graphs can be constructed by combining initial causal relationship hypotheses provided by domain experts. For example, by setting up an expert knowledge fusion interface, if there are initial causal relationship hypotheses provided by experts, they can be incorporated into the adjacency matrix by assigning weights. For instance, the initial weight of the causal edge confirmed by the expert is set to 0.8, and the weight of the edge to be verified is set to 0.5, thereby achieving collaborative modeling driven by data and knowledge.
[0058] In one embodiment, such as Figure 2 As shown, step S102 includes steps S201 to S204.
[0059] Step S201: Set causal direction constraints for the message passing layer of the graph neural network;
[0060] Specifically, setting causal direction constraints for the message passing layer of the graph neural network includes:
[0061] The message passing layer is constrained by the following formula:
[0062]
[0063] in, This represents the message passing layer after setting causal direction constraints. Parents(j) is the parent node of variable j in the causal graph. α i,j For attention weights, W (l) and b (l) All of these are parameters of the l-th layer of the graph neural network, and σ is the activation function.
[0064] Step S202: Use a dynamic attention mechanism to perform causal strength quantification learning on the structured causal graph;
[0065] Step S203: Use the graph neural network to learn nonlinear causal relationships on the structured causal graph to construct a nonlinear causal relationship model between variables;
[0066] Step S204: Input the structured causal graph into the nonlinear causal relationship model between variables, and output the optimized causal graph from the nonlinear causal relationship model between variables.
[0067] This embodiment is based on causal reinforcement learning of graph neural networks (GNNs) to establish a causal constraint-based graph network learning mechanism. Specifically, it first designs a causal reinforcement-based GNN layer, that is, it adds causal direction constraints to the traditional GNN message passing formula, i.e., the formula...
[0068] Where Parents(j) is the parent node (i.e., the cause variable) of variable j in the cause-effect graph, α i,j Let be the attention weights (representing the strength of the causal influence of i on j), W(l) and b(l) be the parameters of the l-th layer, and σ be the activation function. This design ensures that information flows only from the "cause" node to the "effect" node, avoiding the undirected information confusion in traditional GNNs.
[0069] Next, the dynamic attention mechanism is optimized. This involves training to learn the attention weight α. i,j It assigns high weights (close to 1) to strong causal relationships (such as "smoking → lung cancer") and low weights (close to 0) to weak or spurious relationships (such as "ice cream sales → drowning accidents"), thereby achieving quantitative learning of causal strength.
[0070] Then, nonlinear causal relationships are captured. Through a 3-5 layer GNN network (introducing the ReLU activation function), the nonlinear causal relationships between variables are learned step by step (such as "the effect of age on blood pressure shows nonlinear differences in different weight groups"), which solves the problem that traditional causal graphs cannot model nonlinear relationships.
[0071] Finally, the optimized causal graph is output, which contains a weighted adjacency matrix that quantifies causal strength, with matrix elements of α. i,j The convergence value will also output the corresponding nonlinear causal relationship model between variables, which is stored in the form of GNN network parameters.
[0072] In one embodiment, such as Figure 3 As shown, step S103 includes steps S301 to S304.
[0073] Step S301: Obtain the key variables in the reasoning result, and make counterfactual assumptions about the key variables to obtain the counterfactual scenario;
[0074] Step S302: Based on the optimized causal graph, the do calculus algorithm is used to perform causal intervention on the counterfactual scenario, and the counterfactual result is calculated using the nonlinear causal relationship model between variables;
[0075] Step S303: Compare the original factual result and the counterfactual result of the reasoning result, and locate the causal chain that has the greatest impact on the reasoning result based on the result of the comparison.
[0076] Step S304: Generate the explanation result based on the causal chain.
[0077] Specifically, step S304 includes:
[0078] The causal strength quantification learning and causal chain are converted into a natural language report using natural language interpretation generation technology and output as an interpretability report.
[0079] In this embodiment, a counterfactual-causal path linkage explanation mechanism is established during counterfactual reasoning and explanation generation. Based on the reasoning result to be explained (e.g., "Patient A has an 80% probability of developing lung cancer"), and the aforementioned optimized causal graph and model parameters, this embodiment first generates a counterfactual scenario. That is, for the key variable in the reasoning result (e.g., "smoking"), a counterfactual hypothesis (e.g., "If Patient A does not smoke") is generated. The scenario is simulated by modifying the values of the corresponding variables in the node feature matrix (e.g., changing "smoking = 1" to "smoking = 0"). Then, causal intervention calculation is performed. Based on the optimized causal graph, "do-calculus" is used to intervene in the counterfactual scenario (blocking all input edges pointing to "smoking" to ensure that all edges pointing to the variable are cut off while changing the variable, making the variable an "independent intervention variable"). Then, the counterfactual result (e.g., "The probability of developing lung cancer decreases to 30% when not smoking") is calculated using the trained GNN model. Next, critical path tracing is performed. By comparing the differences in the outputs of each layer of the GNN between the original scenario result and the counterfactual result, the causal chain that has the greatest impact on the result is located, such as "smoking → tar deposition → lung cell mutation → lung cancer". Specifically, L1 regularization can be used to screen out the top 3 critical paths with the greatest contribution.
[0080] Then, natural language interpretation is used to generate a report that converts the quantitative results (80% → 30%), critical paths, and causal strength (e.g., "the direct impact of smoking on lung cancer has a weight of 0.7") into a natural language report. Specifically, it can include three elements: "current situation - counterfactual comparison - core cause".
[0081] Finally, an interpretable report is output, such as "The main cause of lung cancer in patients is smoking, which has a significant impact through the 'smoking → lung cell mutation' pathway; if smoking is quit, the probability of developing the disease can be reduced from 80% to 30%."
[0082] In summary, the data processing method based on the causal graph model provided in this invention has the following advantages:
[0083] (1) Explanatory and verifiable: By generating "if-then" explanations through counterfactual reasoning, the model can be verified by domain experts. For example, doctors can determine whether the impact of smoking cessation on the probability of lung cancer is reasonable. This feature effectively solves the "black box" problem of traditional AI, making the model's reasoning process and results more credible and interpretable.
[0084] (2) Strong adaptability to complex scenarios: Compared with traditional causal graph models, this technology can handle high-dimensional data with multiple variables. This enables accurate causal inference even when facing scenarios with a large number of complex variables, significantly improving the accuracy and applicability of causal inference in complex environments.
[0085] (3) Enhanced decision support capabilities: In the field of medical diagnosis, doctors can formulate targeted intervention plans based on the causal paths output by the model (such as "hypertension → heart disease"), such as prescribing antihypertensive drugs; in the field of financial risk control, it can identify the key causes of phenomena such as "overdue repayment" (such as "decreased income" rather than "gender"), which meets the requirements of fairness supervision. By providing clear causal relationships and key factors, it provides strong support for actual decision-making.
[0086] Figure 4 This is a schematic block diagram of a data processing device 400 based on a causal graph model provided in an embodiment of the present invention. The device 400 includes:
[0087] The data acquisition unit 401 is used to acquire target data and the corresponding reasoning results to be explained, and to construct a causal graph based on the target data to obtain the corresponding structured causal graph.
[0088] The causal constraint unit 402 is used to apply causal constraints to the structured causal graph using a causal constraint graph network learning mechanism to obtain an optimized causal graph;
[0089] The reasoning generation unit 403 is used to perform counterfactual reasoning on the reasoning result based on the optimized causal graph, and generate an explanation result of the target data based on the result of the counterfactual reasoning.
[0090] In this embodiment, a structured causal graph is first constructed based on the target data to provide a foundation for subsequent processing. Secondly, a causal constraint graph network learning mechanism is used to optimize the structured causal graph, enhancing the model's causal expressive power. Finally, counterfactual reasoning is performed based on the optimized causal graph to generate explanations of the target data, providing causally explanatory outputs.
[0091] This embodiment deeply integrates causal graph models and graph neural network technology, and introduces a counterfactual reasoning module to construct a three-tiered architecture of "causal graph structured modeling + GNN deep feature learning + counterfactual reasoning interpretation generation." This enables accurate causal modeling and interpretation of high-dimensional nonlinear data, improving the application efficiency in data analysis and artificial intelligence. The data processing device based on the causal graph model provided in this embodiment not only overcomes the limitations of traditional causal graph models in processing high-dimensional nonlinear data, but also compensates for the shortcomings of graph neural network outputs in causal interpretability, providing a new approach and method for the development of data analysis and artificial intelligence.
[0092] In particular, the data processing device based on the causal graph model provided in this embodiment can be applied to different domain scenarios. For example:
[0093] (1) Healthcare
[0094] Disease diagnosis and etiology analysis: Input the patient's physical signs (such as blood pressure, blood sugar, genetic test results), medical history, medication records, etc., and output the causal path of the disease (such as "obesity → insulin resistance → diabetes") and counterfactual intervention suggestions (such as "if weight is reduced by 5kg, the probability of diabetes remission increases by 40%), which can help doctors develop personalized treatment plans.
[0095] Drug side effect tracing: Analyze variables such as drug components, patient constitution, and concurrent medications to trace the key causal chain of "drug → side effect" (e.g., "aspirin → gastric mucosal damage → gastric ulcer"), providing interpretable evidence for drug safety assessment.
[0096] (2) Financial risk control field
[0097] Credit default early warning: Integrating user income, debt, credit records and other data, it generates causal paths such as "declining income → insufficient repayment ability → default", and simulates counterfactual results such as "if income sources are increased, the probability of default will decrease by 25%", which can help financial institutions accurately assess risks and formulate intervention strategies (such as adjusting repayment terms).
[0098] (3) Intelligent manufacturing field
[0099] Equipment fault diagnosis: Input equipment operating parameters (such as temperature, pressure, vibration frequency), maintenance records and other data to deduce the causal relationship of "insufficient lubrication → component wear → failure and downtime", and predict "if lubrication is strengthened, the failure interval will be extended to 3 times the original", which can guide the factory to optimize the equipment maintenance plan.
[0100] (4) Meteorology and Environment
[0101] Extreme weather cause analysis: By integrating meteorological data such as temperature, humidity, and ocean currents, a causal diagram of "rising ocean temperature → abnormal atmospheric circulation → extreme precipitation" is constructed. Through counterfactual simulation, "if the ocean temperature decreases by 1°C, the probability of extreme precipitation decreases by 15%", providing quantitative support for climate intervention research.
[0102] Accordingly, based on the aforementioned scenarios, the target data described in this embodiment can specifically be medical data, such as patients' physiological indicators, medical history records, and gene sequencing results, used to reveal the mechanisms and influencing factors of disease occurrence; it can also be financial data, covering users' credit records, transaction behavior, and asset and liability status, used to assess credit risk and default probability; it can also be equipment operation data and maintenance logs in the industrial manufacturing field, used to diagnose equipment failures and optimize production plans; or it can be meteorological observation data, including temperature, humidity, air pressure, wind direction, and wind speed, used to analyze the causes of extreme weather and predict climate change trends. The method provided in this embodiment enables accurate causal modeling and interpretation of these complex, high-dimensional data, providing powerful decision support and intelligent services for multiple fields such as healthcare, financial risk control, intelligent manufacturing, meteorology, and the environment. Of course, this embodiment is also applicable to many other scenarios, such as traffic flow prediction, air quality improvement strategy formulation, and natural disaster risk assessment.
[0103] In one embodiment, the data acquisition unit 401 includes:
[0104] An initial generation unit is used to extract latent causal variables from the target data using an improved PC algorithm, and to generate an initial directed causal graph based on the latent causal variables; wherein, the improved PC algorithm is equipped with a dynamic adjustment mechanism for the mutual information threshold;
[0105] A structure encoding unit is used to perform causal structure encoding on the initial directed causal graph to obtain the structured causal graph.
[0106] In this embodiment, a causal graph is initialized based on the target data. Specifically, an improved PC algorithm is first employed. This algorithm introduces a dynamic adjustment mechanism for the mutual information threshold, enabling it to mine potential causal relationships between variables from the data, thereby generating an initial directed causal graph. Nodes represent variables, such as age or smoking status; directed edges represent potential cause-effect relationships. Compared to the traditional PC algorithm, this improved algorithm reduces false positives for spurious causal edges. Next, the constructed causal graph is converted into computer-processable structured data, resulting in a structured causal graph.
[0107] In one embodiment, the structure encoding unit includes:
[0108] The first matrix setting unit is used to set an adjacency matrix based on the initial directed causal graph;
[0109] The second matrix setting unit is used to set the node feature matrix according to the principle that each row corresponds to a feature vector of a variable and each column corresponds to a sample;
[0110] The matrix combining unit is used to combine the adjacency matrix and the node feature matrix to construct the structured causal graph.
[0111] The structured causal graph constructed in this embodiment specifically includes an adjacency matrix A and a node feature matrix X. In the adjacency matrix A, A[i][j] = 1 indicates that there is a causal edge between variable i and j, and A[i][j] = 0 indicates that there is no causal edge. In the node feature matrix X, each row corresponds to the feature vector of a variable (such as the standardized value of a continuous variable or the one-hot encoding of a discrete variable), and each column corresponds to a sample.
[0112] In practical applications, structured causal graphs can be constructed by combining initial causal relationship hypotheses provided by domain experts. For example, by setting up an expert knowledge fusion interface, if there are initial causal relationship hypotheses provided by experts, they can be incorporated into the adjacency matrix by assigning weights. For instance, the initial weight of the causal edge confirmed by the expert is set to 0.8, and the weight of the edge to be verified is set to 0.5, thereby achieving collaborative modeling driven by data and knowledge.
[0113] In one embodiment, such as Figure 5 As shown, the causal constraint unit 402 includes:
[0114] The first constraint setting unit 501 is used to set causal direction constraints on the message passing layer of the graph neural network.
[0115] The intensity quantization unit 502 is used to perform causal intensity quantization learning on the structured causal graph using a dynamic attention mechanism;
[0116] The nonlinear learning unit 503 is used to learn nonlinear causal relationships on the structured causal graph using the graph neural network, thereby constructing a nonlinear causal relationship model between variables;
[0117] The model output unit 504 is used to input the structured causal graph into the nonlinear causal relationship model between variables, and output the optimized causal graph from the nonlinear causal relationship model between variables.
[0118] In one embodiment, the first constraint setting unit 501 includes:
[0119] The second constraint setting unit is used to set causal direction constraints on the message passing layer according to the following formula:
[0120]
[0121] in, This represents the message passing layer after setting causal direction constraints. Parents(j) is the parent node of variable j in the causal graph. α i,j For attention weights, W (l) and b(l) All of these are parameters of the l-th layer of the graph neural network, and σ is the activation function.
[0122] This embodiment is based on causal reinforcement learning of graph neural networks (GNNs) to establish a causal constraint-based graph network learning mechanism. Specifically, it first designs a causal reinforcement-based GNN layer, that is, it adds causal direction constraints to the traditional GNN message passing formula, i.e., the formula...
[0123] Where Parents(j) is the parent node (i.e., the cause variable) of variable j in the cause-effect graph, α i,j Let be the attention weights (representing the strength of the causal influence of i on j), W(l) and b(l) be the parameters of the l-th layer, and σ be the activation function. This design ensures that information flows only from the "cause" node to the "effect" node, avoiding the undirected information confusion in traditional GNNs.
[0124] Next, the dynamic attention mechanism is optimized. This involves training to learn the attention weight α. i,j It assigns high weights (close to 1) to strong causal relationships (such as "smoking → lung cancer") and low weights (close to 0) to weak or spurious relationships (such as "ice cream sales → drowning accidents"), thereby achieving quantitative learning of causal strength.
[0125] Then, nonlinear causal relationships are captured. Through a 3-5 layer GNN network (introducing the ReLU activation function), the nonlinear causal relationships between variables are learned step by step (such as "the effect of age on blood pressure shows nonlinear differences in different weight groups"), which solves the problem that traditional causal graphs cannot model nonlinear relationships.
[0126] Finally, the optimized causal graph is output, which contains a weighted adjacency matrix that quantifies causal strength, with matrix elements of α. i,j The convergence value will also output the corresponding nonlinear causal relationship model between variables, which is stored in the form of GNN network parameters.
[0127] In one embodiment, such as Figure 6 As shown, the reasoning generation unit 403 includes:
[0128] The variable assumption unit 601 is used to obtain the key variables in the reasoning result and make counterfactual assumptions about the key variables to obtain the counterfactual scenario;
[0129] The causal intervention unit 602 is used to perform causal intervention on the counterfactual scenario based on the optimized causal graph and using the do calculus algorithm, and to calculate the counterfactual result using the nonlinear causal relationship model between variables;
[0130] The causal localization unit 603 is used to compare the original factual result and the counterfactual result of the reasoning result, and locate the causal chain that has the greatest impact on the reasoning result based on the result of the difference comparison;
[0131] Result generation unit 604 is used to generate the explanation result based on the causal chain.
[0132] In one embodiment, the result generation unit includes:
[0133] The report conversion unit is used to convert the causal strength quantification learning and causal chain into a natural language report using natural language interpretation generation technology, and output it as an interpretable report.
[0134] In this embodiment, a counterfactual-causal path linkage explanation mechanism is established during counterfactual reasoning and explanation generation. Based on the reasoning result to be explained (e.g., "Patient A has an 80% probability of developing lung cancer"), and the aforementioned optimized causal graph and model parameters, this embodiment first generates a counterfactual scenario. That is, for the key variable in the reasoning result (e.g., "smoking"), a counterfactual hypothesis (e.g., "If Patient A does not smoke") is generated. The scenario is simulated by modifying the values of the corresponding variables in the node feature matrix (e.g., changing "smoking = 1" to "smoking = 0"). Then, causal intervention calculation is performed. Based on the optimized causal graph, "do-calculus" is used to intervene in the counterfactual scenario (blocking all input edges pointing to "smoking" to ensure that all edges pointing to the variable are cut off while changing the variable, making the variable an "independent intervention variable"). Then, the counterfactual result (e.g., "The probability of developing lung cancer decreases to 30% when not smoking") is calculated using the trained GNN model. Next, critical path tracing is performed. By comparing the differences in the outputs of each layer of the GNN between the original scenario result and the counterfactual result, the causal chain that has the greatest impact on the result is located, such as "smoking → tar deposition → lung cell mutation → lung cancer". Specifically, L1 regularization can be used to screen out the top 3 critical paths with the greatest contribution.
[0135] Then, natural language interpretation is used to generate a report that converts the quantitative results (80% → 30%), critical paths, and causal strength (e.g., "the direct impact of smoking on lung cancer has a weight of 0.7") into a natural language report. Specifically, it can include three elements: "current situation - counterfactual comparison - core cause".
[0136] Finally, an interpretable report is output, such as "The main cause of lung cancer in patients is smoking, which has a significant impact through the 'smoking → lung cell mutation' pathway; if smoking is quit, the probability of developing the disease can be reduced from 80% to 30%."
[0137] In summary, the data processing device based on the causal graph model provided in the embodiments of the present invention has the following advantages:
[0138] (1) Explanatory and verifiable: By generating "if-then" explanations through counterfactual reasoning, the model can be verified by domain experts. For example, doctors can determine whether the impact of smoking cessation on the probability of lung cancer is reasonable. This feature effectively solves the "black box" problem of traditional AI, making the model's reasoning process and results more credible and interpretable.
[0139] (2) Strong adaptability to complex scenarios: Compared with traditional causal graph models, this technology can handle high-dimensional data with multiple variables. This enables accurate causal inference even when facing scenarios with a large number of complex variables, significantly improving the accuracy and applicability of causal inference in complex environments.
[0140] (3) Enhanced decision support capabilities: In the field of medical diagnosis, doctors can formulate targeted intervention plans based on the causal paths output by the model (such as "hypertension → heart disease"), such as prescribing antihypertensive drugs; in the field of financial risk control, it can identify the key causes of phenomena such as "overdue repayment" (such as "decreased income" rather than "gender"), which meets the requirements of fairness supervision. By providing clear causal relationships and key factors, it provides strong support for actual decision-making.
[0141] Please see Figure 7 , Figure 7 This is a schematic block diagram of a computer device provided in an embodiment of the present invention. The computer device is equipped with both wireless and wired communication capabilities.
[0142] The computer device includes a processor 702, a memory, and a network interface 705 connected via a system bus 701. The memory may include a non-volatile storage medium 703 and internal memory 704.
[0143] The non-volatile storage medium 703 can store an operating system 7031 and a computer program 7032. When the computer program 7032 is executed, it causes the processor 702 to perform a data processing method based on a causal graph model.
[0144] The processor 702 provides computing and control capabilities to support the operation of the entire computer device.
[0145] The internal memory 704 provides an environment for the execution of the computer program 7032 in the non-volatile storage medium 703. When the computer program 7032 is executed by the processor 702, the processor 702 can execute a data processing method based on a causal graph model.
[0146] This network interface 705 is used for network communication with other devices. Those skilled in the art will understand that... Figure 7The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the computer device to which the present invention is applied. A specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0147] The processor 702 is used to run a computer program 7032 stored in a memory to implement any embodiment of the above-described data processing method based on a causal graph model.
[0148] It should be understood that, in this embodiment of the invention, the processor 702 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0149] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:
[0150] Obtain the target data and the corresponding reasoning results to be explained, and construct a causal graph based on the target data to obtain the corresponding structured causal graph;
[0151] A causal constraint-based graph network learning mechanism is used to apply causal constraints to the structured causal graph, resulting in an optimized causal graph.
[0152] Based on the optimized causal graph, counterfactual reasoning is performed on the reasoning results, and an explanation of the target data is generated based on the results of the counterfactual reasoning.
[0153] This invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed, can perform the steps provided in the above embodiments. The storage medium may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0154] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0155] Obtain the target data and the corresponding reasoning results to be explained, and construct a causal graph based on the target data to obtain the corresponding structured causal graph;
[0156] A causal constraint-based graph network learning mechanism is used to apply causal constraints to the structured causal graph, resulting in an optimized causal graph.
[0157] Based on the optimized causal graph, counterfactual reasoning is performed on the reasoning results, and an explanation of the target data is generated based on the results of the counterfactual reasoning.
[0158] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or computer device described above can be referred to the relevant descriptions in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.
[0159] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0160] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0161] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A data processing method based on a causal graph model, characterized in that, include: Obtain the target data and the corresponding reasoning results to be explained, and construct a causal graph based on the target data to obtain the corresponding structured causal graph; A causal constraint-based graph network learning mechanism is used to apply causal constraints to the structured causal graph, resulting in an optimized causal graph. Based on the optimized causal graph, counterfactual reasoning is performed on the reasoning results, and an explanation of the target data is generated based on the results of the counterfactual reasoning.
2. The data processing method based on the causal graph model according to claim 1, characterized in that, The process of acquiring target data and corresponding inference results to be explained, and constructing a causal graph based on the target data to obtain a corresponding structured causal graph, includes: An improved PC algorithm is used to extract latent causal variables from the target data, and an initial directed causal graph is generated based on the latent causal variables; wherein, the improved PC algorithm is equipped with a dynamic adjustment mechanism for the mutual information threshold; The initial directed causal graph is causal structure encoded to obtain the structured causal graph.
3. The data processing method based on the causal graph model according to claim 2, characterized in that, The step of performing causal structure encoding on the initial directed causal graph to obtain the structured causal graph includes: Based on the initial directed causal graph, an adjacency matrix is set; The node feature matrix is set according to the principle that each row corresponds to a feature vector of a variable and each column corresponds to a sample; The structured causal graph is constructed by combining the adjacency matrix and the node feature matrix.
4. The data processing method based on the causal graph model according to claim 1, characterized in that, The step of employing a causal constraint-based graph network learning mechanism to apply causal constraints to the structured causal graph to obtain an optimized causal graph includes: Set causal direction constraints for the message passing layer of the graph neural network; A dynamic attention mechanism is used to perform causal strength quantification learning on the structured causal graph; The graph neural network is used to learn nonlinear causal relationships from the structured causal graph, thereby constructing a nonlinear causal relationship model between variables; The structured causal graph is input into the nonlinear causal relationship model between variables, and the optimized causal graph is output by the nonlinear causal relationship model between variables.
5. The data processing method based on the causal graph model according to claim 4, characterized in that, Setting causal direction constraints for the message passing layer of the graph neural network includes: The message passing layer is constrained by the following formula: in, This represents the message passing layer after setting causal direction constraints. Parents(j) is the parent node of variable j in the causal graph. α i,j For attention weights, W (l) and b (l) All of these are parameters of the l-th layer of the graph neural network, and σ is the activation function.
6. The data processing method based on the causal graph model according to claim 4, characterized in that, The step of performing counterfactual reasoning on the reasoning result based on the optimized causal graph, and generating an explanation result for the target data based on the result of the counterfactual reasoning, includes: Obtain the key variables in the reasoning results, and make counterfactual assumptions about the key variables to obtain the counterfactual scenario; Based on the optimized causal graph, the do calculus algorithm is used to perform causal intervention on the counterfactual scenario, and the counterfactual result is calculated using the nonlinear causal relationship model between variables; The original factual result and the counterfactual result of the reasoning are compared, and the causal chain that has the greatest impact on the reasoning result is located based on the result of the comparison. The explanation result is generated based on the causal chain.
7. The data processing method based on the causal graph model according to claim 6, characterized in that, The generation of the explanation result based on the causal chain includes: The causal strength quantification learning and causal chain are converted into a natural language report using natural language interpretation generation technology and output as an interpretability report.
8. A data processing device based on a causal graph model, characterized in that, include: The data acquisition unit is used to acquire target data and corresponding inference results to be explained, and to construct a causal graph based on the target data to obtain the corresponding structured causal graph. The causal constraint unit is used to apply causal constraints to the structured causal graph using a causal constraint graph network learning mechanism to obtain an optimized causal graph. The reasoning generation unit is used to perform counterfactual reasoning on the reasoning result based on the optimized causal graph, and generate an explanation result of the target data based on the result of the counterfactual reasoning.
9. A computer device, characterized in that, The system includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the data processing method based on a causal graph model as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the data processing method based on a causal graph model as described in any one of claims 1 to 7.
Citation Information
Cited By
Financial data causal relationship mining method and system for intelligent auditing
CN121120288A
Intelligent electric equipment monitoring and optimizing method
CN121485294A
A method for monitoring and optimizing intelligent electrical equipment
CN121485294B
Chemical process flow analog simulation method and system based on big data
CN121683240A
