annotate _FullBNT/BNT/CPDs/@softmax_CPD/sample_node.m @ 9:4ea6619cb3f5 tip

removed log files
author matthiasm
date Fri, 11 Apr 2014 15:55:11 +0100
parents b5b38998ef3b
children
rev   line source
matthiasm@8 1 function y = sample_node(CPD, pvals)
matthiasm@8 2 % SAMPLE_NODE Draw a random sample from P(Xi | x(pi_i), theta_i) (discrete)
matthiasm@8 3 % y = sample_node(CPD, parent_evidence)
matthiasm@8 4 %
matthiasm@8 5 % parent_evidence{i} is the value of the i'th parent
matthiasm@8 6
matthiasm@8 7 n = length(pvals)+1;
matthiasm@8 8 dom = 1:n;
matthiasm@8 9 %evidence = cell(1,n);
matthiasm@8 10 %evidence(1:n-1) = pvals(:)';
matthiasm@8 11 evidence = pvals;
matthiasm@8 12 evidence{end+1} = [];
matthiasm@8 13 T = convert_to_table(CPD, dom, evidence);
matthiasm@8 14 y = sample_discrete(T);