remove dump files.

This commit is contained in:
Vítor Santos Costa 2011-02-25 12:04:46 +00:00
parent f92fa69eab
commit 11f4ac0e52
4 changed files with 0 additions and 32400 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,762 +0,0 @@
Variable: Burglar
Domain: b1, b2
Parents:
Childs: Alarm
cpt
----------------
b1 0.005
b2 0.995
Variable: FreightTruck
Domain: f1, f2
Parents:
Childs: Alarm
cpt
----------------
f1 0.03
f2 0.97
Variable: Alarm
Domain: a1, a2
Parents: Burglar, FreightTruck
Childs:
cpt b1,f1 b1,f2 b2,f1 b2,f2
----------------------------------------------------
a1 0.992 0.99 0.2 0.003
a2 0.008 0.01 0.8 0.997
Variable: Burglar
Domain: b1, b2
Parents:
Childs: Alarm
cpt
----------------
b1 0.005
b2 0.995
Variable: FreightTruck
Domain: f1, f2
Parents:
Childs: Alarm, _Jn
cpt
----------------
f1 0.03
f2 0.97
Variable: Alarm
Domain: a1, a2
Parents: Burglar, FreightTruck
Childs: _Jn
cpt b1,f1 b1,f2 b2,f1 b2,f2
----------------------------------------------------
a1 0.992 0.99 0.2 0.003
a2 0.008 0.01 0.8 0.997
Variable: _Jn
Domain: _jn0, _jn1, _jn2, _jn3
Parents: FreightTruck, Alarm
Childs:
cpt f1,a1 f1,a2 f2,a1 f2,a2
----------------------------------------------------
_jn0 1 0 0 0
_jn1 0 1 0 0
_jn2 0 0 1 0
_jn3 0 0 0 1
The graph is not single connected. Iterative belief propagation will be used.
Initializing solver
-> schedule = parallel
-> max iters = 100
-> stable threashold = 1e-20
-> query vars = FreightTruck Alarm
domain π(Burglar) λ(Burglar) belief
----------------------------------------------------------------
b1 1 1 0.5
b2 1 1 0.5
domain πAlarm(Burglar) λAlarm(Burglar)
----------------------------------------------------------------
b1 0.5 0.5
b2 0.5 0.5
domain π(FreightTruck) λ(FreightTruck) belief
----------------------------------------------------------------
f1 1 1 0.5
f2 1 1 0.5
domain πAlarm(FreightTruck) λAlarm(FreightTruck)
----------------------------------------------------------------
f1 0.5 0.5
f2 0.5 0.5
domain π_Jn(FreightTruck) λ_Jn(FreightTruck)
----------------------------------------------------------------
f1 0.5 0.5
f2 0.5 0.5
domain π(Alarm) λ(Alarm) belief
----------------------------------------------------------------
a1 1 1 0.5
a2 1 1 0.5
domain π_Jn(Alarm) λ_Jn(Alarm)
----------------------------------------------------------------
a1 0.5 0.5
a2 0.5 0.5
domain π(_Jn) λ(_Jn) belief
----------------------------------------------------------------
_jn0 1 1 0.25
_jn1 1 1 0.25
_jn2 1 1 0.25
_jn3 1 1 0.25
********************************************************************************
Iteration 1
********************************************************************************
λ message Alarm --> Burglar
λAlarm(b1)
= [p(a1|b1,f1).πAlarm(f1) + p(a1|b1,f2).πAlarm(f2)].λ(a1)
+ [p(a2|b1,f1).πAlarm(f1) + p(a2|b1,f2).πAlarm(f2)].λ(a2)
= [(0.992x0.5) + (0.99x0.5)]x1
+ [(0.008x0.5) + (0.01x0.5)]x1 = 1
λAlarm(b2)
= [p(a1|b2,f1).πAlarm(f1) + p(a1|b2,f2).πAlarm(f2)].λ(a1)
+ [p(a2|b2,f1).πAlarm(f1) + p(a2|b2,f2).πAlarm(f2)].λ(a2)
= [(0.2x0.5) + (0.003x0.5)]x1
+ [(0.8x0.5) + (0.997x0.5)]x1 = 1
λ message Alarm --> FreightTruck
λAlarm(f1)
= [p(a1|b1,f1).πAlarm(b1) + p(a1|b2,f1).πAlarm(b2)].λ(a1)
+ [p(a2|b1,f1).πAlarm(b1) + p(a2|b2,f1).πAlarm(b2)].λ(a2)
= [(0.992x0.5) + (0.2x0.5)]x1
+ [(0.008x0.5) + (0.8x0.5)]x1 = 1
λAlarm(f2)
= [p(a1|b1,f2).πAlarm(b1) + p(a1|b2,f2).πAlarm(b2)].λ(a1)
+ [p(a2|b1,f2).πAlarm(b1) + p(a2|b2,f2).πAlarm(b2)].λ(a2)
= [(0.99x0.5) + (0.003x0.5)]x1
+ [(0.01x0.5) + (0.997x0.5)]x1 = 1
λ message _Jn --> FreightTruck
λ_Jn(f1)
= [p(_jn0|f1,a1).π_Jn(a1) + p(_jn0|f1,a2).π_Jn(a2)].λ(_jn0)
+ [p(_jn1|f1,a1).π_Jn(a1) + p(_jn1|f1,a2).π_Jn(a2)].λ(_jn1)
+ [p(_jn2|f1,a1).π_Jn(a1) + p(_jn2|f1,a2).π_Jn(a2)].λ(_jn2)
+ [p(_jn3|f1,a1).π_Jn(a1) + p(_jn3|f1,a2).π_Jn(a2)].λ(_jn3)
= [(1x0.5) + (0x0.5)]x1
+ [(0x0.5) + (1x0.5)]x1
+ [(0x0.5) + (0x0.5)]x1
+ [(0x0.5) + (0x0.5)]x1 = 1
λ_Jn(f2)
= [p(_jn0|f2,a1).π_Jn(a1) + p(_jn0|f2,a2).π_Jn(a2)].λ(_jn0)
+ [p(_jn1|f2,a1).π_Jn(a1) + p(_jn1|f2,a2).π_Jn(a2)].λ(_jn1)
+ [p(_jn2|f2,a1).π_Jn(a1) + p(_jn2|f2,a2).π_Jn(a2)].λ(_jn2)
+ [p(_jn3|f2,a1).π_Jn(a1) + p(_jn3|f2,a2).π_Jn(a2)].λ(_jn3)
= [(0x0.5) + (0x0.5)]x1
+ [(0x0.5) + (0x0.5)]x1
+ [(1x0.5) + (0x0.5)]x1
+ [(0x0.5) + (1x0.5)]x1 = 1
λ message _Jn --> Alarm
λ_Jn(a1)
= [p(_jn0|f1,a1).π_Jn(f1) + p(_jn0|f2,a1).π_Jn(f2)].λ(_jn0)
+ [p(_jn1|f1,a1).π_Jn(f1) + p(_jn1|f2,a1).π_Jn(f2)].λ(_jn1)
+ [p(_jn2|f1,a1).π_Jn(f1) + p(_jn2|f2,a1).π_Jn(f2)].λ(_jn2)
+ [p(_jn3|f1,a1).π_Jn(f1) + p(_jn3|f2,a1).π_Jn(f2)].λ(_jn3)
= [(1x0.5) + (0x0.5)]x1
+ [(0x0.5) + (0x0.5)]x1
+ [(0x0.5) + (1x0.5)]x1
+ [(0x0.5) + (0x0.5)]x1 = 1
λ_Jn(a2)
= [p(_jn0|f1,a2).π_Jn(f1) + p(_jn0|f2,a2).π_Jn(f2)].λ(_jn0)
+ [p(_jn1|f1,a2).π_Jn(f1) + p(_jn1|f2,a2).π_Jn(f2)].λ(_jn1)
+ [p(_jn2|f1,a2).π_Jn(f1) + p(_jn2|f2,a2).π_Jn(f2)].λ(_jn2)
+ [p(_jn3|f1,a2).π_Jn(f1) + p(_jn3|f2,a2).π_Jn(f2)].λ(_jn3)
= [(0x0.5) + (0x0.5)]x1
+ [(1x0.5) + (0x0.5)]x1
+ [(0x0.5) + (0x0.5)]x1
+ [(0x0.5) + (1x0.5)]x1 = 1
π message Burglar --> Alarm
πAlarm(b1) = π(b1) = 0.005 = 0.005
πAlarm(b2) = π(b2) = 0.995 = 0.995
π message FreightTruck --> Alarm
πAlarm(f1) = π(f1).λ_Jn(f1) = 0.03 x 0.5 = 0.015
πAlarm(f2) = π(f2).λ_Jn(f2) = 0.97 x 0.5 = 0.485
π message FreightTruck --> _Jn
π_Jn(f1) = π(f1).λAlarm(f1) = 0.03 x 0.5 = 0.015
π_Jn(f2) = π(f2).λAlarm(f2) = 0.97 x 0.5 = 0.485
π message Alarm --> _Jn
π_Jn(a1) = π(a1) = 1 = 1
π_Jn(a2) = π(a2) = 1 = 1
var Burglar:
π(b1)
= p(b1)
= (0.005) = 0.005
π(b2)
= p(b2)
= (0.995) = 0.995
λ(b1) = λAlarm(b1) = 0.5 = 0.5
λ(b2) = λAlarm(b2) = 0.5 = 0.5
belief change = 1
var FreightTruck:
π(f1)
= p(f1)
= (0.03) = 0.03
π(f2)
= p(f2)
= (0.97) = 0.97
λ(f1) = λAlarm(f1).λ_Jn(f1) = 0.5 x 0.5 = 0.25
λ(f2) = λAlarm(f2).λ_Jn(f2) = 0.5 x 0.5 = 0.25
belief change = 1
var Alarm:
π(a1)
= p(a1|b1,f1).πAlarm(b1).πAlarm(f1)
+ p(a1|b1,f2).πAlarm(b1).πAlarm(f2)
+ p(a1|b2,f1).πAlarm(b2).πAlarm(f1)
+ p(a1|b2,f2).πAlarm(b2).πAlarm(f2)
= (0.992x0.005x0.03)
+ (0.99x0.005x0.97)
+ (0.2x0.995x0.03)
+ (0.003x0.995x0.97) = 0.01381575
π(a2)
= p(a2|b1,f1).πAlarm(b1).πAlarm(f1)
+ p(a2|b1,f2).πAlarm(b1).πAlarm(f2)
+ p(a2|b2,f1).πAlarm(b2).πAlarm(f1)
+ p(a2|b2,f2).πAlarm(b2).πAlarm(f2)
= (0.008x0.005x0.03)
+ (0.01x0.005x0.97)
+ (0.8x0.995x0.03)
+ (0.997x0.995x0.97) = 0.98618425
λ(a1) = λ_Jn(a1) = 0.5 = 0.5
λ(a2) = λ_Jn(a2) = 0.5 = 0.5
belief change = 1
var _Jn:
π(_jn0)
= p(_jn0|f1,a1).π_Jn(f1).π_Jn(a1)
+ p(_jn0|f1,a2).π_Jn(f1).π_Jn(a2)
+ p(_jn0|f2,a1).π_Jn(f2).π_Jn(a1)
+ p(_jn0|f2,a2).π_Jn(f2).π_Jn(a2)
= (1x0.03x0.5)
+ (0x0.03x0.5)
+ (0x0.97x0.5)
+ (0x0.97x0.5) = 0.015
π(_jn1)
= p(_jn1|f1,a1).π_Jn(f1).π_Jn(a1)
+ p(_jn1|f1,a2).π_Jn(f1).π_Jn(a2)
+ p(_jn1|f2,a1).π_Jn(f2).π_Jn(a1)
+ p(_jn1|f2,a2).π_Jn(f2).π_Jn(a2)
= (0x0.03x0.5)
+ (1x0.03x0.5)
+ (0x0.97x0.5)
+ (0x0.97x0.5) = 0.015
π(_jn2)
= p(_jn2|f1,a1).π_Jn(f1).π_Jn(a1)
+ p(_jn2|f1,a2).π_Jn(f1).π_Jn(a2)
+ p(_jn2|f2,a1).π_Jn(f2).π_Jn(a1)
+ p(_jn2|f2,a2).π_Jn(f2).π_Jn(a2)
= (0x0.03x0.5)
+ (0x0.03x0.5)
+ (1x0.97x0.5)
+ (0x0.97x0.5) = 0.485
π(_jn3)
= p(_jn3|f1,a1).π_Jn(f1).π_Jn(a1)
+ p(_jn3|f1,a2).π_Jn(f1).π_Jn(a2)
+ p(_jn3|f2,a1).π_Jn(f2).π_Jn(a1)
+ p(_jn3|f2,a2).π_Jn(f2).π_Jn(a2)
= (0x0.03x0.5)
+ (0x0.03x0.5)
+ (0x0.97x0.5)
+ (1x0.97x0.5) = 0.485
λ(_jn0) = 1
λ(_jn1) = 1
λ(_jn2) = 1
λ(_jn3) = 1
belief change = 1
domain π(Burglar) λ(Burglar) belief
----------------------------------------------------------------
b1 0.005 0.5 0.005
b2 0.995 0.5 0.995
domain πAlarm(Burglar) λAlarm(Burglar)
----------------------------------------------------------------
b1 0.005 0.5
b2 0.995 0.5
domain π(FreightTruck) λ(FreightTruck) belief
----------------------------------------------------------------
f1 0.03 0.25 0.03
f2 0.97 0.25 0.97
domain πAlarm(FreightTruck) λAlarm(FreightTruck)
----------------------------------------------------------------
f1 0.03 0.5
f2 0.97 0.5
domain π_Jn(FreightTruck) λ_Jn(FreightTruck)
----------------------------------------------------------------
f1 0.03 0.5
f2 0.97 0.5
domain π(Alarm) λ(Alarm) belief
----------------------------------------------------------------
a1 0.01381575 0.5 0.01381575
a2 0.98618425 0.5 0.98618425
domain π_Jn(Alarm) λ_Jn(Alarm)
----------------------------------------------------------------
a1 0.5 0.5
a2 0.5 0.5
domain π(_Jn) λ(_Jn) belief
----------------------------------------------------------------
_jn0 0.015 1 0.015
_jn1 0.015 1 0.015
_jn2 0.485 1 0.485
_jn3 0.485 1 0.485
********************************************************************************
Iteration 2
********************************************************************************
λ message Alarm --> Burglar
λAlarm(b1)
= [p(a1|b1,f1).πAlarm(f1) + p(a1|b1,f2).πAlarm(f2)].λ(a1)
+ [p(a2|b1,f1).πAlarm(f1) + p(a2|b1,f2).πAlarm(f2)].λ(a2)
= [(0.992x0.03) + (0.99x0.97)]x0.5
+ [(0.008x0.03) + (0.01x0.97)]x0.5 = 0.5
λAlarm(b2)
= [p(a1|b2,f1).πAlarm(f1) + p(a1|b2,f2).πAlarm(f2)].λ(a1)
+ [p(a2|b2,f1).πAlarm(f1) + p(a2|b2,f2).πAlarm(f2)].λ(a2)
= [(0.2x0.03) + (0.003x0.97)]x0.5
+ [(0.8x0.03) + (0.997x0.97)]x0.5 = 0.5
λ message Alarm --> FreightTruck
λAlarm(f1)
= [p(a1|b1,f1).πAlarm(b1) + p(a1|b2,f1).πAlarm(b2)].λ(a1)
+ [p(a2|b1,f1).πAlarm(b1) + p(a2|b2,f1).πAlarm(b2)].λ(a2)
= [(0.992x0.005) + (0.2x0.995)]x0.5
+ [(0.008x0.005) + (0.8x0.995)]x0.5 = 0.5
λAlarm(f2)
= [p(a1|b1,f2).πAlarm(b1) + p(a1|b2,f2).πAlarm(b2)].λ(a1)
+ [p(a2|b1,f2).πAlarm(b1) + p(a2|b2,f2).πAlarm(b2)].λ(a2)
= [(0.99x0.005) + (0.003x0.995)]x0.5
+ [(0.01x0.005) + (0.997x0.995)]x0.5 = 0.5
λ message _Jn --> FreightTruck
λ_Jn(f1)
= [p(_jn0|f1,a1).π_Jn(a1) + p(_jn0|f1,a2).π_Jn(a2)].λ(_jn0)
+ [p(_jn1|f1,a1).π_Jn(a1) + p(_jn1|f1,a2).π_Jn(a2)].λ(_jn1)
+ [p(_jn2|f1,a1).π_Jn(a1) + p(_jn2|f1,a2).π_Jn(a2)].λ(_jn2)
+ [p(_jn3|f1,a1).π_Jn(a1) + p(_jn3|f1,a2).π_Jn(a2)].λ(_jn3)
= [(1x0.5) + (0x0.5)]x1
+ [(0x0.5) + (1x0.5)]x1
+ [(0x0.5) + (0x0.5)]x1
+ [(0x0.5) + (0x0.5)]x1 = 1
λ_Jn(f2)
= [p(_jn0|f2,a1).π_Jn(a1) + p(_jn0|f2,a2).π_Jn(a2)].λ(_jn0)
+ [p(_jn1|f2,a1).π_Jn(a1) + p(_jn1|f2,a2).π_Jn(a2)].λ(_jn1)
+ [p(_jn2|f2,a1).π_Jn(a1) + p(_jn2|f2,a2).π_Jn(a2)].λ(_jn2)
+ [p(_jn3|f2,a1).π_Jn(a1) + p(_jn3|f2,a2).π_Jn(a2)].λ(_jn3)
= [(0x0.5) + (0x0.5)]x1
+ [(0x0.5) + (0x0.5)]x1
+ [(1x0.5) + (0x0.5)]x1
+ [(0x0.5) + (1x0.5)]x1 = 1
λ message _Jn --> Alarm
λ_Jn(a1)
= [p(_jn0|f1,a1).π_Jn(f1) + p(_jn0|f2,a1).π_Jn(f2)].λ(_jn0)
+ [p(_jn1|f1,a1).π_Jn(f1) + p(_jn1|f2,a1).π_Jn(f2)].λ(_jn1)
+ [p(_jn2|f1,a1).π_Jn(f1) + p(_jn2|f2,a1).π_Jn(f2)].λ(_jn2)
+ [p(_jn3|f1,a1).π_Jn(f1) + p(_jn3|f2,a1).π_Jn(f2)].λ(_jn3)
= [(1x0.03) + (0x0.97)]x1
+ [(0x0.03) + (0x0.97)]x1
+ [(0x0.03) + (1x0.97)]x1
+ [(0x0.03) + (0x0.97)]x1 = 1
λ_Jn(a2)
= [p(_jn0|f1,a2).π_Jn(f1) + p(_jn0|f2,a2).π_Jn(f2)].λ(_jn0)
+ [p(_jn1|f1,a2).π_Jn(f1) + p(_jn1|f2,a2).π_Jn(f2)].λ(_jn1)
+ [p(_jn2|f1,a2).π_Jn(f1) + p(_jn2|f2,a2).π_Jn(f2)].λ(_jn2)
+ [p(_jn3|f1,a2).π_Jn(f1) + p(_jn3|f2,a2).π_Jn(f2)].λ(_jn3)
= [(0x0.03) + (0x0.97)]x1
+ [(1x0.03) + (0x0.97)]x1
+ [(0x0.03) + (0x0.97)]x1
+ [(0x0.03) + (1x0.97)]x1 = 1
π message Burglar --> Alarm
πAlarm(b1) = π(b1) = 0.005 = 0.005
πAlarm(b2) = π(b2) = 0.995 = 0.995
π message FreightTruck --> Alarm
πAlarm(f1) = π(f1).λ_Jn(f1) = 0.03 x 0.5 = 0.015
πAlarm(f2) = π(f2).λ_Jn(f2) = 0.97 x 0.5 = 0.485
π message FreightTruck --> _Jn
π_Jn(f1) = π(f1).λAlarm(f1) = 0.03 x 0.5 = 0.015
π_Jn(f2) = π(f2).λAlarm(f2) = 0.97 x 0.5 = 0.485
π message Alarm --> _Jn
π_Jn(a1) = π(a1) = 0.0138158 = 0.01381575
π_Jn(a2) = π(a2) = 0.986184 = 0.98618425
var Burglar:
π(b1)
= p(b1)
= (0.005) = 0.005
π(b2)
= p(b2)
= (0.995) = 0.995
λ(b1) = λAlarm(b1) = 0.5 = 0.5
λ(b2) = λAlarm(b2) = 0.5 = 0.5
belief change = 8.67361738e-19
var FreightTruck:
π(f1)
= p(f1)
= (0.03) = 0.03
π(f2)
= p(f2)
= (0.97) = 0.97
λ(f1) = λAlarm(f1).λ_Jn(f1) = 0.5 x 0.5 = 0.25
λ(f2) = λAlarm(f2).λ_Jn(f2) = 0.5 x 0.5 = 0.25
belief change = 0
var Alarm:
π(a1)
= p(a1|b1,f1).πAlarm(b1).πAlarm(f1)
+ p(a1|b1,f2).πAlarm(b1).πAlarm(f2)
+ p(a1|b2,f1).πAlarm(b2).πAlarm(f1)
+ p(a1|b2,f2).πAlarm(b2).πAlarm(f2)
= (0.992x0.005x0.03)
+ (0.99x0.005x0.97)
+ (0.2x0.995x0.03)
+ (0.003x0.995x0.97) = 0.01381575
π(a2)
= p(a2|b1,f1).πAlarm(b1).πAlarm(f1)
+ p(a2|b1,f2).πAlarm(b1).πAlarm(f2)
+ p(a2|b2,f1).πAlarm(b2).πAlarm(f1)
+ p(a2|b2,f2).πAlarm(b2).πAlarm(f2)
= (0.008x0.005x0.03)
+ (0.01x0.005x0.97)
+ (0.8x0.995x0.03)
+ (0.997x0.995x0.97) = 0.98618425
λ(a1) = λ_Jn(a1) = 0.5 = 0.5
λ(a2) = λ_Jn(a2) = 0.5 = 0.5
belief change = 0
var _Jn:
π(_jn0)
= p(_jn0|f1,a1).π_Jn(f1).π_Jn(a1)
+ p(_jn0|f1,a2).π_Jn(f1).π_Jn(a2)
+ p(_jn0|f2,a1).π_Jn(f2).π_Jn(a1)
+ p(_jn0|f2,a2).π_Jn(f2).π_Jn(a2)
= (1x0.03x0.0138158)
+ (0x0.03x0.986184)
+ (0x0.97x0.0138158)
+ (0x0.97x0.986184) = 0.0004144725
π(_jn1)
= p(_jn1|f1,a1).π_Jn(f1).π_Jn(a1)
+ p(_jn1|f1,a2).π_Jn(f1).π_Jn(a2)
+ p(_jn1|f2,a1).π_Jn(f2).π_Jn(a1)
+ p(_jn1|f2,a2).π_Jn(f2).π_Jn(a2)
= (0x0.03x0.0138158)
+ (1x0.03x0.986184)
+ (0x0.97x0.0138158)
+ (0x0.97x0.986184) = 0.0295855275
π(_jn2)
= p(_jn2|f1,a1).π_Jn(f1).π_Jn(a1)
+ p(_jn2|f1,a2).π_Jn(f1).π_Jn(a2)
+ p(_jn2|f2,a1).π_Jn(f2).π_Jn(a1)
+ p(_jn2|f2,a2).π_Jn(f2).π_Jn(a2)
= (0x0.03x0.0138158)
+ (0x0.03x0.986184)
+ (1x0.97x0.0138158)
+ (0x0.97x0.986184) = 0.0134012775
π(_jn3)
= p(_jn3|f1,a1).π_Jn(f1).π_Jn(a1)
+ p(_jn3|f1,a2).π_Jn(f1).π_Jn(a2)
+ p(_jn3|f2,a1).π_Jn(f2).π_Jn(a1)
+ p(_jn3|f2,a2).π_Jn(f2).π_Jn(a2)
= (0x0.03x0.0138158)
+ (0x0.03x0.986184)
+ (0x0.97x0.0138158)
+ (1x0.97x0.986184) = 0.9565987225
λ(_jn0) = 1
λ(_jn1) = 1
λ(_jn2) = 1
λ(_jn3) = 1
belief change = 0.9723685
domain π(Burglar) λ(Burglar) belief
----------------------------------------------------------------
b1 0.005 0.5 0.005
b2 0.995 0.5 0.995
domain πAlarm(Burglar) λAlarm(Burglar)
----------------------------------------------------------------
b1 0.005 0.5
b2 0.995 0.5
domain π(FreightTruck) λ(FreightTruck) belief
----------------------------------------------------------------
f1 0.03 0.25 0.03
f2 0.97 0.25 0.97
domain πAlarm(FreightTruck) λAlarm(FreightTruck)
----------------------------------------------------------------
f1 0.03 0.5
f2 0.97 0.5
domain π_Jn(FreightTruck) λ_Jn(FreightTruck)
----------------------------------------------------------------
f1 0.03 0.5
f2 0.97 0.5
domain π(Alarm) λ(Alarm) belief
----------------------------------------------------------------
a1 0.01381575 0.5 0.01381575
a2 0.98618425 0.5 0.98618425
domain π_Jn(Alarm) λ_Jn(Alarm)
----------------------------------------------------------------
a1 0.01381575 0.5
a2 0.98618425 0.5
domain π(_Jn) λ(_Jn) belief
----------------------------------------------------------------
_jn0 0.0004144725 1 0.0004144725
_jn1 0.0295855275 1 0.0295855275
_jn2 0.0134012775 1 0.0134012775
_jn3 0.9565987225 1 0.9565987225
********************************************************************************
Iteration 3
********************************************************************************
λ message Alarm --> Burglar
λAlarm(b1)
= [p(a1|b1,f1).πAlarm(f1) + p(a1|b1,f2).πAlarm(f2)].λ(a1)
+ [p(a2|b1,f1).πAlarm(f1) + p(a2|b1,f2).πAlarm(f2)].λ(a2)
= [(0.992x0.03) + (0.99x0.97)]x0.5
+ [(0.008x0.03) + (0.01x0.97)]x0.5 = 0.5
λAlarm(b2)
= [p(a1|b2,f1).πAlarm(f1) + p(a1|b2,f2).πAlarm(f2)].λ(a1)
+ [p(a2|b2,f1).πAlarm(f1) + p(a2|b2,f2).πAlarm(f2)].λ(a2)
= [(0.2x0.03) + (0.003x0.97)]x0.5
+ [(0.8x0.03) + (0.997x0.97)]x0.5 = 0.5
λ message Alarm --> FreightTruck
λAlarm(f1)
= [p(a1|b1,f1).πAlarm(b1) + p(a1|b2,f1).πAlarm(b2)].λ(a1)
+ [p(a2|b1,f1).πAlarm(b1) + p(a2|b2,f1).πAlarm(b2)].λ(a2)
= [(0.992x0.005) + (0.2x0.995)]x0.5
+ [(0.008x0.005) + (0.8x0.995)]x0.5 = 0.5
λAlarm(f2)
= [p(a1|b1,f2).πAlarm(b1) + p(a1|b2,f2).πAlarm(b2)].λ(a1)
+ [p(a2|b1,f2).πAlarm(b1) + p(a2|b2,f2).πAlarm(b2)].λ(a2)
= [(0.99x0.005) + (0.003x0.995)]x0.5
+ [(0.01x0.005) + (0.997x0.995)]x0.5 = 0.5
λ message _Jn --> FreightTruck
λ_Jn(f1)
= [p(_jn0|f1,a1).π_Jn(a1) + p(_jn0|f1,a2).π_Jn(a2)].λ(_jn0)
+ [p(_jn1|f1,a1).π_Jn(a1) + p(_jn1|f1,a2).π_Jn(a2)].λ(_jn1)
+ [p(_jn2|f1,a1).π_Jn(a1) + p(_jn2|f1,a2).π_Jn(a2)].λ(_jn2)
+ [p(_jn3|f1,a1).π_Jn(a1) + p(_jn3|f1,a2).π_Jn(a2)].λ(_jn3)
= [(1x0.0138158) + (0x0.986184)]x1
+ [(0x0.0138158) + (1x0.986184)]x1
+ [(0x0.0138158) + (0x0.986184)]x1
+ [(0x0.0138158) + (0x0.986184)]x1 = 1
λ_Jn(f2)
= [p(_jn0|f2,a1).π_Jn(a1) + p(_jn0|f2,a2).π_Jn(a2)].λ(_jn0)
+ [p(_jn1|f2,a1).π_Jn(a1) + p(_jn1|f2,a2).π_Jn(a2)].λ(_jn1)
+ [p(_jn2|f2,a1).π_Jn(a1) + p(_jn2|f2,a2).π_Jn(a2)].λ(_jn2)
+ [p(_jn3|f2,a1).π_Jn(a1) + p(_jn3|f2,a2).π_Jn(a2)].λ(_jn3)
= [(0x0.0138158) + (0x0.986184)]x1
+ [(0x0.0138158) + (0x0.986184)]x1
+ [(1x0.0138158) + (0x0.986184)]x1
+ [(0x0.0138158) + (1x0.986184)]x1 = 1
λ message _Jn --> Alarm
λ_Jn(a1)
= [p(_jn0|f1,a1).π_Jn(f1) + p(_jn0|f2,a1).π_Jn(f2)].λ(_jn0)
+ [p(_jn1|f1,a1).π_Jn(f1) + p(_jn1|f2,a1).π_Jn(f2)].λ(_jn1)
+ [p(_jn2|f1,a1).π_Jn(f1) + p(_jn2|f2,a1).π_Jn(f2)].λ(_jn2)
+ [p(_jn3|f1,a1).π_Jn(f1) + p(_jn3|f2,a1).π_Jn(f2)].λ(_jn3)
= [(1x0.03) + (0x0.97)]x1
+ [(0x0.03) + (0x0.97)]x1
+ [(0x0.03) + (1x0.97)]x1
+ [(0x0.03) + (0x0.97)]x1 = 1
λ_Jn(a2)
= [p(_jn0|f1,a2).π_Jn(f1) + p(_jn0|f2,a2).π_Jn(f2)].λ(_jn0)
+ [p(_jn1|f1,a2).π_Jn(f1) + p(_jn1|f2,a2).π_Jn(f2)].λ(_jn1)
+ [p(_jn2|f1,a2).π_Jn(f1) + p(_jn2|f2,a2).π_Jn(f2)].λ(_jn2)
+ [p(_jn3|f1,a2).π_Jn(f1) + p(_jn3|f2,a2).π_Jn(f2)].λ(_jn3)
= [(0x0.03) + (0x0.97)]x1
+ [(1x0.03) + (0x0.97)]x1
+ [(0x0.03) + (0x0.97)]x1
+ [(0x0.03) + (1x0.97)]x1 = 1
π message Burglar --> Alarm
πAlarm(b1) = π(b1) = 0.005 = 0.005
πAlarm(b2) = π(b2) = 0.995 = 0.995
π message FreightTruck --> Alarm
πAlarm(f1) = π(f1).λ_Jn(f1) = 0.03 x 0.5 = 0.015
πAlarm(f2) = π(f2).λ_Jn(f2) = 0.97 x 0.5 = 0.485
π message FreightTruck --> _Jn
π_Jn(f1) = π(f1).λAlarm(f1) = 0.03 x 0.5 = 0.015
π_Jn(f2) = π(f2).λAlarm(f2) = 0.97 x 0.5 = 0.485
π message Alarm --> _Jn
π_Jn(a1) = π(a1) = 0.0138158 = 0.01381575
π_Jn(a2) = π(a2) = 0.986184 = 0.98618425
var Burglar:
π(b1)
= p(b1)
= (0.005) = 0.005
π(b2)
= p(b2)
= (0.995) = 0.995
λ(b1) = λAlarm(b1) = 0.5 = 0.5
λ(b2) = λAlarm(b2) = 0.5 = 0.5
belief change = 0
var FreightTruck:
π(f1)
= p(f1)
= (0.03) = 0.03
π(f2)
= p(f2)
= (0.97) = 0.97
λ(f1) = λAlarm(f1).λ_Jn(f1) = 0.5 x 0.5 = 0.25
λ(f2) = λAlarm(f2).λ_Jn(f2) = 0.5 x 0.5 = 0.25
belief change = 0
var Alarm:
π(a1)
= p(a1|b1,f1).πAlarm(b1).πAlarm(f1)
+ p(a1|b1,f2).πAlarm(b1).πAlarm(f2)
+ p(a1|b2,f1).πAlarm(b2).πAlarm(f1)
+ p(a1|b2,f2).πAlarm(b2).πAlarm(f2)
= (0.992x0.005x0.03)
+ (0.99x0.005x0.97)
+ (0.2x0.995x0.03)
+ (0.003x0.995x0.97) = 0.01381575
π(a2)
= p(a2|b1,f1).πAlarm(b1).πAlarm(f1)
+ p(a2|b1,f2).πAlarm(b1).πAlarm(f2)
+ p(a2|b2,f1).πAlarm(b2).πAlarm(f1)
+ p(a2|b2,f2).πAlarm(b2).πAlarm(f2)
= (0.008x0.005x0.03)
+ (0.01x0.005x0.97)
+ (0.8x0.995x0.03)
+ (0.997x0.995x0.97) = 0.98618425
λ(a1) = λ_Jn(a1) = 0.5 = 0.5
λ(a2) = λ_Jn(a2) = 0.5 = 0.5
belief change = 0
var _Jn:
π(_jn0)
= p(_jn0|f1,a1).π_Jn(f1).π_Jn(a1)
+ p(_jn0|f1,a2).π_Jn(f1).π_Jn(a2)
+ p(_jn0|f2,a1).π_Jn(f2).π_Jn(a1)
+ p(_jn0|f2,a2).π_Jn(f2).π_Jn(a2)
= (1x0.03x0.0138158)
+ (0x0.03x0.986184)
+ (0x0.97x0.0138158)
+ (0x0.97x0.986184) = 0.0004144725
π(_jn1)
= p(_jn1|f1,a1).π_Jn(f1).π_Jn(a1)
+ p(_jn1|f1,a2).π_Jn(f1).π_Jn(a2)
+ p(_jn1|f2,a1).π_Jn(f2).π_Jn(a1)
+ p(_jn1|f2,a2).π_Jn(f2).π_Jn(a2)
= (0x0.03x0.0138158)
+ (1x0.03x0.986184)
+ (0x0.97x0.0138158)
+ (0x0.97x0.986184) = 0.0295855275
π(_jn2)
= p(_jn2|f1,a1).π_Jn(f1).π_Jn(a1)
+ p(_jn2|f1,a2).π_Jn(f1).π_Jn(a2)
+ p(_jn2|f2,a1).π_Jn(f2).π_Jn(a1)
+ p(_jn2|f2,a2).π_Jn(f2).π_Jn(a2)
= (0x0.03x0.0138158)
+ (0x0.03x0.986184)
+ (1x0.97x0.0138158)
+ (0x0.97x0.986184) = 0.0134012775
π(_jn3)
= p(_jn3|f1,a1).π_Jn(f1).π_Jn(a1)
+ p(_jn3|f1,a2).π_Jn(f1).π_Jn(a2)
+ p(_jn3|f2,a1).π_Jn(f2).π_Jn(a1)
+ p(_jn3|f2,a2).π_Jn(f2).π_Jn(a2)
= (0x0.03x0.0138158)
+ (0x0.03x0.986184)
+ (0x0.97x0.0138158)
+ (1x0.97x0.986184) = 0.9565987225
λ(_jn0) = 1
λ(_jn1) = 1
λ(_jn2) = 1
λ(_jn3) = 1
belief change = 0
domain π(Burglar) λ(Burglar) belief
----------------------------------------------------------------
b1 0.005 0.5 0.005
b2 0.995 0.5 0.995
domain πAlarm(Burglar) λAlarm(Burglar)
----------------------------------------------------------------
b1 0.005 0.5
b2 0.995 0.5
domain π(FreightTruck) λ(FreightTruck) belief
----------------------------------------------------------------
f1 0.03 0.25 0.03
f2 0.97 0.25 0.97
domain πAlarm(FreightTruck) λAlarm(FreightTruck)
----------------------------------------------------------------
f1 0.03 0.5
f2 0.97 0.5
domain π_Jn(FreightTruck) λ_Jn(FreightTruck)
----------------------------------------------------------------
f1 0.03 0.5
f2 0.97 0.5
domain π(Alarm) λ(Alarm) belief
----------------------------------------------------------------
a1 0.01381575 0.5 0.01381575
a2 0.98618425 0.5 0.98618425
domain π_Jn(Alarm) λ_Jn(Alarm)
----------------------------------------------------------------
a1 0.01381575 0.5
a2 0.98618425 0.5
domain π(_Jn) λ(_Jn) belief
----------------------------------------------------------------
_jn0 0.0004144725 1 0.0004144725
_jn1 0.0295855275 1 0.0295855275
_jn2 0.0134012775 1 0.0134012775
_jn3 0.9565987225 1 0.9565987225
Iterative belief propagation converged in 3 iterations

File diff suppressed because it is too large Load Diff

View File

@ -1,85 +0,0 @@
Variable: A
Domain: a1, a2
Parents:
Childs: B, C
cpt
----------------
a1 0.01
a2 0.09
Variable: B
Domain: b1, b2
Parents: A
Childs: D
cpt a1, a2,
----------------------------
b1 0.03 0.6
b2 0.97 0.4
Variable: C
Domain: c1, c2
Parents: A
Childs: D
cpt a1, a2,
----------------------------
c1 0.24 0.12
c2 0.76 0.88
Variable: D
Domain: d1, d2
Parents: B, C
Childs:
cpt b1,c1, b1,c2, b2,c1, b2,c2,
----------------------------------------------------
d1 0.2 0.7 0.45 0.22
d2 0.8 0.3 0.55 0.78
initializing solver
schedule = sequential
maxIter = 100
accuracy = 0
sending pi message from `A' to `B'
πB(a1) = π(a1).λC(a1) = 0.01 x 1 = 0.01
πB(a2) = π(a2).λC(a2) = 0.09 x 1 = 0.09
π(b1) = p(b1|a1).πB(a1) + p(b1|a2).πB(a2) = (0.03 x 0.01) + (0.6 x 0.09) = 0.0543
π(b2) = p(b2|a1).πB(a1) + p(b2|a2).πB(a2) = (0.97 x 0.01) + (0.4 x 0.09) = 0.0457
sending pi message from `B' to `D'
πD(b1) = π(b1) = 0.0543 = 0.0543
πD(b2) = π(b2) = 0.0457 = 0.0457
π(d1) = p(d1|b1,c1).πD(b1).πD(c1) + p(d1|b1,c2).πD(b1).πD(c2) + p(d1|b2,c1).πD(b2).πD(c1) + p(d1|b2,c2).πD(b2).πD(c2) = (0.2 x 0.0543 x 1) + (0.7 x 0.0543 x 1) + (0.45 x 0.0457 x 1) + (0.22 x 0.0457 x 1) = 0.079489
π(d2) = p(d2|b1,c1).πD(b1).πD(c1) + p(d2|b1,c2).πD(b1).πD(c2) + p(d2|b2,c1).πD(b2).πD(c1) + p(d2|b2,c2).πD(b2).πD(c2) = (0.8 x 0.0543 x 1) + (0.3 x 0.0543 x 1) + (0.55 x 0.0457 x 1) + (0.78 x 0.0457 x 1) = 0.120511
sending pi message from `A' to `C'
πC(a1) = π(a1).λB(a1) = 0.01 x 1 = 0.01
πC(a2) = π(a2).λB(a2) = 0.09 x 1 = 0.09
π(c1) = p(c1|a1).πC(a1) + p(c1|a2).πC(a2) = (0.24 x 0.01) + (0.12 x 0.09) = 0.0132
π(c2) = p(c2|a1).πC(a1) + p(c2|a2).πC(a2) = (0.76 x 0.01) + (0.88 x 0.09) = 0.0868
sending pi message from `C' to `D'
πD(c1) = π(c1) = 0.0132 = 0.0132
πD(c2) = π(c2) = 0.0868 = 0.0868
π(d1) = p(d1|b1,c1).πD(b1).πD(c1) + p(d1|b1,c2).πD(b1).πD(c2) + p(d1|b2,c1).πD(b2).πD(c1) + p(d1|b2,c2).πD(b2).πD(c2) = (0.2 x 0.0543 x 0.0132) + (0.7 x 0.0543 x 0.0868) + (0.45 x 0.0457 x 0.0132) + (0.22 x 0.0457 x 0.0868) = 0.00458677
π(d2) = p(d2|b1,c1).πD(b1).πD(c1) + p(d2|b1,c2).πD(b1).πD(c2) + p(d2|b2,c1).πD(b2).πD(c1) + p(d2|b2,c2).πD(b2).πD(c2) = (0.8 x 0.0543 x 0.0132) + (0.3 x 0.0543 x 0.0868) + (0.55 x 0.0457 x 0.0132) + (0.78 x 0.0457 x 0.0868) = 0.00541323
beliefs for variable `A':
domain belief
----------------------------------
a1 0.1
a2 0.9
beliefs for variable `B':
domain belief
----------------------------------
b1 0.543
b2 0.457
beliefs for variable `C':
domain belief
----------------------------------
c1 0.132
c2 0.868
beliefs for variable `D':
domain belief
----------------------------------
d1 0.45867652
d2 0.54132348