The ring R must be a ring of probability distributions on n random variables created using markovRing. The integer i must be in the range from 1 to n.
Let pu1,u2,…, +,…,un denote the linear form pu1,u2,…, 1,…,un + …+ pu1,u2,…, di,…,un, where di is the number of states of random variable Xi.
The method marginMap returns a ring map F : R →R such that after applying F, the indeterminate pu1,u2,…,1,…,un refers to pu1,u2,…, +,…,un, where the ’1’ and the ’+’ are in the ith spot.
Further F is the identity on all other indeterminates, that is, F(pu1,u2,…, j,…,un) = pu1,u2,…, j,…,un , for all j≥2.
i1 : F = marginMap(1,markovRing(3,2));
o1 : RingMap QQ[p , p , p , p , p , p ] <--- QQ[p , p , p , p , p , p ]
1,1 1,2 2,1 2,2 3,1 3,2 1,1 1,2 2,1 2,2 3,1 3,2
|
i2 : compactMatrixForm =false; |
i3 : transpose F.matrix
o3 = | p - p - p |
| 1,1 2,1 3,1 |
| |
| p - p - p |
| 1,2 2,2 3,2 |
| |
| p |
| 2,1 |
| |
| p |
| 2,2 |
| |
| p |
| 3,1 |
| |
| p |
| 3,2 |
6 1
o3 : Matrix (QQ[p , p , p , p , p , p ]) <--- (QQ[p , p , p , p , p , p ])
1,1 1,2 2,1 2,2 3,1 3,2 1,1 1,2 2,1 2,2 3,1 3,2
|
This linear transformation simplifies ideals and/or polynomials involving pu1,u2,..., +,...,un . Sometimes, the resulting ideals are toric ideals as the example below shows. For more details see the paper "Algebraic Geometry of Bayesian Networks" by Garcia, Stillman, and Sturmfels.
i4 : G = digraph {{1,{}},{2,{1}},{3,{1}},{4,{2,3}}}
o4 = Digraph{1 => set {} }
2 => set {1}
3 => set {1}
4 => set {2, 3}
o4 : Digraph
|
i5 : R = markovRing (2,2,2,2) o5 = R o5 : PolynomialRing |
i6 : S = globalMarkov G
o6 = {{{1}, {4}, {2, 3}}, {{2}, {3}, {4}}}
o6 : List
|
i7 : I = conditionalIndependenceIdeal (R,S); o7 : Ideal of R |
i8 : I / print; - p p + p p 1,1,1,2 2,1,1,1 1,1,1,1 2,1,1,2 - p p + p p 1,1,2,2 2,1,2,1 1,1,2,1 2,1,2,2 - p p + p p 1,2,1,2 2,2,1,1 1,2,1,1 2,2,1,2 - p p + p p 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 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 - p p + p p + p p - p p - p p - p p + p p + p p 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 |
i9 : F = marginMap(1,R); o9 : RingMap R <--- R |
i10 : transpose F.matrix
o10 = | p - p |
| 1,1,1,1 2,1,1,1 |
| |
| p - p |
| 1,1,1,2 2,1,1,2 |
| |
| p - p |
| 1,1,2,1 2,1,2,1 |
| |
| p - p |
| 1,1,2,2 2,1,2,2 |
| |
| p - p |
| 1,2,1,1 2,2,1,1 |
| |
| p - p |
| 1,2,1,2 2,2,1,2 |
| |
| p - p |
| 1,2,2,1 2,2,2,1 |
| |
| p - p |
| 1,2,2,2 2,2,2,2 |
| |
| p |
| 2,1,1,1 |
| |
| p |
| 2,1,1,2 |
| |
| p |
| 2,1,2,1 |
| |
| p |
| 2,1,2,2 |
| |
| p |
| 2,2,1,1 |
| |
| p |
| 2,2,1,2 |
| |
| p |
| 2,2,2,1 |
| |
| p |
| 2,2,2,2 |
16 1
o10 : Matrix R <--- R
|
i11 : J = F I; o11 : Ideal of R |
i12 : J / print; - p p + p p 1,1,1,2 2,1,1,1 1,1,1,1 2,1,1,2 - p p + p p 1,1,2,2 2,1,2,1 1,1,2,1 2,1,2,2 - p p + p p 1,2,1,2 2,2,1,1 1,2,1,1 2,2,1,2 - p p + p p 1,2,2,2 2,2,2,1 1,2,2,1 2,2,2,2 - p p + p p 1,1,2,1 1,2,1,1 1,1,1,1 1,2,2,1 - p p + p p 1,1,2,2 1,2,1,2 1,1,1,2 1,2,2,2 |