To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / _FullBNT / BNT / CPDs / @gmux_CPD / sample_node.m @ 8:b5b38998ef3b
History | View | Annotate | Download (338 Bytes)
| 1 |
function y = sample_node(CPD, pev) |
|---|---|
| 2 |
% SAMPLE_NODE Draw a random sample from P(Xi | x(pi_i), theta_i) (gmux) |
| 3 |
% y = sample_node(CPD, parent_evidence) |
| 4 |
% |
| 5 |
% parent_ev{i} is the value of the i'th parent
|
| 6 |
|
| 7 |
dpval = pev{CPD.dps};
|
| 8 |
x = pev{CPD.cps(dpval)};
|
| 9 |
y = gsamp(CPD.mean(:,dpval) + CPD.weights(:,:,dpval)*x(:), CPD.cov(:,:,dpval), 1); |
| 10 |
y = y(:); |