about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old
diff options
context:
space:
mode:
authorziejd22017-09-28 15:04:40 -0500
committerziejd22017-09-28 15:04:40 -0500
commit8070dc963753142bb86c4ed698d91fd623ed28e7 (patch)
treed0f6dd8fc46a49b819aa55c1a90faa14d8448883 /sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old
parent7cc31810d53176e805532b2789955f4eedbce6bb (diff)
downloadBNW-8070dc963753142bb86c4ed698d91fd623ed28e7.tar.gz
BNW using Octave instead of Matlab.
This version of BNW should perform the same as the original version. The only difference is that it uses Octave instead of Matlab when running BayesNet Toolbox during parameter learning.

I am calling this BNW_1.02. It can be accessed at:
compbio.uthsc.edu/BNW_1.02
Diffstat (limited to 'sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old')
-rw-r--r--sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old/BIC_score_CPD.m26
-rw-r--r--sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old/CPD_to_dpots.m16
-rw-r--r--sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old/CVS/Entries3
-rw-r--r--sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old/CVS/Repository1
-rw-r--r--sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old/CVS/Root1
5 files changed, 47 insertions, 0 deletions
diff --git a/sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old/BIC_score_CPD.m b/sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old/BIC_score_CPD.m
new file mode 100644
index 00000000..a73d073b
--- /dev/null
+++ b/sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old/BIC_score_CPD.m
@@ -0,0 +1,26 @@
+function score = BIC_score_CPD(CPD, fam, data, ns, cnodes)
+% BIC_score_CPD Compute the BIC score of a generic CPD
+% score = BIC_score_CPD(CPD, fam, data, ns, cnodes)
+%
+% We assume this node has a maximize_params method
+
+ncases = size(data, 2);
+CPD = reset_ess(CPD);
+% make a fully observed joint distribution over the family
+fmarginal.domain = fam;
+fmarginal.T = 1;
+fmarginal.mu = [];
+fmarginal.Sigma = [];
+if ~iscell(data)
+  cases = num2cell(data);
+else
+  cases = data;
+end
+for m=1:ncases
+  CPD = update_ess(CPD, fmarginal, cases(:,m), ns, cnodes);
+end
+CPD = maximize_params(CPD);
+self = fam(end);
+ps = fam(1:end-1);
+L = log_prob_node(CPD, cases(self,:), cases(ps,:));
+score = L - 0.5*CPD.nparams*log(ncases);
diff --git a/sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old/CPD_to_dpots.m b/sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old/CPD_to_dpots.m
new file mode 100644
index 00000000..47daac88
--- /dev/null
+++ b/sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old/CPD_to_dpots.m
@@ -0,0 +1,16 @@
+function pots = CPD_to_dpots(CPD, domain, ns, cnodes, evidence)
+% CPD_TO_DPOTS Convert the CPD to several discrete potentials, for different instantiations (generic)
+% pots = CPD_to_dpots(CPD, domain, ns, cnodes, evidence)
+%
+% domain(:,i) is the domain of the i'th instantiation of CPD.
+% node_sizes(i) is the size of node i.
+% cnodes = all the cts nodes
+% evidence{i} is the evidence on the i'th node.
+%
+% This just calls CPD_to_dpot for each domain.
+    
+nCPDs = size(domain,2);
+pots = cell(1,nCPDs);
+for i=1:nCPDs
+  pots{i} = CPD_to_dpot(CPD, domain(:,i), ns, cnodes, evidence);
+end
diff --git a/sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old/CVS/Entries b/sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old/CVS/Entries
new file mode 100644
index 00000000..505b09aa
--- /dev/null
+++ b/sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old/CVS/Entries
@@ -0,0 +1,3 @@
+/BIC_score_CPD.m/1.1.1.1/Wed May 29 15:59:52 2002//
+/CPD_to_dpots.m/1.1.1.1/Wed May 29 15:59:52 2002//
+D
diff --git a/sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old/CVS/Repository b/sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old/CVS/Repository
new file mode 100644
index 00000000..96b94fc8
--- /dev/null
+++ b/sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old/CVS/Repository
@@ -0,0 +1 @@
+FullBNT/BNT/CPDs/@generic_CPD/Old
diff --git a/sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old/CVS/Root b/sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old/CVS/Root
new file mode 100644
index 00000000..f3bd14a6
--- /dev/null
+++ b/sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old/CVS/Root
@@ -0,0 +1 @@
+:ext:nsaunier@bnt.cvs.sourceforge.net:/cvsroot/bnt