annotate toolboxes/FullBNT-1.0.7/bnt/examples/static/Models/mk_ideker_bnet.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function bnet = mk_ideker_bnet(CPD_type, p)
wolffd@0 2 % MK_IDEKER_BNET Make the Bayes net in the PSB'00 paper by Ideker, Thorsson and Karp.
wolffd@0 3 %
wolffd@0 4 % BNET = MK_IDEKER_BNET uses the boolean functions specified in the paper
wolffd@0 5 % "Discovery of regulatory interactions through perturbation: inference and experimental design",
wolffd@0 6 % Pacific Symp. on Biocomputing, 2000.
wolffd@0 7 %
wolffd@0 8 % BNET = MK_IDEKER_BNET('root') uses the above boolean functions, but puts a uniform
wolffd@0 9 % distribution on the root nodes.
wolffd@0 10 %
wolffd@0 11 % BNET = MK_IDEKER_BNET('cpt', p) uses random parameters drawn from a Dirichlet(p,p,...)
wolffd@0 12 % distribution. If p << 1, this is nearly deterministic; if p >> 1, this is nearly uniform.
wolffd@0 13 %
wolffd@0 14 % BNET = MK_IDEKER_BNET('bool') makes each CPT a random boolean function.
wolffd@0 15 %
wolffd@0 16 % BNET = MK_IDEKER_BNET('orig') is the same as MK_IDEKER_BNET.
wolffd@0 17
wolffd@0 18
wolffd@0 19 if nargin == 0
wolffd@0 20 CPD_type = 'orig';
wolffd@0 21 end
wolffd@0 22
wolffd@0 23 n = 4;
wolffd@0 24 dag = zeros(n);
wolffd@0 25 dag(1,3)=1;
wolffd@0 26 dag(2,[3 4])=1;
wolffd@0 27 dag(3,4)=1;
wolffd@0 28 ns = 2*ones(1,n);
wolffd@0 29 bnet = mk_bnet(dag, ns);
wolffd@0 30
wolffd@0 31 switch CPD_type
wolffd@0 32 case 'orig',
wolffd@0 33 bnet.CPD{1} = tabular_CPD(bnet, 1, [0 1]);
wolffd@0 34 bnet.CPD{2} = tabular_CPD(bnet, 2, [0 1]);
wolffd@0 35 bnet.CPD{3} = boolean_CPD(bnet, 3, 'inline', inline('x(1) & x(2)'));
wolffd@0 36 bnet.CPD{4} = boolean_CPD(bnet, 4, 'inline', inline('x(1) & ~x(2)'));
wolffd@0 37 case 'root',
wolffd@0 38 bnet.CPD{1} = tabular_CPD(bnet, 1, [0.5 0.5]);
wolffd@0 39 bnet.CPD{2} = tabular_CPD(bnet, 2, [0.5 0.5]);
wolffd@0 40 bnet.CPD{3} = boolean_CPD(bnet, 3, 'inline', inline('x(1) & x(2)'));
wolffd@0 41 bnet.CPD{4} = boolean_CPD(bnet, 4, 'inline', inline('x(1) & ~x(2)'));
wolffd@0 42 case 'bool',
wolffd@0 43 for i=1:n
wolffd@0 44 bnet.CPD{i} = boolean_CPD(bnet, i, 'rnd');
wolffd@0 45 end
wolffd@0 46 case 'cpt',
wolffd@0 47 for i=1:n
wolffd@0 48 bnet.CPD{i} = tabular_CPD(bnet, i, p);
wolffd@0 49 end
wolffd@0 50 otherwise,
wolffd@0 51 error(['unknown type ' CPD_type]);
wolffd@0 52 end