marginal_difclq_nodes.m
来自「麻省理工学院的人工智能工具箱,很珍贵,希望对大家有用!」· M 代码 · 共 53 行
M
53 行
function marginal = marginal_difclq_nodes(engine, query_nodes)% MARGINAL_DIFCLQ_NODES get the marginal distribution of nodes which is not in a single clique% marginal = marginal_difclq_nodes(engine, query_nodes)if length(query_nodes) <= 1 marginal = []; return;end num_clique = length(engine.cliques);B = engine.cliques_bitv;clqs_containnodes = [];for i=1:length(query_nodes) node = query_nodes(i); tnodes = find(all(B(:, node), 2)); clqs_containnodes = myunion(clqs_containnodes, tnodes);end% get all cliques contains query nodes% get the minimal sub tree in junction which contains these cliques and the node closest to the root of jtree[subtree, nroot_node] = min_subtree_con_nodes(engine.jtree, engine.root, clqs_containnodes);if ~mysubset(query_nodes, engine.cliques{nroot_node}); % if query nodes is not all memers of the clique closest to the root clique performe push operation engine = push_tree(engine, subtree, query_nodes, nroot_node);endif ~(nroot_node == engine.root) % if the clique closest to the root clique is not the root clique we must direct combine the % potential with the potential stored in separator toward to root p = parents(engine.jtree, nroot_node); tpot = direct_combine_pots(engine.clpot{nroot_node}, engine.seppot{p, nroot_node});else tpot = engine.clpot{nroot_node};endpot = marginalize_pot(tpot, query_nodes);marginal = pot_to_marginal(pot);marginal.T = normalise(marginal.T);function engine = push_tree(engine, tree, query_nodes, inode)% PUSH_TREE recursive perform push opeartion on tree% engine = push_tree(engine, tree, query_nodes, inode)cs = children(tree, inode);for i = 1:length(cs) node = cs(i); push_tree(engine, tree, query_nodes, node); push_dom = myintersect(engine.cliques{node}, query_nodes); [engine, clqtoroot] = push(engine, node, push_dom);end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?