Bayesian network structure learning method based on hierarchical search and feature selection
By employing a Bayesian network structure learning method with hierarchical search and feature selection, the efficiency and accuracy issues of causal relationship discovery under high-dimensional and complex data are addressed, achieving efficient and accurate causal relationship identification.
Patent Information
- Application Number
- CN202511618670.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-06
- Publication Date
- 2026-02-06
AI Technical Summary
Existing methods for discovering local causal structures suffer from problems such as redundant separation sets, low search efficiency, bottlenecks in V-structure detection, and lack of depth control when dealing with high-dimensional and complex data, leading to wasted computational resources and reduced recognition accuracy.
A Bayesian network structure learning method based on hierarchical search and feature selection is adopted. By initializing an undirected skeleton graph, applying the FCBF algorithm to screen potential parent-child sets, traversing the causal skeleton with a depth-first strategy, detecting bidirectional V-structures, and reducing the direction of Meek rules, a local directed acyclic graph is generated to optimize the discovery of causal relationships.
It improves the accuracy and efficiency of causal relationship discovery, reduces the number of conditional independence tests, enhances the accuracy of causal direction identification, and avoids invalid searches and noisy associations.
Smart Images

Figure CN121480751A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this application belong to the field of interpretable artificial intelligence technology, particularly to the fields of machine learning and data mining, specifically a Bayesian network structure learning method based on hierarchical search and feature selection. Background Technology
[0002] In the core areas of artificial intelligence and data science, causal discovery, which reveals potential causal relationships between variables from observational data, has become a key technology supporting explainable artificial intelligence (XAI), accurate decision-making, and deep understanding of complex systems. Unlike correlation analysis, which reveals statistical associations, causal discovery focuses on identifying directional mechanisms of influence between variables, which is crucial for key applications such as investigating the root causes of diseases, evaluating the effectiveness of policy interventions, and predicting financial risks.
[0003] In this context, local causal structure discovery, by focusing on efficiently identifying causal neighbors (i.e., their parent and child nodes) directly connected to a specific target variable, avoids the huge computational overhead of constructing a global causal structure graph, and thus demonstrates unique value and application potential in dealing with modern high-dimensional datasets (such as genomics, complex system monitoring, and large-scale user behavior analysis).
[0004] Currently, the mainstream technical approach for discovering local causal structures relies primarily on constraint-based methods. Although local causal discovery methods offer significant computational efficiency advantages over global methods, existing technologies still face serious bottlenecks when dealing with high-dimensional and complex data. First, the lack of an effective mechanism for reusing split sets during conditional independence testing leads to repeated calculations of split sets for identical variable pairs, resulting in numerous redundant tests. Second, the search strategy employs indiscriminate breadth-first traversal, failing to establish hierarchical priorities based on the causal distance between variables and target nodes, resulting in a significant waste of computational resources on distant nodes with weak correlations. More notably, V-structure detection requires traversing all pairwise combinations of the target node's neighbors, with computational complexity increasing exponentially with the number of neighbor combinations, creating a significant performance bottleneck in high-dimensional scenarios. Furthermore, the lack of an effective depth control mechanism causes the algorithm to overexplore edge nodes with extremely low causal correlations, not only significantly increasing computational overhead but also potentially reducing the accuracy of core causal structure identification due to the introduction of noisy correlations. Summary of the Invention
[0005] The embodiments of this invention aim to improve the efficiency and accuracy of causal relationship discovery by optimizing feature selection and hierarchical search strategies. Specifically, it provides a Bayesian network structure learning method based on hierarchical search and feature selection, which at least solves the technical problems of existing local causal discovery methods in the face of high-dimensional complex data, such as redundant separation sets, low search efficiency, bottleneck in V-structure detection, and lack of depth control.
[0006] To achieve the above objectives, the embodiments of this application provide the following technical solutions.
[0007] The Bayesian network structure learning method based on hierarchical search and feature selection includes the following steps:
[0008] Obtain the observation dataset, determine the target variable and set the parameters, including the significance level, maximum condition set size and search depth; initialize the undirected skeleton graph as a fully connected structure and establish a separation set cache matrix;
[0009] The FCBF algorithm is applied to filter variables related to the target variable based on adaptive thresholding to obtain the potential parent-child set;
[0010] Using the target variable as the root node, a hierarchical search is performed. During the search, a depth-first strategy is adopted to traverse the variables in the parent and child sets under the maximum depth constraint, and the causal skeleton is expanded layer by layer.
[0011] Bidirectional V-structure detection is performed within the neighborhood of the target variable, reusing the previously computed separation set; wherein, in the bidirectional V-structure detection, when the detection is target-centered, the V-structure of the target variable as a collider is detected to reveal common causal effects; when the detection is neighbor-centered, the V-structure of the neighbor node as a collider is detected to discover indirect causal paths.
[0012] Applying the Meek rule to perform orientation reduction on undirected edges generates a local directed acyclic graph.
[0013] If the parent-child relationship of the target variable is completely determined at the shallow level, the search is terminated early, and the parent node set, child node set, undirected neighbor set, and parent-child set are output.
[0014] Furthermore, the steps of initializing the undirected skeleton graph as a fully connected structure and establishing the split set cache matrix include:
[0015] Initialize the data structure, which includes a graph representation and a split-set cache. The graph representation includes a directed adjacency matrix (DAG), a partially directed adjacency matrix (pdag), and an undirected fully connected skeleton graph G; wherein:
[0016] The directed adjacency matrix (DAG) is represented as: DAG=0 p×p The directed adjacency matrix (DAG) has a dimension of p×p and all initial values are 0, indicating that there are no initial directed edges.
[0017] The directed adjacency matrix pdag is represented as: pdag=0 p×p The partially directed adjacency matrix pdag has a dimension of p×p and an initial value of 0, indicating that there is no initial orientation relationship.
[0018] The undirected fully connected skeleton graph G is represented as: G=1 p×p -I p The undirected skeleton graph G has a dimension of p×p and is initially a fully connected structure. All elements except the diagonal elements are 1, and the diagonal elements are 0.
[0019] The split set cache is represented as follows: The initial split set cache for all variable pairs (i,j) is an empty set.
[0020] Furthermore, the steps of applying the FCBF algorithm to adaptively threshold and filter variables related to the target variable to obtain the potential parent-child set include:
[0021] From all variables, select variables X whose symmetric uncertainty measure with respect to the target variable T exceeds the threshold δ, forming a potential parent-child set, expressed as: PC(T) = X│SU(X,T)>δ; where SU(X,T) is the symmetric uncertainty measure, expressed as:
[0022]
[0023] In the formula, I represents mutual information, which is used to measure the correlation strength between variables X and Y. Information entropy H is used to measure the uncertainty of variables, ensuring the symmetry of the correlation measurement between X and Y SU(X,Y)=SU(Y,X), and normalizing the result to [0,1], so that the correlation between different variables and T is comparable; where δ is the adaptive threshold, δ=0.01×log p, and the threshold δ scales logarithmically with the variable dimension p.
[0024] The parent-child set state is cached, and a tracking mechanism for the parent-child set computation state is introduced. The computation results are reused through state flags, represented as follows: In the formula, the p-dimensional marker vector in PC_calculated records whether the PC set of each variable has been calculated; the T-th bit of the p-dimensional vector PC_calculated is assigned a value of 0, indicating that the parent and child sets of the target variable T have not been calculated; after the parent and child sets of the target variable T are calculated, the value is changed to 1.
[0025] During hierarchical search, if a variable already marked as 1 is encountered, the parent and child set results marked as 1 are directly reused.
[0026] Furthermore, the steps of traversing the variables in the parent and child sets layer by layer using a depth-first strategy under the maximum depth constraint, and expanding the causal skeleton layer by layer, include:
[0027] Initialize the search queue and establish a depth-first search framework starting from the target variable T. The nodes in the first layer contain only the target variable T. The set of processed nodes is initially empty. The current search depth is initialized to 1, and traversal starts from the layer where the target variable is located.
[0028] Recursively traverse the parent - child set nodes, dynamically construct the causal skeleton, and use the depth - first strategy to preferentially explore a single path to the maximum depth.
[0029] Furthermore, the steps of using the depth - first strategy to preferentially explore a single path to the maximum depth include:
[0030] Recursively traverse the nodes in the PC set to dynamically construct the causal skeleton. When the current depth ≤ depth, traverse all nodes A in the th layer; if the PC set of A has not been calculated, calculate the PC set of A through the FCBF algorithm based on the adaptive threshold δ; for each potential neighbor node B in the PC set of A: if < depth, add the potential neighbor node B to the node set in the +1th layer;
[0031] If the connection value between A and B in the undirected skeleton graph G is 0, update G(A,B) to 1, establish an undirected connection, and at the same time update the partial directed adjacency matrix pdag(A,B) to 1, mark it as an undirected edge, and increment the current depth by 1; where A is the currently processed node and B is the potential neighbor node of A.
[0032] Furthermore, when performing target - centered detection, in the steps of detecting the V - structure where the target variable is the collider, the V - structure where the target variable is the collider is B → T ← C, which is expressed as:
[0033]
[0034] In the formula, ∀B,C ∈ PC(T) means that B and C come from the potential parent - child set of T; means that B and C are not adjacent; means that T is not in the separation set of B and C; is to verify whether T and C are still independent after adding B to the separation set sep through a chi - square test. If the test statistic is greater than the critical value at the significance level , it indicates that the association between B and C must be realized through T, further proving that B and C need to act on T together, and finally determining the directed relationship of B → T ← C, avoiding misjudging indirect associations as direct causal relationships and ensuring the recognition accuracy of the parent nodes of T.
[0035] Furthermore, when performing neighbor - centered detection, in the steps of detecting the V - structure where the neighbor node is the collider, the V - structure where the neighbor node is the collider is T → B ← C, which is expressed as:
[0036]
[0037] In the formula, B is a member of the parent-child set of T; This indicates that T and C are not adjacent; This indicates that B is not in the separate set of T and C; This indicates that the chi-square test verifies whether T and C are still not independent after adding B to the separating set sep. If the test statistic exceeds the critical value, it means that the association between T and C must be realized through B in order to determine the directional relationship of T→B←C.
[0038] Furthermore, in the step of reusing the calculated split set, a split set reuse mechanism is adopted, which reuses the calculated split set through caching, as follows:
[0039]
[0040] In the formula, sep(X,Y) is the separating set of the variable pair (X,Y). For cached historical detached sets, findSepSet is the detached set search function.
[0041] Furthermore, the steps of applying the Meek rule to perform orientation reduction on undirected edges to generate a locally directed acyclic graph include:
[0042] Applying Meek rules for orientation, and propagating causal directions through graph theory rules, can be represented as follows:
[0043]
[0044] In the formula, A→B represents a directed edge, and BC represents an undirected edge. This indicates that A and C are not adjacent. Indicates the directional operator;
[0045] The logic of rule 1 is: if A points to B, B and C are undirected, and A and C are not adjacent, then B must point to C;
[0046] Rule 2 is logically as follows: If A points to B, B points to C, and A and C are undirected, then A must point to C;
[0047] The graph representation is updated based on the orientation results. The already oriented undirected edges are removed, as shown below:
[0048]
[0049] In the formula, To mark the edge between B and C in pdag as a directed edge (B→C) with -1, the causal direction determined by the Meek rule is clearly recorded, which is used to further determine the parent-child relationship of the target variable and to provide accurate directional basis for extracting the parent / child node set; This means setting the edges between B and C in the undirected skeleton graph to 0.
[0050] Furthermore, if the parent-child relationship of the target variable is completely determined at the shallow level, the search is terminated early, including the following steps:
[0051] Check the orientation state of the target variable, calculate the orientation state of all connections of the target variable. If the sum of the absolute values of the directed adjacency matrix values of T pointing to other variables and the sum of the absolute values of the pdag values of other variables pointing to T are both 0, it means that all connections of T are oriented, and the termination flag stop_cond is true at this time.
[0052] When the causal relationship of the target variable is Shallow layers with a value of at least 2 are terminated early when the search is fully determined to avoid invalid searches in deeper layers.
[0053] Compared with existing technologies, the beneficial effects of the Bayesian network structure learning method based on hierarchical search and feature selection in this application are as follows: This application obtains the observation dataset, determines the target variable and sets the parameters; initializes the undirected skeleton graph as a fully connected structure and establishes a separation set cache matrix; applies the FCBF algorithm based on adaptive threshold to filter variables related to the target variable to obtain potential parent-child sets; performs hierarchical search with the target variable as the root node, adopts a depth-first strategy to traverse the variables in the parent-child sets under the maximum depth constraint, and expands the causal skeleton layer by layer; performs bidirectional V-structure detection in the neighborhood of the target variable and reuses the calculated separation set; applies the Meek rule to perform direction reduction on the undirected edges to generate a local directed acyclic graph; if the parent-child relationship of the target variable is completely determined in the shallow layer, the search is terminated early, and the parent node set, child node set, undirected neighbor set, and parent-child set are output. The structure learning method in this application embodiment limits the search range through a hierarchical search strategy, reduces the number of conditional independence tests by combining a split set caching mechanism, and improves the accuracy of causal direction recognition by using a dual V structure detection, thereby significantly improving the accuracy and efficiency of causal relationship discovery. Attached Figure Description
[0054] The accompanying drawings, which form part of this application, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.
[0055] In the attached diagram:
[0056] Figure 1 This is a flowchart of the Bayesian network structure learning method based on hierarchical search and feature selection, as described in an embodiment of the present invention.
[0057] Figure 2 A schematic diagram of the orientation process of the causal skeleton provided in an embodiment of the present invention;
[0058] Figure 3 This is a structural block diagram of a terminal device provided in an embodiment of the present invention. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0060] Figure 1 This is a flowchart of the Bayesian network structure learning method based on hierarchical search and feature selection, as described in an embodiment of the present invention.
[0061] Please refer to Figure 1 In one embodiment of this application, a Bayesian network structure learning method based on hierarchical search and feature selection is provided, including the following steps:
[0062] Step S1: Obtain the observation dataset, determine the target variable and set the parameters, including the significance level, maximum condition set size and search depth; initialize the undirected skeleton graph as a fully connected structure and establish a separation set cache matrix;
[0063] Step S1 in this embodiment is data preparation, and the matrix representation of the observation dataset is as follows: , receive a p-dimensional observation data matrix of N samples, where each row of the matrix represents a sample and each column represents a variable; where R represents the set of real numbers, N represents the number of samples, and p represents the dimension of the variable;
[0064] Furthermore, specify the target variable T. Identify the core variables that need to be analyzed for causal relationships, such as pathogenic genes in gene databases or target indicators in financial data.
[0065] In the parameter settings, core algorithm parameters are configured to balance computational efficiency and result accuracy; among them, the significance level is set. The threshold used for conditional independence testing, with a default value of 0.05; sets the maximum condition set size. The complexity of the independence test is limited by a default value of 3; the search depth is set. This controls the number of levels in the hierarchical search; the default value is 2.
[0066] Furthermore, in step S1, data structure initialization is performed. Specifically, the data structure includes graph representation and split set cache. The graph representation includes directed adjacency matrix DAG, partially directed adjacency matrix pdag, and undirected fully connected skeleton graph G. In this embodiment, by initializing three types of graph representation and split set cache, a data structure foundation is established for subsequent search.
[0067] in:
[0068] The directed adjacency matrix (DAG) provided in this embodiment is represented as: DAG=0 p×p The directed adjacency matrix (DAG) has a dimension of p×p and all initial values are 0, indicating that there are no initial directed edges.
[0069] In this embodiment, the directed adjacency matrix pdag is represented as: pdag=0 p×p The partially directed adjacency matrix pdag has a dimension of p×p and an initial value of 0, indicating that there is no initial orientation relationship.
[0070] The undirected fully connected skeleton graph G provided in this embodiment is represented as: G=1 p×p -I p The undirected skeleton graph G has a dimension of p×p and is initially a fully connected structure. All elements except the diagonal elements are 1, and the diagonal elements are 0.
[0071] The split set cache is represented as follows: The initial split set cache for all variable pairs (i,j) is an empty set.
[0072] Please continue to refer to Figure 1 The Bayesian network structure learning method based on hierarchical search and feature selection provided in this application also includes the following steps:
[0073] Step S2: Apply the FCBF algorithm to filter variables related to the target variable based on adaptive thresholding to obtain the potential parent-child set;
[0074] Step S2 in this embodiment is a feature selection step, which is used to obtain the potential parent-child set (PC set).
[0075] In this embodiment, step S2, which uses the FCBF algorithm to adaptively threshold-filter variables related to the target variable to obtain a potential parent-child set, includes:
[0076] Select variables X from all variables whose symmetric uncertainty measure (SU) exceeds the threshold δ with respect to the target variable T, and form a potential parent-child set (PC set), which is expressed as: PC(T)=X│SU(X,T)>δ;
[0077] In the formula, SU(X,T) is a symmetric uncertainty measure, expressed as:
[0078]
[0079] In the formula, mutual information I is used to measure the correlation strength between variables X and Y, and information entropy H is used to measure the uncertainty of variables. In this embodiment, mutual information I and information entropy H are used to calculate SU to ensure the symmetry of the correlation measurement between X and Y, SU(X,Y)=SU(Y,X), and the result is normalized to [0,1] to make the correlation between different variables and T comparable; where δ is an adaptive threshold, δ=0.01×logp, the threshold δ scales logarithmically with the variable dimension p. The threshold is small in low dimensions to avoid missing weakly correlated key variables, while the threshold is slightly higher in high dimensions to filter noise variables, thereby adapting to different data scenarios;
[0080] Caching the parent-child set state avoids redundant calculations; by introducing a tracking mechanism for the parent-child set calculation state, the reuse of calculation results is achieved through state flags, represented as: In the formula, the p-dimensional marker vector in PC_calculated records whether the PC set of each variable has been calculated. By introducing a tracking mechanism for the calculation status of the PC set, the calculation results can be reused and duplicate calculations can be avoided through simple marker assignment, thus solving the redundancy problem of repeated calculation of the same variable's PC set in traditional algorithms. Specifically, the T-th bit of the p-dimensional vector PC_calculated is assigned a value of 0, indicating that the parent and child sets of the target variable T have not been calculated. After the PC set of the target variable T is calculated, it is changed to 1. When performing subsequent hierarchical search, if a variable marked as 1 is encountered, the parent and child set results of the variable marked as 1 can be directly reused, which can avoid duplicate calculations and prevent numerical errors caused by duplicate calculations.
[0081] Please continue to refer to Figure 1 and Figure 2 The Bayesian network structure learning method provided in this application embodiment further includes the following steps:
[0082] Step S3: Using the target variable as the root node, perform a hierarchical search. During the search, a depth-first strategy is used to traverse the variables in the parent and child sets under the maximum depth constraint, and expand the causal skeleton layer by layer.
[0083] Step S3 in this embodiment is a hierarchical search step. In the specific implementation of step S3, the search queue is initialized, and a depth-first search framework starting from the target variable T is established, as follows:
[0084]
[0085] In the formula, layer_nodes represents the set of "nodes to be processed" categorized by depth. Placing T in the first layer (layer_nodes{1}) means that with T as the root node, the process starts from the first layer where T is located and then expands to deeper layers. The processed set is empty and is used to record the nodes that have been processed. During subsequent searches, for the encountered nodes, first check whether they are in the processed set. If not, continue the processing to avoid repeatedly traversing the same node, preventing invalid calculations and logical chaos.
[0086] Therefore, for the nodes in the first layer, only the target variable T is included; the set of processed nodes is initially an empty set; the current search depth is initially set to 1, and the traversal starts from the layer where the target variable is located;
[0087] Furthermore, in this embodiment, by recursively traversing the parent - child set nodes, a causal skeleton is dynamically constructed. The depth - first strategy preferentially explores a single path to the maximum depth. The steps of preferentially exploring a single path to the maximum depth by the depth - first strategy include:
[0088] Recursively traverse the nodes in the PC set to dynamically construct the causal skeleton. At the current depth ≤ depth, traverse all the nodes A in the th layer. If the PC set of A has not been calculated (judged by the PC_calculated flag vector, and if not calculated, it is marked as 0), then calculate the PC set of A through the FCBF algorithm based on the adaptive threshold δ. For each variable B in the PC set of A: if < depth, add B to the node set of the +1th layer (layer_nodes{ +1});
[0089] If the connection value between A and B in the undirected skeleton graph G is 0 (indicating no current connection), then update G(A,B) to 1, establish an undirected connection, and at the same time update the partial directed adjacency matrix pdag(A,B) to 1, mark it as an undirected edge, and increment the current depth by 1. Here, A is the currently processed node, B is the potential neighbor node of A. The purpose of the depth - first strategy is to preferentially explore a single path to the maximum depth, avoiding the ineffective exploration of weakly associated distant nodes in breadth - first traversal and reducing the waste of computing resources.
[0090] Please continue to refer to Figure 1 , the Bayesian network structure learning method provided by the embodiment of the present application further includes the following steps:
[0091] Step S4: Perform a two - way V - structure detection within the neighborhood of the target variable, and reuse the calculated separation sets;
[0092] Among them, in the two - way V - structure detection, when detecting with the target as the center, detect the V - structure where the target variable is the collider, which is used to reveal the common causal effect;
[0093] In neighbor-centric detection, the V-structure of neighbor nodes is used as a collider to discover indirect causal paths;
[0094] Step S5: Apply the Meek rule to perform orientation reduction on the undirected edges to generate a local directed acyclic graph;
[0095] Step S6: If the parent-child relationship of the target variable is completely determined at the shallow level, terminate the search early and output the parent node set, child node set, undirected neighbor set, and parent-child set.
[0096] Specifically, in step S4 of this embodiment, during the target-centered detection, in the step of detecting the V structure of the target variable as a collider, the V structure of the target variable as a collider is B→T←C, which is used to reveal the common causal effect, and is expressed as:
[0097]
[0098] In the formula, This indicates that B and C come from the potential parent-child set (PC set) of T. This is because the PC set has been filtered by the FCBF algorithm to identify variables that are significantly related to T and to eliminate redundant variables that are not related to T. This narrows the detection range from the source and avoids the computational complexity explosion caused by traversing all combinations of variables in traditional algorithms.
[0099] in addition, This indicates that B and C are not adjacent, and is used to exclude chain-like associations such as BCT. If B and C are adjacent, they may affect T through direct connection rather than acting on T together.
[0100] in addition, This indicates that T is not in the separating set of B and C, which means that the association between B and C depends on T. If T is a member of the separating set, it means that B and C can be independent through other variables and do not need to establish an association through T. In this case, a V structure with T as the collider cannot be formed.
[0101] in addition, To verify whether T and C are still not independent after adding B to the separating set sep using the chi-square test, if the test statistic is greater than the critical value at the significance level α (default 0.05), This indicates that the association between B and C must be realized through T, further proving that B and C need to work together on T, ultimately determining the directional relationship B→T←C, avoiding misjudging indirect associations (such as B→D→T, C→D→T) as direct causality, and ensuring the accuracy of T's parent node identification.
[0102] Furthermore, in step S4, during the neighbor-centered detection, in the step of detecting the V structure of neighbor nodes as colliders, the V structure of neighbor nodes as colliders is T→B←C, used to discover indirect causal paths, and is represented as:
[0103]
[0104] In the formula, By limiting B to a member of the parent-child set of T (i.e., a potential neighbor of T), we ensure that there is a direct basis for the relationship between B and T. By limiting C to a member of the PC set of B, rather than a member of the PC set of T, we can focus on the key node C in indirect paths such as T→B→C. If C also belongs to the PC set of T, it may have a direct relationship with T without needing to establish an indirect relationship through B. In this case, the detection target of indirect causal path is not satisfied.
[0105] This indicates that T and C are not adjacent, directly excluding the direct association between T and C, ensuring that subsequent detections are of indirect paths;
[0106] This indicates that B is not in the separate set of T and C, which means that the association between T and C depends on B. If B is a member of the separate set, T and C can be independent through other variables without B as an intermediary. In this case, a V structure with B as the collision point cannot be formed.
[0107] This indicates that the chi-square test verifies whether T and C are still not independent after adding B to the separating set sep. If the test statistic exceeds the critical value, it means that the association between T and C must be realized through B, thus determining the directional relationship T→B←C. This clarifies both the direct causal effect of T on B and the direct effect of B on C, thereby fully restoring the indirect causal path T→B→C. This avoids missing deep causal relationships by only focusing on T's direct neighbors, and improves the coverage and completeness of the causal structure in high-dimensional data.
[0108] Furthermore, in step S4, during the step of reusing the calculated separation set, a separation set reuse mechanism is adopted. By caching and reusing the calculated separation set, redundant conditional independence checks are reduced, as expressed as:
[0109]
[0110] In the formula, sep(X,Y) is the separating set of the variable pair (X,Y). The cached historical split set is defined by `findSepSet`, which is the split set search function. This embodiment can solve the redundancy problem of repeatedly calculating split sets for the same variable pairs in traditional algorithms. In high-dimensional data, variable pairs (X,Y) may be repeatedly called in different search layers. Directly reusing cached results can significantly reduce the number of conditional independence tests. Verification has shown that this mechanism can significantly reduce the number of tests by 30% to 50% (especially when the variable dimension p is greater than 100), while avoiding the error introduced by repeated calculations and ensuring the consistency of the split set.
[0111] Furthermore, in step S5, the step of applying the Meek rule to perform orientation reduction on the undirected edges to generate a local directed acyclic graph includes:
[0112] Applying Meek rules for orientation, and propagating causal directions through graph theory rules, resolves ambiguities in the direction of some edges, as shown below:
[0113]
[0114] In the formula, A→B represents a directed edge, and BC represents an undirected edge. This indicates that A and C are not adjacent. This represents the orientation operator; the rules implemented in this paper can resolve the orientation ambiguity problem of undirected edges. In Bayesian network structure learning, the orientation of all edges cannot be determined by V structure detection alone. The MeeK rule completes the orientation by logically passing the existing orientation edges, generating a local directed acyclic graph (DAG).
[0115] The logic of rule 1 is as follows: if A points to B, B and C are undirected, and A and C are not adjacent, then B must point to C to avoid forming a contradictory V structure of A→B←C.
[0116] Rule 2 is logically as follows: If A points to B, B points to C, and A and C are undirected, then A must point to C to ensure causal transitivity and avoid the loop structure caused by the reverse edge C→A formed between A and C.
[0117] Rule 1 and Rule 2 in this embodiment together ensure the acyclicity of the graph structure and the consistency of causal direction.
[0118] Furthermore, in this embodiment, the graph representation is updated based on the orientation results, and the already oriented undirected edges are removed, as shown below:
[0119]
[0120] In the formula, To mark the edge between B and C in pdag as a directed edge (B→C) with -1, the causal direction determined by the Meek rule is clearly recorded. This is used to further determine the parent-child relationship of the target variable and to provide accurate directional basis for extracting the parent / child node set, thus avoiding ambiguity in the causal direction. This means setting the edge between B and C in the undirected skeleton graph to 0 (removing the undirected edge). Since the edge has been converted into a directed edge through orientation, removing the undirected edge can avoid the contradiction that the same pair of nodes in the graph structure has both undirected and directed edges at the same time. This ensures that the undirected skeleton graph G only retains undirected edges, maintaining the consistency and clarity of the graph structure.
[0121] Furthermore, in step S6, if the parent-child relationship of the target variable is completely determined at the shallow level, the search is terminated early, including:
[0122] Check the orientation state of the target variable, calculate the orientation state of all connections to the target variable, and satisfy the condition when there are no unoriented edges, as expressed as:
[0123]
[0124] In the formula, This indicates an absolute value function, and `stop_cond` is a boolean termination flag. To calculate the total number of undirected edges among the edges from the target variable T to all other variables j, To calculate the total number of undirected edges among all edges pointing to T from all other variables i, when the sum of the two is 0, it means that all connections of T (whether T points to other variables or other variables point to T) have no undirected edges, that is, the causal direction of all edges has been completely determined, and stop_cond is true at this time; that is, if the sum of the absolute values of the directed adjacency matrix values of T pointing to other variables and the sum of the absolute values of the pdag values of other variables pointing to T are both 0, it means that all connections of T are directed, and the termination flag stop_cond is true at this time.
[0125] When the causal relationship of the target variable is Shallow layers of at least 2 are terminated early when the search is fully determined to avoid invalid searches in deeper layers, represented as:
[0126]
[0127] In the formula, when stop_cond=true, it means that all the edges connected to the target variable have been oriented, that is, the parent-child relationship of the target variable has been completely determined; This indicates that at least the second level (shallow level) has been reached. This is because hierarchical search uses the target variable as the root (first level), and the second level consists of the target variable's direct neighbors (PC set members). Reaching the second level ensures that the direct causal relationships (parent / child nodes) of the target variable are fully explored, preventing the search from stopping prematurely due to a shallow depth (e.g., only searching the first level) and incomplete investigation of key relationships, thus avoiding the omission of causal information. This dual constraint avoids ineffective deep searches (e.g., searching to the third or fourth level after establishing relationships) while ensuring the reliability of shallow causal relationships, ultimately finding a balance between efficiency (reduced computational power) and accuracy (no loss of key information).
[0128] Furthermore, in step S6, the steps of outputting the parent node set, child node set, undirected neighbor set, and parent-child set include: extracting four types of key node sets from the partially directed graph, represented as:
[0129]
[0130] Where P is the set of parent nodes (direct cause), i.e., all variables X that satisfy the partial directed adjacency matrix value pdag(X,T)=-1 (-1 indicates X→T, i.e., X is the direct cause of T); C is the set of child nodes (direct result), i.e., all variables Y that satisfy pdag(T,Y)=-1 (indicating T→Y, i.e., Y is the direct result of T); UN is the set of undirected neighbors (ambiguous relation), i.e., all variables Z that satisfy pdag(T,Z)=1 (1 indicates that the connection between T and Z is undirected, and there is an ambiguous relation); PC is the potential parent-child set, i.e., the union of P, C, and UN (covering all candidate variables directly related to T); U is the set union operation;
[0131] Finally, the embodiments of this application output computational efficiency metrics for algorithm performance evaluation;
[0132] The metrics include the total number of CI tests and the algorithm execution time.
[0133] In summary, the embodiments of this application are based on a Bayesian network structure learning method with hierarchical search and feature selection. By limiting the search range through a hierarchical search strategy, reducing the number of conditional independence tests by combining a split set caching mechanism, and improving the accuracy of causal direction recognition by using a dual V structure detection, the accuracy and efficiency of causal relationship discovery are greatly improved.
[0134] like Figure 3 As shown, in another embodiment of the present invention, a terminal device is provided. At the hardware level, the terminal includes a processor and optionally also includes an internal bus, a network interface, and a memory.
[0135] The memory may include main memory, such as high-speed random access memory, or non-volatile memory, such as at least one disk drive. Of course, the electronic device may also include other hardware required for its operations.
[0136] The processor, network interface, and memory can be interconnected via an internal bus, which can be an ISA bus, PCI bus, or EISA bus, etc.
[0137] The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 3 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0138] Memory is used to store programs. Specifically, programs may include program code, which includes computer operation instructions. Memory may include main memory and non-volatile memory, and provides instructions and data to the processor.
[0139] The processor reads the corresponding computer program from non-volatile memory into memory and then runs it, forming a traffic light color recognition device at the logical level.
[0140] The processor executes the program stored in the memory, and specifically performs the steps of the Bayesian network structure learning method based on hierarchical search and feature selection provided in the above embodiments.
[0141] The above is as stated in this application. Figure 1 The Bayesian network structure learning method based on hierarchical search and feature selection disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor.
[0142] The processor may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed through integrated logic circuits in the processor's hardware or through software instructions. The processor can be a general-purpose processor, including a central processing unit (CPU), a network processor, etc.; it can also be a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor.
[0143] The steps of the method disclosed in the embodiments of this application can be directly reflected as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor.
[0144] The software module can reside in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.
[0145] This application also proposes a computer-readable storage medium that stores one or more programs, the programs including instructions that, when executed by an electronic device including multiple applications, enable the electronic device to perform... Figure 1 The embodiment shown illustrates a Bayesian network structure learning method based on hierarchical search and feature selection, specifically used to execute the steps of the Bayesian network structure learning method based on hierarchical search and feature selection provided in the above embodiment.
[0146] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A Bayesian network structure learning method based on hierarchical search and feature selection, characterized in that, Includes the following steps: Obtain the observation dataset, determine the target variable and set parameters including significance level, maximum condition set size and search depth, initialize the undirected skeleton graph as a fully connected structure, and establish a separation set cache matrix; The FCBF algorithm is applied to filter variables related to the target variable based on adaptive thresholding to obtain the potential parent-child set; Using the target variable as the root node, a hierarchical search is performed. During the search, a depth-first strategy is used to traverse the variables in the parent and child sets under the maximum depth constraint, and the causal skeleton is expanded layer by layer. Perform bidirectional V-structure detection within the neighborhood of the target variable, reusing the previously computed separation set; wherein, in bidirectional V-structure detection, when the target is the center, the V-structure is detected with the target variable as the collider; when the neighbor is the center, the V-structure is detected with the neighbor node as the collider. Applying the Meek rule to perform orientation reduction on undirected edges generates a local directed acyclic graph. If the parent-child relationship of the target variable is completely determined at the shallow level, the search is terminated early, and the parent node set, child node set, undirected neighbor set, and parent-child set are output.
2. The Bayesian network structure learning method based on hierarchical search and feature selection according to claim 1, characterized in that, The steps of initializing the undirected skeleton graph as a fully connected structure and establishing the split-set cache matrix include: Initialize the data structures, which include a graph representation and a split-set cache; The graph representation includes a directed adjacency matrix (DAG), a partially directed adjacency matrix (pdag), and an undirected fully connected skeleton graph G; wherein: the directed adjacency matrix (DAG) is represented as: DAG=0 p×p The directed adjacency matrix (DAG) has dimensions p×p and is initialized to 0, indicating that there are no initial directed edges. The partial directed adjacency matrix pdag is represented as: pdag=0. p×p The partially directed adjacency matrix pdag has p×p dimensions and is initialized to 0, indicating no initial orientation relationship; the undirected fully connected skeleton graph G is represented as: G=1 p×p -I p The undirected skeleton graph G has a dimension of p×p and is initially a fully connected structure. All elements except the diagonal elements are 1, and the diagonal elements are 0. The split set cache is represented as follows: The initial split set cache for all variable pairs (i,j) is an empty set.
3. The Bayesian network structure learning method based on hierarchical search and feature selection according to claim 2, characterized in that, The steps of applying the FCBF algorithm to adaptively threshold-filter variables related to the target variable to obtain the potential parent-child set include: From all variables, select variables X whose symmetric uncertainty measure SU exceeds the threshold δ with respect to the target variable T, forming a potential parent-child set, expressed as: PC(T)=X│SU(X,T)>δ; where SU(X,T) is the symmetric uncertainty measure, expressed as: In the formula, I represents mutual information, which is used to measure the correlation strength between variables X and Y; information entropy H is used to measure the uncertainty of variables, ensure the symmetry of the correlation measure between X and Y SU(X,Y)=SU(Y,X), and normalize the result to [0,1], δ is the adaptive threshold, δ=0.01×log p, and the threshold δ scales logarithmically with the variable dimension p; The parent-child set state is cached, and a tracking mechanism for the parent-child set computation state is introduced. The computation results are reused through state flags, represented as follows: In the formula, the p-dimensional marker vector in PC_calculated records whether the PC set of each variable has been calculated; the T-th bit of the p-dimensional vector PC_calculated is assigned a value of 0, indicating that the parent and child sets of the target variable T have not been calculated; after the parent and child sets of the target variable T are calculated, the value is changed to 1. During hierarchical search, if a variable already marked as 1 is encountered, the parent and child set results marked as 1 are directly reused.
4. The Bayesian network structure learning method based on hierarchical search and feature selection according to claim 3, characterized in that, The steps of traversing variables in the parent and child sets using a depth-first strategy under the maximum depth constraint and expanding the causal skeleton layer by layer include: initializing the search queue, establishing a depth-first search framework starting from the target variable T, with the first layer nodes containing only the target variable T; initially setting the processed node set to an empty set; initializing the current search depth to 1 and starting traversal from the layer containing the target variable; recursively traversing the parent and child set nodes, dynamically constructing the causal skeleton, and prioritizing the exploration of single paths to the maximum depth using the depth-first strategy.
5. The Bayesian network structure learning method based on hierarchical search and feature selection according to claim 4, characterized in that, The depth-first strategy prioritizes exploring a single path to the maximum depth, including: Recursively traverse the nodes of the PC set to dynamically construct the causal skeleton. When the current depth ≤ depth, traverse all nodes A in the th layer; if the PC set of node A has not been calculated, calculate the PC set of A through the FCBF algorithm based on the adaptive threshold δ; for each potential neighbor node B in the PC set of node A: if < depth, add the potential neighbor node B to the node set of the +1 layer; If the connection value between A and B in the undirected skeleton graph G is 0, then G(A,B) is updated to 1 to establish an undirected connection. Simultaneously, the partial directed adjacency matrix pdag(A,B) is updated to 1, marked as an undirected edge, and the current depth is set. Add 1.
6. The Bayesian network structure learning method based on hierarchical search and feature selection according to claim 5, characterized in that, In target-centric detection, in the step of detecting the target variable as the collider's V-structure, the V-structure of detecting the target variable as the collider is B→T←C, represented as: In the formula, This indicates that B and C come from the potential parent-child set of T; This indicates that B and C are not adjacent; This indicates that T is not in the separate sets of B and C; To verify whether T and C are still not independent after adding B to the separating set sep using the chi-square test, if the test statistic is greater than the significance level... The critical value below This indicates that the connection between B and C must be realized through T, which proves that B and C need to act together on T, ultimately determining the directional relationship of B→T←C.
7. The Bayesian network structure learning method based on hierarchical search and feature selection according to claim 6, characterized in that, In neighbor-centric detection, the V-structure for detecting neighbor nodes as colliders is T→B←C, represented as: In the formula, B is a member of the parent-child set of T; This indicates that T and C are not adjacent; This indicates that B is not in the separate set of T and C; This indicates that the chi-square test verifies whether T and C are still not independent after adding B to the separating set sep. If the test statistic exceeds the critical value, it means that the association between T and C must be realized through B in order to determine the directional relationship of T→B←C.
8. The Bayesian network structure learning method based on hierarchical search and feature selection according to claim 7, characterized in that, In the step of reusing the calculated split set, a split set reuse mechanism is adopted, which reuses the calculated split set through caching, as follows: In the formula, sep(X,Y) is the separating set of the variable pair (X,Y). For cached historical detached sets, findSepSet is the detached set search function.
9. The Bayesian network structure learning method based on hierarchical search and feature selection according to claim 8, characterized in that, The steps for applying Meek rules to perform orientation reduction on undirected edges to generate a locally directed acyclic graph include: Applying Meek rules for orientation, and propagating causal directions through graph theory rules, can be represented as follows: In the formula, A→B represents a directed edge, and BC represents an undirected edge. This indicates that A and C are not adjacent. Indicates the directional operator; The logic of rule 1 is: if A points to B, B and C are undirected, and A and C are not adjacent, then B must point to C; Rule 2 is logically as follows: If A points to B, B points to C, and A and C are undirected, then A must point to C; The graph representation is updated based on the orientation results. The already oriented undirected edges are removed, as shown below: In the formula, This indicates that the edge between B and C in pdag is marked with -1 as a directed edge B→C; This means setting the edges between B and C in the undirected skeleton graph to 0.
10. The Bayesian network structure learning method based on hierarchical search and feature selection according to claim 9, characterized in that, If the parent-child relationship of the target variable is fully determined at a shallow level, the steps to terminate the search early include: Check the orientation state of the target variable, calculate the orientation state of all connections of the target variable. If the sum of the absolute values of the directed adjacency matrix values of T pointing to other variables and the sum of the absolute values of the pdag values of other variables pointing to T are both 0, it means that all connections of T are oriented, and the termination flag stop_cond is true at this time. When the causal relationship of the target variable is For shallow layers of at least 2, termination is initiated when the condition is fully determined.