wolffd@0: function [pot, loglik] = normalize_pot(pot) wolffd@0: % NORMALIZE_POT Convert the SCG potential Pr(X,E) into Pr(X|E) and return log Pr(E). wolffd@0: % [pot, loglik] = normalize_pot(pot) wolffd@0: wolffd@0: % Marginalize down to [], so that the normalizing constant becomes Pr(E) wolffd@0: temp = marginalize_pot(pot, []); wolffd@0: [temp2, loglik] = normalize_pot(temp.scgpotc{1}); wolffd@0: wolffd@0: % Adjust scale factor to reflect the fact that the pot now represents Pr(X | E) instead of Pr(X,E). wolffd@0: wolffd@0: scale = -loglik; wolffd@0: if 1 wolffd@0: for i=1:pot.dsize wolffd@0: pot.scgpotc{i} = rescale_pot( pot.scgpotc{i}, scale); wolffd@0: end wolffd@0: end