annotate toolboxes/FullBNT-1.0.7/bnt/general/do_intervention.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 = mutilate_bnet(bnet, nodes, vals)
wolffd@0 2 % MUTILATE_BNET Clamp nodes to specific values (perform a surgical intervention)
wolffd@0 3 % bnet = mutilate_bnet(bnet, nodes, vals)
wolffd@0 4 %
wolffd@0 5 % We make all the clamped nodes roots.
wolffd@0 6
wolffd@0 7 ns = bnet.node_sizes;
wolffd@0 8 for i=1:length(nodes)
wolffd@0 9 X = nodes(i);
wolffd@0 10 x = vals(i);
wolffd@0 11 bnet.dag(:,X) = 0;
wolffd@0 12 bnet.CPD{X} = root_CPD(bnet, X, x);
wolffd@0 13 end