diff options
Diffstat (limited to 'sourcecodes/bnt-master/BNT/CPDs/@generic_CPD/Old')
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 |
