marginal_nodes.m
来自「麻省理工学院的人工智能工具箱,很珍贵,希望对大家有用!」· M 代码 · 共 51 行
M
51 行
function marginal = marginal_nodes(engine, b, nodes, t, add_ev, is_fam)
% function marginal = marginal_nodes(engine, b, nodes, t, add_ev, is_fam) (jtree_2TBN)
if nargin < 6, is_fam = 0; end
ss = engine.slice_size;
if ~is_fam & (t > 1) & (nodes<=ss)
nodes = nodes + ss;
end
node = nodes(end);
ndx_type = engine.ndx_type;
if t==1
c = clq_containing_nodes(engine.jtree_engine1, nodes, is_fam);
if is_fam
id = engine.marg_fam1_ndx_id(node);
else
id = engine.marg_node1_ndx_id(node);
end
ndx = get_ndx(id, ndx_type);
else
c = clq_containing_nodes(engine.jtree_engine, nodes, is_fam);
if is_fam
id = engine.marg_fam_ndx_id(node);
else
id = engine.marg_node_ndx_id(node);
end
ndx = get_ndx(id, ndx_type);
end
if c == -1
error(['no clique contains ' nodes])
end
bigpot = b.clpot{c};
marginal.T = marg_table_ndx(bigpot, engine.maximize, ndx, ndx_type);
% we convert the domain to the unrolled numbering system
% so that add_ev_to_dmarginal (maybe called in update_ess) extracts the right evidence.
if t > 1
marginal.domain = nodes+(t-2)*ss;
else
marginal.domain = nodes;
end
assert(~add_ev);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?