view toolboxes/FullBNT-1.0.7/bnt/inference/static/@stab_cond_gauss_inf_engine/marginal_singleclq_nodes.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
line wrap: on
line source
function marginal = marginal_singleclq_nodes(engine, i, query)
% MARGINAL_SINGLECLQ_NODES get the marginal distribution of nodes which is in a single clique
% marginal = marginal_singleclq_nodes(engine, i, query)

pot = struct(engine.clpot{i});
if isempty(pot.ctaildom)
    if i ~= engine.root
        p = parents(engine.jtree, i);
        tpot = direct_combine_pots(engine.clpot{i}, engine.seppot{p, i});
    else
        tpot = engine.clpot{i};
    end
    pot = marginalize_pot(tpot, query);
    
    marginal = pot_to_marginal(pot);
    marginal.T = normalise(marginal.T);
else
    [engine, clqtoroot] = push(engine, i, query);
    if clqtoroot == engine.root
        tpot = engine.clpot{clqtoroot};
    else
        p = parents(engine.jtree, clqtoroot);
        tpot = direct_combine_pots(engine.clpot{clqtoroot}, engine.seppot{p, clqtoroot});
    end
    pot = marginalize_pot(tpot, query);
    
    marginal = pot_to_marginal(pot);
    marginal.T = normalise(marginal.T);
end