This package extends Markov.m2. It is used to construct ideals corresponding to discrete graphical models, as described in several places, including the paper: Luis David Garcia, Michael Stillman and Bernd Sturmfels, "The algebraic geometry of Bayesian networks", J. Symbolic Comput., 39(3-4):331–355, 2005.
The package also constructs ideals of Gaussian Bayesian networks and Gaussian graphical models (graphs containing both directed and bidirected edges), as described in the papers: Seth Sullivant, "Algebraic geometry of Gaussian Bayesian networks", Adv. in Appl. Math. 40 (2008), no. 4, 482--513; Seth Sullivant, Kelli Talaska and Jan Draisma, "Trek separation for Gaussian graphical models", Annals of Statistics 38 no.3 (2010) 1665--1685.
Further, the package contains procedures to solve the identifiability problem for Gaussian graphical models as described in the paper: Luis D. Garcia-Puente, Sarah Spielvogel and Seth Sullivant, "Identifying causal effects with computer algebra", Proceedings of the 26th Conference of Uncertainty in Artificial Intelligence.
i1 : G = digraph {{a,{}},{b,{a}},{c,{a}},{d,{b,c}}} o1 = Digraph{a => set {} } b => set {a} c => set {a} d => set {b, c} o1 : Digraph |
i2 : R = markovRing (2,2,2,2) o2 = R o2 : PolynomialRing |
i3 : S = globalMarkov G o3 = {{{a}, {d}, {b, c}}, {{b}, {c}, {d}}} o3 : List |
i4 : I = markovIdeal(R,G,S) o4 = ideal (- p p + p p , - p p + 1,1,1,2 2,1,1,1 1,1,1,1 2,1,1,2 1,1,2,2 2,1,2,1 ------------------------------------------------------------------------ p p , - p p + p p , - 1,1,2,1 2,1,2,2 1,2,1,2 2,2,1,1 1,2,1,1 2,2,1,2 ------------------------------------------------------------------------ p p + p p , - p p + 1,2,2,2 2,2,2,1 1,2,2,1 2,2,2,2 1,1,2,1 1,2,1,1 ------------------------------------------------------------------------ p p + p p - p p - 1,1,1,1 1,2,2,1 1,2,2,1 2,1,1,1 1,2,1,1 2,1,2,1 ------------------------------------------------------------------------ p p - p p + p p + 1,1,2,1 2,2,1,1 2,1,2,1 2,2,1,1 1,1,1,1 2,2,2,1 ------------------------------------------------------------------------ p p , - p p + p p + 2,1,1,1 2,2,2,1 1,1,2,2 1,2,1,2 1,1,1,2 1,2,2,2 ------------------------------------------------------------------------ p p - p p - p p - 1,2,2,2 2,1,1,2 1,2,1,2 2,1,2,2 1,1,2,2 2,2,1,2 ------------------------------------------------------------------------ p p + p p + p p ) 2,1,2,2 2,2,1,2 1,1,1,2 2,2,2,2 2,1,1,2 2,2,2,2 o4 : Ideal of R |
i5 : netList pack(2,I_*) +-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+ o5 = |- p p + p p |- p p + p p | | 1,1,1,2 2,1,1,1 1,1,1,1 2,1,1,2 | 1,1,2,2 2,1,2,1 1,1,2,1 2,1,2,2 | +-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+ |- p p + p p |- p p + p p | | 1,2,1,2 2,2,1,1 1,2,1,1 2,2,1,2 | 1,2,2,2 2,2,2,1 1,2,2,1 2,2,2,2 | +-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+ |- p p + p p + p p - p p - p p - p p + p p + p p |- p p + p p + p p - p p - p p - p p + p p + p p | | 1,1,2,1 1,2,1,1 1,1,1,1 1,2,2,1 1,2,2,1 2,1,1,1 1,2,1,1 2,1,2,1 1,1,2,1 2,2,1,1 2,1,2,1 2,2,1,1 1,1,1,1 2,2,2,1 2,1,1,1 2,2,2,1| 1,1,2,2 1,2,1,2 1,1,1,2 1,2,2,2 1,2,2,2 2,1,1,2 1,2,1,2 2,1,2,2 1,1,2,2 2,2,1,2 2,1,2,2 2,2,1,2 1,1,1,2 2,2,2,2 2,1,1,2 2,2,2,2| +-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+ |
i6 : F = marginMap(1,R) o6 = map(R,R,{p - p , p - p , p - p , p - p , p - p , p - p , p - p , p - p , p , p , p , p , p , p , p , p }) 1,1,1,1 2,1,1,1 1,1,1,2 2,1,1,2 1,1,2,1 2,1,2,1 1,1,2,2 2,1,2,2 1,2,1,1 2,2,1,1 1,2,1,2 2,2,1,2 1,2,2,1 2,2,2,1 1,2,2,2 2,2,2,2 2,1,1,1 2,1,1,2 2,1,2,1 2,1,2,2 2,2,1,1 2,2,1,2 2,2,2,1 2,2,2,2 o6 : RingMap R <--- R |
i7 : I = F I o7 = ideal (- p p + p p , - p p + 1,1,1,2 2,1,1,1 1,1,1,1 2,1,1,2 1,1,2,2 2,1,2,1 ------------------------------------------------------------------------ p p , - p p + p p , - 1,1,2,1 2,1,2,2 1,2,1,2 2,2,1,1 1,2,1,1 2,2,1,2 ------------------------------------------------------------------------ p p + p p , - p p + 1,2,2,2 2,2,2,1 1,2,2,1 2,2,2,2 1,1,2,1 1,2,1,1 ------------------------------------------------------------------------ p p , - p p + p p ) 1,1,1,1 1,2,2,1 1,1,2,2 1,2,1,2 1,1,1,2 1,2,2,2 o7 : Ideal of R |
i8 : netList pack(2,I_*) +-------------------------------------+-------------------------------------+ o8 = |- p p + p p |- p p + p p | | 1,1,1,2 2,1,1,1 1,1,1,1 2,1,1,2| 1,1,2,2 2,1,2,1 1,1,2,1 2,1,2,2| +-------------------------------------+-------------------------------------+ |- p p + p p |- p p + p p | | 1,2,1,2 2,2,1,1 1,2,1,1 2,2,1,2| 1,2,2,2 2,2,2,1 1,2,2,1 2,2,2,2| +-------------------------------------+-------------------------------------+ |- p p + p p |- p p + p p | | 1,1,2,1 1,2,1,1 1,1,1,1 1,2,2,1| 1,1,2,2 1,2,1,2 1,1,1,2 1,2,2,2| +-------------------------------------+-------------------------------------+ |
i9 : netList primaryDecomposition I +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ o9 = |ideal (p p - p p , p p - p p , p p - p p , p p - p p , p p - p p , p p - p p , p p p p - p p p p , p p p p - p p p p , p p p p - p p p p , p p p p - p p p p , p p p p - p p p p , p p p p - p p p p , p p p p - p p p p , p p p p - p p p p , p p p p - p p p p )| | 1,2,2,2 2,2,2,1 1,2,2,1 2,2,2,2 1,2,1,2 2,2,1,1 1,2,1,1 2,2,1,2 1,1,2,2 2,1,2,1 1,1,2,1 2,1,2,2 1,1,1,2 2,1,1,1 1,1,1,1 2,1,1,2 1,1,2,2 1,2,1,2 1,1,1,2 1,2,2,2 1,1,2,1 1,2,1,1 1,1,1,1 1,2,2,1 2,1,1,1 2,1,2,2 2,2,1,2 2,2,2,1 2,1,1,2 2,1,2,1 2,2,1,1 2,2,2,2 1,1,1,1 2,1,2,2 2,2,1,2 2,2,2,1 1,1,1,2 2,1,2,1 2,2,1,1 2,2,2,2 1,1,2,2 2,1,1,1 2,2,1,2 2,2,2,1 1,1,2,1 2,1,1,2 2,2,1,1 2,2,2,2 1,1,1,1 1,1,2,2 2,2,1,2 2,2,2,1 1,1,1,2 1,1,2,1 2,2,1,1 2,2,2,2 1,2,1,2 2,1,1,1 2,1,2,2 2,2,2,1 1,2,1,1 2,1,1,2 2,1,2,1 2,2,2,2 1,1,1,1 1,2,1,2 2,1,2,2 2,2,2,1 1,1,1,2 1,2,1,1 2,1,2,1 2,2,2,2 1,2,2,2 2,1,1,2 2,1,2,1 2,2,1,1 1,2,2,1 2,1,1,1 2,1,2,2 2,2,1,2 1,1,2,1 1,2,2,2 2,1,1,2 2,2,1,1 1,1,2,2 1,2,2,1 2,1,1,1 2,2,1,2 1,2,1,1 1,2,2,2 2,1,1,2 2,1,2,1 1,2,1,2 1,2,2,1 2,1,1,1 2,1,2,2 | +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |ideal (p , p , p , p , p p - p p , p p - p p ) | | 1,2,2,2 1,2,2,1 1,2,1,2 1,2,1,1 1,1,2,2 2,1,2,1 1,1,2,1 2,1,2,2 1,1,1,2 2,1,1,1 1,1,1,1 2,1,1,2 | +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |ideal (p , p , p , p , p p - p p , p p - p p ) | | 1,2,2,2 1,2,2,1 1,1,2,2 1,1,2,1 1,2,1,2 2,2,1,1 1,2,1,1 2,2,1,2 1,1,1,2 2,1,1,1 1,1,1,1 2,1,1,2 | +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |ideal (p , p , p , p , p p - p p , p p - p p ) | | 1,1,2,2 1,1,2,1 1,1,1,2 1,1,1,1 1,2,2,2 2,2,2,1 1,2,2,1 2,2,2,2 1,2,1,2 2,2,1,1 1,2,1,1 2,2,1,2 | +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |ideal (p , p , p , p , p p - p p , p p - p p ) | | 1,2,1,2 1,2,1,1 1,1,1,2 1,1,1,1 1,2,2,2 2,2,2,1 1,2,2,1 2,2,2,2 1,1,2,2 2,1,2,1 1,1,2,1 2,1,2,2 | +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |
i10 : H = digraph {{d,{b,a}},{c,{}},{b,{c}},{a,{c}}} o10 = Digraph{a => set {c} } b => set {c} c => set {} d => set {a, b} o10 : Digraph |
i11 : T = globalMarkov H o11 = {{{a}, {b}, {d}}, {{c}, {d}, {b, a}}} o11 : List |
i12 : J = markovIdeal(R,H,T); o12 : Ideal of R |
i13 : netList pack(2,J_*) +-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+ o13 = |- p p - p p - p p - p p + p p + p p + p p + p p |- p p - p p - p p - p p + p p + p p + p p + p p | | 1,2,1,1 2,1,1,1 1,2,2,1 2,1,1,1 1,2,1,1 2,1,2,1 1,2,2,1 2,1,2,1 1,1,1,1 2,2,1,1 1,1,2,1 2,2,1,1 1,1,1,1 2,2,2,1 1,1,2,1 2,2,2,1| 1,2,1,2 2,1,1,2 1,2,2,2 2,1,1,2 1,2,1,2 2,1,2,2 1,2,2,2 2,1,2,2 1,1,1,2 2,2,1,2 1,1,2,2 2,2,1,2 1,1,1,2 2,2,2,2 1,1,2,2 2,2,2,2| +-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+ |- p p + p p |- p p + p p | | 1,1,1,2 1,1,2,1 1,1,1,1 1,1,2,2 | 1,2,1,2 1,2,2,1 1,2,1,1 1,2,2,2 | +-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+ |- p p + p p |- p p + p p | | 2,1,1,2 2,1,2,1 2,1,1,1 2,1,2,2 | 2,2,1,2 2,2,2,1 2,2,1,1 2,2,2,2 | +-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+ |
i14 : F = marginMap(3,R); o14 : RingMap R <--- R |
i15 : J = F J; o15 : Ideal of R |
i16 : netList pack(2,J_*) +-------------------------------------+-------------------------------------+ o16 = |- p p + p p |- p p + p p | | 1,2,1,1 2,1,1,1 1,1,1,1 2,2,1,1| 1,2,1,2 2,1,1,2 1,1,1,2 2,2,1,2| +-------------------------------------+-------------------------------------+ |- p p + p p |- p p + p p | | 1,1,1,2 1,1,2,1 1,1,1,1 1,1,2,2| 1,2,1,2 1,2,2,1 1,2,1,1 1,2,2,2| +-------------------------------------+-------------------------------------+ |- p p + p p |- p p + p p | | 2,1,1,2 2,1,2,1 2,1,1,1 2,1,2,2| 2,2,1,2 2,2,2,1 2,2,1,1 2,2,2,2| +-------------------------------------+-------------------------------------+ |