贝叶斯网络上检查条件独立性

匿名 (未验证) 提交于 2019-12-03 00:22:01
前两天做了一个在贝叶斯网络上检查子集间条件独立性的题,认真研究了一番。

题目要求在一个贝叶斯网络模型中,给出X、Y、Z三个集合,检查在观察到集合Z的条件下,集合X和集合Y的条件独立性。

这个题目有两种解法,一种是通过采样来估计,另一种是理论求解。这里,我通过将贝叶斯网络转化为一个无向图,深度搜索得到所有潜在的从X集到Y集的路径,然后观察Z集中的元素。通过检查每一条路径是否在观测Z集的情况下activated,可以得出条件独立性的最终判断。

算法如下。

    1. Convert the directed graph into an undirected graph.  
    2. Apply DFS algorithm to find all paths from X to Y.
    3. Save the current traversed path when algorithm meet Y. 
        Block Y in case of going trough Y
        Stop current finding and keep going to the next node.
    4. For each path, check their Activation, default True, which equal to the conditionally independence of X⊥Y|Z
        * (in 4.2)If the path is X-Y without any other node (len = 2), then False.
        4.1 Pick out the first two nodes, with a dummy node in front (trick).
        4.2 Pick out the next node in path and release the oldest node which picked.
            If there is no next node, then set path to False.
            (We check the path node by node, checking 3 of them each time.)
            4.2.1 When tail-to-tail (A <- B -> C)
                4.2.1.1 If B ∈ Z, then the path is BLOCKED, X⊥Y|Z is ture. True, Continue to next path. go 4

            4.2.2 When head-to-tail (A -> B -> C)
                4.2.2.1 If B ∈ Z, then the path is BLOCKED, X⊥Y|Z is ture. True, Continue to next path. go 4

            4.2.3 When head-to-tail (A -> B -> C)
                4.2.3.1 If B ∈ Z, then the path is BLOCKED, X⊥Y|Z is ture. True, Continue to next path. go 4

            4.2.4 When head-to-head (A -> B <- C)
                4.2.4.1 If B ∈ Z, then continue to next group of node. go 4.2

                    4.2.4.2.1 If there is no S ∈ Z, True, continue to next path. go 4
                    4.2.4.2.2 If there exist S ∈ Z, continue to next group of node. go 4.2
                    * If S ∈ Z continue to next group of node

    5. If all path is True, then the conditionally independence of X⊥Y|Z is True.


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!