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

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