Daniel@0: % Make a DBN with the following inter-connectivity matrix Daniel@0: % 1 Daniel@0: % / \ Daniel@0: % 2 3 Daniel@0: % \ / Daniel@0: % 4 Daniel@0: % | Daniel@0: % 5 Daniel@0: % where all arcs point down. In addition, there are persistence arcs from each node to itself. Daniel@0: % There are no intra-slice connections. Daniel@0: % Nodes have noisy-or CPDs. Daniel@0: % Node 1 turns on spontaneously due to its leaky source. Daniel@0: % This effect trickles down to the other nodes in the order shown. Daniel@0: % All the other nodes inhibit their leaks. Daniel@0: % None of the nodes inhibit the connection from themselves, so that once they are on, they remain Daniel@0: % on (persistence). Daniel@0: % Daniel@0: % This model was used in the experiments reported in Daniel@0: % - "Learning the structure of DBNs", Friedman, Murphy and Russell, UAI 1998. Daniel@0: % where the structure was learned even in the presence of missing data. Daniel@0: % In that paper, we used the structural EM algorithm. Daniel@0: % Here, we assume full observability and tabular CPDs for the learner, so we can use a much Daniel@0: % simpler learning algorithm. Daniel@0: Daniel@0: ss = 5; Daniel@0: Daniel@0: inter = eye(ss); Daniel@0: inter(1,[2 3]) = 1; Daniel@0: inter(2,4)=1; Daniel@0: inter(3,4)=1; Daniel@0: inter(4,5)=1; Daniel@0: Daniel@0: intra = zeros(ss); Daniel@0: ns = 2*ones(1,ss); Daniel@0: Daniel@0: bnet = mk_dbn(intra, inter, ns); Daniel@0: Daniel@0: % All nodes start out off Daniel@0: for i=1:ss Daniel@0: bnet.CPD{i} = tabular_CPD(bnet, i, [1.0 0.0]'); Daniel@0: end Daniel@0: Daniel@0: % The following params correspond to Fig 4a in the UAI 98 paper Daniel@0: % The first arg is the leak inhibition prob. Daniel@0: % The vector contains the inhib probs from the parents in the previous slice; Daniel@0: % the last element is self, which is never inhibited. Daniel@0: bnet.CPD{1+ss} = noisyor_CPD(bnet, 1+ss, 0.8, 0); Daniel@0: bnet.CPD{2+ss} = noisyor_CPD(bnet, 2+ss, 1, [0.9 0]); Daniel@0: bnet.CPD{3+ss} = noisyor_CPD(bnet, 3+ss, 1, [0.8 0]); Daniel@0: bnet.CPD{4+ss} = noisyor_CPD(bnet, 4+ss, 1, [0.7 0.6 0]); Daniel@0: bnet.CPD{5+ss} = noisyor_CPD(bnet, 5+ss, 1, [0.5 0]); Daniel@0: Daniel@0: Daniel@0: % Generate some training data Daniel@0: Daniel@0: nseqs = 20; Daniel@0: seqs = cell(1,nseqs); Daniel@0: T = 30; Daniel@0: for i=1:nseqs Daniel@0: seqs{i} = sample_dbn(bnet, T); Daniel@0: end Daniel@0: Daniel@0: max_fan_in = 3; % let's cheat a little here Daniel@0: Daniel@0: % computing num. incorrect edges as a fn of the size of the training set Daniel@0: %sz = [5 10 15 20]; Daniel@0: sz = [5 10]; Daniel@0: h = zeros(1, length(sz)); Daniel@0: for i=1:length(sz) Daniel@0: inter2 = learn_struct_dbn_reveal(seqs(1:sz(i)), ns, max_fan_in); Daniel@0: h(i) = sum(abs(inter(:)-inter2(:))); % hamming distance Daniel@0: end Daniel@0: h