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