about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/BNT/CPDs/@root_CPD/sample_node.m
diff options
context:
space:
mode:
Diffstat (limited to 'sourcecodes/bnt-master/BNT/CPDs/@root_CPD/sample_node.m')
-rw-r--r--sourcecodes/bnt-master/BNT/CPDs/@root_CPD/sample_node.m9
1 files changed, 9 insertions, 0 deletions
diff --git a/sourcecodes/bnt-master/BNT/CPDs/@root_CPD/sample_node.m b/sourcecodes/bnt-master/BNT/CPDs/@root_CPD/sample_node.m
new file mode 100644
index 00000000..5ced75f4
--- /dev/null
+++ b/sourcecodes/bnt-master/BNT/CPDs/@root_CPD/sample_node.m
@@ -0,0 +1,9 @@
+function y = sample_node(CPD, pev)
+% SAMPLE_NODE Draw a random sample from P(Y|pa(y), theta)  (root)
+% Y = SAMPLE_NODE(CPD, PEV)
+%
+% pev{i} is the evidence on the i'th parent.
+% Since a root has no parents, we ignore pev,
+% and return the value the root was clamped to when it was created.
+
+y = CPD.val;