about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/BNT/potentials/@dpot/normalize_pot.m
diff options
context:
space:
mode:
Diffstat (limited to 'sourcecodes/bnt-master/BNT/potentials/@dpot/normalize_pot.m')
-rw-r--r--sourcecodes/bnt-master/BNT/potentials/@dpot/normalize_pot.m12
1 files changed, 12 insertions, 0 deletions
diff --git a/sourcecodes/bnt-master/BNT/potentials/@dpot/normalize_pot.m b/sourcecodes/bnt-master/BNT/potentials/@dpot/normalize_pot.m
new file mode 100644
index 00000000..1bc43cdb
--- /dev/null
+++ b/sourcecodes/bnt-master/BNT/potentials/@dpot/normalize_pot.m
@@ -0,0 +1,12 @@
+function [pot, loglik] = normalize_pot(pot)
+% NORMALIZE_POT Convert the discrete potential Pr(X,E) into Pr(X|E) and return log Pr(E).
+% [pot, loglik] = normalize_pot(pot)
+
+if isempty(pot.T)  %add to process sparse
+   loglik = 0;
+   return;
+end
+[pot.T, lik] = normalise(pot.T);
+loglik = log(lik + (lik==0)*eps);
+
+