Complex continuous distribution-oriented cause and effect graph inference method and system based on normalized flow
By employing a causal graph inference method with conditional RealNVP and differentiable NOTEARS acyclic constraints, the shortcomings in causal structure learning under strongly nonlinear relationships and complex distribution scenarios are addressed. This method achieves accurate likelihood modeling and counterfactual inference, thereby improving the interpretability and generalization ability of causal structures.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-14
- Publication Date
- 2026-04-14
AI Technical Summary
Existing technologies lack effective schemes for conditional density modeling and causal structure learning in scenarios with strong nonlinear relationships and complex continuous distributions, especially in counterfactual inference.
A causal graph inference method based on conditional RealNVP and differentiable NOTEARS acyclic constraints is adopted. Through structural parameterization, conditional construction, sparse regularization and gradient optimization, combined with sparse regularization and acyclic constraints, the end-to-end optimization and counterfactual inference of the causal graph are achieved.
It enhances the ability to accurately model strong nonlinear relationships and complex distributions, outputs acyclic causal graphs, and supports counterfactual inference, providing a basis for policy evaluation and decision support.
Smart Images

Figure QLYQS_4
Abstract
Description
Technical Field
[0001] This invention relates to the field of causal discovery and generative probabilistic modeling, specifically to a causal graph inference method and system based on RealNVP conditional normalization flow and differentiable NOTEARS acyclic constraints for strongly nonlinear continuous variable distributions, and supports counterfactual inference. Background Technology
[0002] Causal discovery of continuous variables often employs simplified assumptions such as linear Gaussian or additive noise. For strongly nonlinear relationships and complex continuous distributions, traditional methods suffer from insufficient characterization of conditional density, scoring bias, and structural instability. Normalized flows can achieve accurate likelihood estimation through invertible transformations; RealNVP, for example, constructs invertible affine transformations through coupling layers, making it suitable for modeling complex continuous distributions. Furthermore, differentiable NOTEARS acyclic constraints enable end-to-end optimization of causal structure learning in continuous spaces. Current techniques still lack a unified scheme that effectively integrates RealNVP's conditional density modeling with NOTEARS-style acyclic constraints and further supports counterfactual inference. Summary of the Invention
[0003] 3.1 Purpose of the Invention: To provide a causal graph inference method and system that integrates conditional RealNVP density modeling and differentiable NOTEARS acyclic constraints, so as to improve the causal structure inference capability in strongly nonlinear continuous distribution scenarios, and output counterfactual inference results after obtaining the structure.
[0004] 3.2 Technical Solution This invention includes: structural parameterization (matrix A), condition construction (formed by A controlling the contribution of parent variables). ), conditional RealNVP likelihood modeling, objective function with sparse regularization and NOTEARS acyclic constraints, gradient optimization solution, thresholded output causal graph, and counterfactual inference based on structure and conditional models.
[0005] 3.3 Beneficial Effects Compared with the prior art, the present invention has at least the following beneficial effects: (1) RealNVP conditional flow improves the ability to accurately model the likelihood of strong nonlinear relationships and complex distributions; (2) NOTEARS differentiable acyclic constraints enable end-to-end optimization of structure learning and output acyclic causal graphs; (3) Sparse regularization improves the interpretability and generalization ability of the structure; (4) Counterfactual inference can be performed after obtaining the structure, providing a basis for strategy evaluation, risk analysis and decision support. Detailed Implementation
[0006] 4.1 Overall Process S1: Data Input and Preprocessing: Obtain D, optional standardization; S2: Initialize structure parameter A and set diagonal to 0; S3: Construct conditional input for each variable. ,Depend on Controlling parent variable contribution; S4: Establishing conditional RealNVP for each variable: Coupled layer stacking, scaling / translating the network to... As a condition; S5: Construct the objective function: conditional log-likelihood + Sparse regularization + NOTEARS acyclic constraint penalty; S6: obtained by iterative optimization using augmented Lagrangian or penalty method. S7: Thresholding output causal graph S8: Based on Perform counterfactual inference with conditional RealNVP, and output counterfactual sample / variable values.
[0007] 4.2 Key Points for Implementing Conditional RealNVP (Example) When modeling univariate conditions, one can... It is treated as a one-dimensional input and employs a multi-level coupling layer for reversible transformation; when the conditional modeling of multiple variables is merged into a unified network in the implementation, different i can also share part of the network and use variable identifiers or different output heads. Each coupling layer includes: selecting the invariant sub-vector and the transformed sub-vector; based on the invariant part and the condition vector... calculate , An affine transformation is applied to the transformed part, and log-det is accumulated. This structure enables highly expressive modeling of strongly nonlinear conditional distributions and achieves computationally accurate likelihoods.
[0008] 4.3 NOTEARS Acyclic Constraints and Optimization (Example) A is used as a continuously differentiable parameter in the optimization, and differentiable acyclic constraints in the NOTEARS style are applied. The corresponding directed acyclic graph is restricted; during training, the acyclic constraint is gradually strengthened using a penalty method or an augmented Lagrange method, so that the final result is... It satisfies the requirement of being acyclic and exhibits a sparse structure.
[0009] 4.4 Counterfactual Inference (Example) For a factual sample x, firstly, a noise / basis distribution representation consistent with the fact is obtained based on the conditional RealNVP model; then, an intervention is applied. Fix the variable being intervened; finally, according to The topological order is used to generate conditional samples for the remaining variables, resulting in counterfactual samples. The output can be the entire counterfactual sample, the counterfactual value of the target variable, or the counterfactual distribution statistic formed by multiple samplings.
Claims
1. A causal graph inference method based on RealNVP and differentiable NOTEARS constraints for strongly nonlinear continuous variable distributions, characterized in that, The steps include: (1) Obtaining a sample dataset containing d continuous variables. ,in ; (2) Construct a learnable structure parameter matrix ,in Representing variables (3) Based on the structural parameter matrix A, determine the candidate causal connection strength and constrain the diagonal elements to be zero; Define a continuous relaxed representation of the parent variable set and construct the conditional input vector. The conditional input vector (4) For each variable, the observed values are obtained by gating or weighting at least the parent variable; Construct a conditional input vector For the conditional RealNVP conditional normalized flow model, to... Modeling is performed, where RealNVP consists of multiple coupling layers, each of which keeps part of the input unchanged and applies a reversible affine transformation to another part; (5) Calculate the log-likelihood of the dataset under the conditional RealNVP model and construct the objective function for causal structure learning: in For sparse regularization coefficients, The penalty coefficient for acyclic constraints. (6) The differentiable acyclic constraint function; (7) Use NOTEARS style acyclic constraints to make A correspond to a directed acyclic graph; (8) Use gradient-based joint optimization or alternating optimization to update the structural parameters A and RealNVP parameters. To obtain the optimal structural parameters (8) To Thresholding is performed to determine the edge set. Output the cause-effect graph ; (9) Based on the causal graph The learned conditional RealNVP model is used to perform counterfactual inference and output the counterfactual results under given factual samples and given intervention conditions.
2. The method according to claim 1, characterized in that, In step (4), the reversible affine transformation of each RealNVP coupling layer is determined by the scaling function. With translation function Implementation, and the The input must contain at least a conditional input vector. .
3. The method according to claim 1, characterized in that, The gating or weighted combination described in step (3) is determined by the row vectors of the structural parameter matrix A. Generate, so that when When approaching zero, the variable For conditional input vectors The contribution was suppressed.
4. The method according to claim 1, characterized in that, The objective function further includes constraint or regularization terms for stable training in strongly nonlinear scenarios, the constraint or regularization terms including one or more of the following: parameter norm regularization, gradient clipping, or constraints on the output range of the scaling function.
5. The method according to claim 1, characterized in that, The NOTEARS-style acyclic constraint function in step (6) is a differentiable constraint based on matrix functions, and differentiable optimization is achieved by nonnegating or squaring the elements of A before entering the acyclic constraint function.
6. The method according to claim 1, characterized in that, Step (7) uses the augmented Lagrange method or the penalty method to optimize the acyclic constraint, and dynamically adjusts the penalty coefficient and Lagrange multiplier during the iteration process.
7. The method according to claim 1, characterized in that, The thresholding in step (8) includes: according to Sort by size from largest to smallest and keep the first K edges, or use a fixed threshold. Retain satisfaction The edge.
8. The method according to claim 1, characterized in that, The counterfactual inference in step (9) includes at least: (9-1) calculating the noise representation or base distribution representation of each variable for the fact sample x; (9-2) under the intervention conditions (9-3) Fix the values of the intervention variable; according to the causal diagram Based on the topological order, the conditional RealNVP model is used to generate counterfactual values for the remaining variables, and counterfactual samples are output. .
9. A causal graph inference system based on RealNVP and differentiable NOTEARS constraints for strongly nonlinear continuous variable distributions, characterized in that, include: — Data acquisition module; — The structure parameter module is used to construct and update the structure parameter matrix A; — Condition construction module, used to construct conditional input vectors for each variable based on A. ; — The RealNVP modeling module is used to build conditional RealNVP models to estimate ; — Objective function module, used to construct an objective function containing likelihood terms, sparse regularization terms, and NOTEARS-style acyclic constraint terms; — Optimization solution module, used to solve... and ; — Counterfactual inference module, used for... Perform counterfactual inference with the conditional RealNVP model and output counterfactual results.