2016年5月23日 星期一

Canonical Weighted Sum (CWS) Gates for Simplifying Bayesian Network Inference

decampos-10-ijar-combining content-based and collaborative recommendations- a hybrid approach based on bayesian networks

The following will explain the examples in pp793-794 of the paper.

Assume that I and F nodes in the bayesian network are binary random variables.
If the set of parent nodes of node I6 is Pa(I6) = { F6, F7, F8},
then the 8 possible configurations of conditional joint probabilities are
     pa1(I6) = (f6,1 & f7,1 & f8,1)
     pa2(I6) = (f6,0 & f7,1 & f8,1)
     pa3(I6) = (f6,1 & f7,0 & f8,1)
     pa4(I6) = (f6,1 & f7,1 & f8,0)
     pa5(I6) = (f6,0 & f7,0 & f8,1)
     pa6(I6) = (f6,0 & f7,1 & f8,0)
     pa7(I6) = (f6,1 & f7,0 & f8,0)
     pa8(I6) = (f6,0 & f7,0 & f8,0)

By use of Canonical Weighted Sum (CWS) Gates, which consist of 2x2x3=12 weights,
computation of 16 conditional joint probabilities (having 8 degrees of freedom)
can be decomposed into the summation of 12 weights (having 3 degrees of freedom):
 w(f6,1&i6,1) = w(f6,0&i6,0) = 0.3
 w(f7,1&i6,1) = w(f7,0&i6,0) = 0.4
 w(f8,1&i6,1) = w(f8,0&i6,0) = 0.3
and
 w(f6,1&i6,0) = w(f6,0&i6,1) = 0
 w(f7,1&i6,0) = w(f7,0&i6,1) = 0
 w(f8,1&i6,0) = w(f8,0&i6,1) = 0

Pr(i6,0 | pa1(I6))= Pr(i6,0 | f6,1 & f7,1 & f8,1) = w(f6,1&i6,0) + w(f7,1&i6,0) + w(f8,1&i6,0) = 0
Pr(i6,1 | pa1(I6))= Pr(i6,1 | f6,1 & f7,1 & f8,1) = w(f6,1&i6,1) + w(f7,1&i6,1) + w(f8,1&i6,1) = 0.3 + 0.4 + 0.3 = 1

Pr(i6,0 | pa2(I6))= Pr(i6,0 | f6,0 & f7,1 & f8,1) = w(f6,0&i6,0) + w(f7,1&i6,0) + w(f8,1&i6,0) = 0.3
Pr(i6,1 | pa2(I6))= Pr(i6,1 | f6,0 & f7,1 & f8,1) = w(f6,0&i6,1) + w(f7,1&i6,1) + w(f8,1&i6,1) = 0 + 0.4 + 0.3 = 0.7

Pr(i6,0 | pa3(I6))= Pr(i6,0 | f6,1 & f7,0 & f8,1) = w(f6,1&i6,0) + w(f7,0&i6,0) + w(f8,1&i6,0) = 0.4
Pr(i6,1 | pa3(I6))= Pr(i6,1 | f6,1 & f7,0 & f8,1) = w(f6,1&i6,1) + w(f7,0&i6,1) + w(f8,1&i6,1) = 0.3 + 0 + 0.3 = 0.6

Pr(i6,0 | pa4(I6))= Pr(i6,0 | f6,1 & f7,1 & f8,0) = w(f6,1&i6,0) + w(f7,1&i6,0) + w(f8,0&i6,0) = 0.3
Pr(i6,1 | pa4(I6))= Pr(i6,1 | f6,1 & f7,1 & f8,0) = w(f6,1&i6,1) + w(f7,1&i6,1) + w(f8,0&i6,1) = 0.3 + 0.4 + 0 = 0.7

Pr(i6,0 | pa5(I6))= Pr(i6,0 | f6,0 & f7,0 & f8,1) = w(f6,0&i6,0) + w(f7,0&i6,0) + w(f8,1&i6,0) = 0.3 + 0.4 = 0.7
Pr(i6,1 | pa5(I6))= Pr(i6,1 | f6,0 & f7,0 & f8,1) = w(f6,0&i6,1) + w(f7,0&i6,1) + w(f8,1&i6,1) = 0 + 0 + 0.3 = 0.3

Pr(i6,0 | pa6(I6))= Pr(i6,0 | f6,0 & f7,1 & f8,0) = w(f6,0&i6,0) + w(f7,1&i6,0) + w(f8,0&i6,0) = 0.3 + 0 + 0.3 = 0.6
Pr(i6,1 | pa6(I6))= Pr(i6,1 | f6,0 & f7,1 & f8,0) = w(f6,0&i6,1) + w(f7,1&i6,1) + w(f8,0&i6,1) = 0 + 0.4 + 0 = 0.4

Pr(i6,0 | pa7(I6))= Pr(i6,0 | f6,1 & f7,0 & f8,0) = w(f6,1&i6,0) + w(f7,0&i6,0) + w(f8,0&i6,0) = 0 + 0.4 + 0.3 = 0.7
Pr(i6,1 | pa7(I6))= Pr(i6,1 | f6,1 & f7,0 & f8,0) = w(f6,1&i6,1) + w(f7,0&i6,1) + w(f8,0&i6,1) = 0.3 + 0 + 0 = 0.3

Pr(i6,0 | pa8(I6))= Pr(i6,0 | f6,0 & f7,0 & f8,0) = w(f6,0&i6,0) + w(f7,0&i6,0) + w(f8,0&i6,0) = 0.3 + 0.4 + 0.3 = 1
Pr(i6,1 | pa8(I6))= Pr(i6,1 | f6,0 & f7,0 & f8,0) = w(f6,0&i6,1) + w(f7,0&i6,1) + w(f8,0&i6,1) = 0

1 = Pr(i6,0 | pa(I6)) + Pr(i6,1 | pa(I6))
  = w(f6,1&i6,0) + w(f7,1&i6,0) + w(f8,1&i6,0) + w(f6,1&i6,1) + w(f7,1&i6,1) + w(f8,1&i6,1) = 1

============================

Given Pa(U4) = { I1, I3, I6, I7, I8, I10 } with six-value (0,1,~,5) random variable U,
the network consists of 2x6x6=72 weights.

By the following 12 nonzero weights having 6 degrees of freedom (with all other weights being 0):
       w(i1,1&u4,1) = w(i3,1&u4,1) = w(i6,1&u4,2) = w(i7,1&u4,1) = w(i8,1&u4,3) = w(i10,1&u4,5) = 0.166
and
       w(i1,0&u4,0) = w(i3,0&u4,0) = w(i6,0&u4,0) = w(i7,0&u4,0) = w(i8,0&u4,0) = w(i10,0&u4,0) = 0.166
we can compute any Pr(U4 | pa(U4)) conditional probabilities by summation of the 12 nonzero weights.

(1) pa(U4) = { i1,1 & i3,1 & i6,1 & i7,1 & i8,1 & i10,1 }

Pr(u4,0 | pa(U4)) = w(i1,1&u4,0) + w(i3,1&u4,0) + w(i6,1&u4,0) + w(i7,1&u4,0) + w(i8,1&u4,0) + w(i10,1&u4,0)
    = 0            + 0            + 0            + 0            + 0            + 0
    = 0

Pr(u4,1 | pa(U4)) = w(i1,1&u4,1) + w(i3,1&u4,1) + w(i6,1&u4,1) + w(i7,1&u4,1) + w(i8,1&u4,1) + w(i10,1&u4,1)
    = 0.166        + 0.166        + 0            + 0.166        + 0            + 0
    = 0.5

Pr(u4,2 | pa(U4)) = w(i1,1&u4,2) + w(i3,1&u4,2) + w(i6,1&u4,2) + w(i7,1&u4,2) + w(i8,1&u4,2) + w(i10,1&u4,2)
    = 0            + 0            + 0.166        + 0            + 0            + 0
    = 0.166

Pr(u4,3 | pa(U4)) = w(i1,1&u4,3) + w(i3,1&u4,3) + w(i6,1&u4,3) + w(i7,1&u4,3) + w(i8,1&u4,3) + w(i10,1&u4,3)
    = 0            + 0            + 0            + 0            + 0.166        + 0
    = 0.166

Pr(u4,4 | pa(U4)) = w(i1,1&u4,4) + w(i3,1&u4,4) + w(i6,1&u4,4) + w(i7,1&u4,4) + w(i8,1&u4,4) + w(i10,1&u4,4)
    = 0            + 0            + 0            + 0            + 0            + 0
    = 0

Pr(u4,5 | pa(U4)) = w(i1,1&u4,5) + w(i3,1&u4,5) + w(i6,1&u4,5) + w(i7,1&u4,5) + w(i8,1&u4,5) + w(i10,1&u4,5)
    = 0            + 0            + 0            + 0            + 0            + 0.166
    = 0.166

1 = Pr(u4,1 | pa(U4)) + Pr(u4,2 | pa(U4)) + Pr(u4,3 | pa(U4)) + Pr(u4,4 | pa(U4)) + Pr(u4,5 | pa(U4))
  = 0.5 + 0.166 + 0.166 + 0 + 0.166

(2) pa(U4) = { i1,0 & i3,0 & i6,1 & i7,1 & i8,0 & i10,0 }

Pr(u4,0 | pa(U4)) = w(i1,0&u4,0) + w(i3,0&u4,0) + w(i6,1&u4,0) + w(i7,1&u4,0) + w(i8,0&u4,0) + w(i10,0&u4,0)
    = 0.166        + 0.166        + 0            + 0            + 0.166        + 0.166
    = 0.666

Pr(u4,1 | pa(U4)) = w(i1,0&u4,1) + w(i3,0&u4,1) + w(i6,1&u4,1) + w(i7,1&u4,1) + w(i8,0&u4,1) + w(i10,0&u4,1)
    = 0            + 0            + 0            + 0.166        + 0            + 0
    = 0.166

Pr(u4,2 | pa(U4)) = w(i1,0&u4,2) + w(i3,0&u4,2) + w(i6,1&u4,2) + w(i7,1&u4,2) + w(i8,0&u4,2) + w(i10,0&u4,2)
    = 0            + 0            + 0.166        + 0            + 0            + 0
    = 0.166

Pr(u4,3 | pa(U4)) = w(i1,0&u4,3) + w(i3,0&u4,3) + w(i6,1&u4,3) + w(i7,1&u4,3) + w(i8,0&u4,3) + w(i10,0&u4,3)
    = 0            + 0            + 0            + 0            + 0            + 0
    = 0

Pr(u4,4 | pa(U4)) = w(i1,0&u4,4) + w(i3,0&u4,4) + w(i6,1&u4,4) + w(i7,1&u4,4) + w(i8,0&u4,4) + w(i10,0&u4,4)
    = 0            + 0            + 0            + 0            + 0            + 0
    = 0

Pr(u4,5 | pa(U4)) = w(i1,0&u4,5) + w(i3,0&u4,5) + w(i6,1&u4,5) + w(i7,1&u4,5) + w(i8,0&u4,5) + w(i10,0&u4,5)
    = 0            + 0            + 0            + 0            + 0            + 0
    = 0

1 = Pr(u4,1 | pa(U4)) + Pr(u4,2 | pa(U4)) + Pr(u4,3 | pa(U4)) + Pr(u4,4 | pa(U4)) + Pr(u4,5 | pa(U4))
  = 0.666 + 0.166 + 0.166 + 0 + 0

============================

Suppose that Acf = A4 or user 4.
Given Pa(Acf) = { Ux, Uy, Uz } with with six-value (0,1,~,5) random variable Acf,
the network consists of 6x6x3=108 weights.

By the following ? nonzero weights having ? degrees of freedom (with all other weights being 0):
       w(ux,5&acf,4) = 0.54
       w(uy,1&acf,4) = 0.15
       w(uz,4&acf,4) = 0.09
and
       w(ux,0&acf,0) = 0.6
       w(uy,0&acf,0) = 0.3
       w(uz,0&acf,0) = 0.1
we can compute any Pr(Acf | pa(Acf)) conditional probabilities by summation of the ? nonzero weights.


(1) pa(Acf) = { ux,5 & uy,1 & uz,4 }

Pr(acf,4 | pa(U4)) = w(ux,5&acf,4)               + w(uy,1&acf,4)               + w(uz,4&acf,4)
     = RSim(Ux,Acf) * Pr(A=4|Ux=5) + RSim(Uy,Acf) * Pr(A=4|Uy=1) + RSim(Uz,Acf) * Pr(A=4|Uz=4)
     = 0.6          * 0.9          + 0.3          * 0.5          + 0.1          * 0.9
                   = 0.78

(2) pa(Acf) = { ux,0 & uy,1 & uz,4 }

Pr(acf,4 | pa(U4)) = w(ux,0&acf,4)               + w(uy,1&acf,4)               + w(uz,4&acf,4)
     = 0                           + RSim(Uy,Acf) * Pr(A=4|Uy=1) + RSim(Uz,Acf) * Pr(A=4|Uz=4)
     = 0                           + 0.3          * 0.5          + 0.1          * 0.9
                   = 0.24

(3) pa(Acf) = { ux,0 & uy,1 & uz,4 }

Pr(acf,0 | pa(U4)) = w(ux,0&acf,0)               + w(uy,1&acf,0)               + w(uz,4&acf,0)
     = RSim(Ux,Acf)                + 0                           + 0
     = 0.6                         + 0                           + 0
     = 0.6

沒有留言: