about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/BNT/general/do_intervention.m
blob: 2cfab87161f4f015fc4a16e8a9144e8259da0409 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
function bnet = mutilate_bnet(bnet, nodes, vals)
% MUTILATE_BNET Clamp nodes to specific values (perform a surgical intervention)
% bnet = mutilate_bnet(bnet, nodes, vals)
%
% We make all the clamped nodes roots.

ns = bnet.node_sizes;
for i=1:length(nodes)
  X = nodes(i);
  x = vals(i);
  bnet.dag(:,X) = 0;
  bnet.CPD{X} = root_CPD(bnet, X, x);
end