about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/BNT/inference/static/@belprop_inf_engine/marginal_nodes.m
diff options
context:
space:
mode:
Diffstat (limited to 'sourcecodes/bnt-master/BNT/inference/static/@belprop_inf_engine/marginal_nodes.m')
-rw-r--r--sourcecodes/bnt-master/BNT/inference/static/@belprop_inf_engine/marginal_nodes.m14
1 files changed, 14 insertions, 0 deletions
diff --git a/sourcecodes/bnt-master/BNT/inference/static/@belprop_inf_engine/marginal_nodes.m b/sourcecodes/bnt-master/BNT/inference/static/@belprop_inf_engine/marginal_nodes.m
new file mode 100644
index 00000000..0c2b5d94
--- /dev/null
+++ b/sourcecodes/bnt-master/BNT/inference/static/@belprop_inf_engine/marginal_nodes.m
@@ -0,0 +1,14 @@
+function [marginal, pot] = marginal_nodes(engine, query)
+% MARGINAL_NODES Compute the marginal on the specified query nodes (belprop)
+% [marginal, pot] = marginal_nodes(engine, query)
+%
+% query must be a subset of a family
+
+if isempty(query)
+  big_pot = engine.marginal_domains{1}; % pick an arbitrary domain
+else
+  big_pot = engine.marginal_domains{query(end)};   
+end
+pot = marginalize_pot(big_pot, query);
+marginal = pot_to_marginal(pot);
+