about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/BNT/examples/static/Models/mk_incinerator_bnet.m
diff options
context:
space:
mode:
authorziejd22017-09-28 15:04:40 -0500
committerziejd22017-09-28 15:04:40 -0500
commit8070dc963753142bb86c4ed698d91fd623ed28e7 (patch)
treed0f6dd8fc46a49b819aa55c1a90faa14d8448883 /sourcecodes/bnt-master/BNT/examples/static/Models/mk_incinerator_bnet.m
parent7cc31810d53176e805532b2789955f4eedbce6bb (diff)
downloadBNW-8070dc963753142bb86c4ed698d91fd623ed28e7.tar.gz
BNW using Octave instead of Matlab.
This version of BNW should perform the same as the original version. The only difference is that it uses Octave instead of Matlab when running BayesNet Toolbox during parameter learning.

I am calling this BNW_1.02. It can be accessed at:
compbio.uthsc.edu/BNW_1.02
Diffstat (limited to 'sourcecodes/bnt-master/BNT/examples/static/Models/mk_incinerator_bnet.m')
-rw-r--r--sourcecodes/bnt-master/BNT/examples/static/Models/mk_incinerator_bnet.m61
1 files changed, 61 insertions, 0 deletions
diff --git a/sourcecodes/bnt-master/BNT/examples/static/Models/mk_incinerator_bnet.m b/sourcecodes/bnt-master/BNT/examples/static/Models/mk_incinerator_bnet.m
new file mode 100644
index 00000000..1583ad17
--- /dev/null
+++ b/sourcecodes/bnt-master/BNT/examples/static/Models/mk_incinerator_bnet.m
@@ -0,0 +1,61 @@
+function bnet  = mk_incinerator_bnet(ns)
+% MK_INCINERATOR_BNET The waste incinerator emissions example from Cowell et al p145
+% function bnet  = mk_incinerator_bnet(ns)
+% 
+% If ns is omitted, we use the scalars and binary nodes and the original params.
+% Otherwise, we use random params of the desired size.
+%
+% Lauritzen, "Propogation of Probabilities, Means and Variances in Mixed Graphical Association Models", 
+% JASA 87(420): 1098--1108
+% This example is reprinted on p145 of "Probabilistic Networks and Expert Systems",
+% Cowell, Dawid, Lauritzen and Spiegelhalter, 1999, Springer. 
+% For a picture, see http://www.cs.berkeley.edu/~murphyk/Bayes/usage.html#cg_model
+
+% node numbers
+F = 1; W = 2; E = 3; B = 4; C = 5; D = 6; Min = 7; Mout = 8; L = 9;
+names = {'F', 'W', 'E', 'B', 'C', 'D', 'Min', 'Mout', 'L'};
+n = 9;
+dnodes = [F W B];
+cnodes = mysetdiff(1:n, dnodes);
+
+% node sizes - all cts nodes are scalar, all discrete nodes are binary
+if nargin < 1
+  ns = ones(1, n);
+  ns(dnodes) = 2;
+  rnd = 0;
+else
+  rnd = 1;
+end
+  
+% topology (p 1099, fig 1)
+dag = zeros(n);
+dag(F,E)=1;
+dag(W,[E Min D]) = 1;
+dag(E,D)=1;
+dag(B,[C D])=1;
+dag(D,[L Mout])=1;
+dag(Min,Mout)=1;
+
+% params (p 1102)
+bnet = mk_bnet(dag, ns, 'discrete', dnodes, 'names', names);
+
+if rnd
+  for i=dnodes(:)'
+    bnet.CPD{i} = tabular_CPD(bnet, i);
+  end
+  for i=cnodes(:)'
+    bnet.CPD{i} = gaussian_CPD(bnet, i);
+  end
+else
+  bnet.CPD{B} = tabular_CPD(bnet, B, 'CPT', [0.85 0.15]); % 1=stable, 2=unstable
+  bnet.CPD{F} = tabular_CPD(bnet, F, 'CPT', [0.95 0.05]); % 1=intact, 2=defect
+  bnet.CPD{W} = tabular_CPD(bnet, W, 'CPT', [2/7 5/7]); % 1=industrial, 2=household
+  bnet.CPD{E} = gaussian_CPD(bnet, E, 'mean', [-3.9 -0.4 -3.2 -0.5], ...
+			     'cov', [0.00002 0.0001 0.00002 0.0001]);
+  bnet.CPD{D} = gaussian_CPD(bnet, D, 'mean', [6.5 6.0 7.5 7.0], ...
+			     'cov', [0.03 0.04 0.1 0.1], 'weights', [1 1 1 1]);
+  bnet.CPD{C} = gaussian_CPD(bnet, C, 'mean', [-2 -1], 'cov', [0.1 0.3]);
+  bnet.CPD{L} = gaussian_CPD(bnet, L, 'mean', 3, 'cov', 0.25, 'weights', -0.5);
+  bnet.CPD{Min} = gaussian_CPD(bnet, Min, 'mean', [0.5 -0.5], 'cov', [0.01 0.005]);
+  bnet.CPD{Mout} = gaussian_CPD(bnet, Mout, 'mean', 0, 'cov', 0.002, 'weights', [1 1]);
+end