wolffd@0: function marginal = marginal_singleclq_nodes(engine, i, query) wolffd@0: % MARGINAL_SINGLECLQ_NODES get the marginal distribution of nodes which is in a single clique wolffd@0: % marginal = marginal_singleclq_nodes(engine, i, query) wolffd@0: wolffd@0: pot = struct(engine.clpot{i}); wolffd@0: if isempty(pot.ctaildom) wolffd@0: if i ~= engine.root wolffd@0: p = parents(engine.jtree, i); wolffd@0: tpot = direct_combine_pots(engine.clpot{i}, engine.seppot{p, i}); wolffd@0: else wolffd@0: tpot = engine.clpot{i}; wolffd@0: end wolffd@0: pot = marginalize_pot(tpot, query); wolffd@0: wolffd@0: marginal = pot_to_marginal(pot); wolffd@0: marginal.T = normalise(marginal.T); wolffd@0: else wolffd@0: [engine, clqtoroot] = push(engine, i, query); wolffd@0: if clqtoroot == engine.root wolffd@0: tpot = engine.clpot{clqtoroot}; wolffd@0: else wolffd@0: p = parents(engine.jtree, clqtoroot); wolffd@0: tpot = direct_combine_pots(engine.clpot{clqtoroot}, engine.seppot{p, clqtoroot}); wolffd@0: end wolffd@0: pot = marginalize_pot(tpot, query); wolffd@0: wolffd@0: marginal = pot_to_marginal(pot); wolffd@0: marginal.T = normalise(marginal.T); wolffd@0: end wolffd@0: