espected_bic.m.svn-base

来自「bayesian network structrue learning mat」· SVN-BASE 代码 · 共 34 行

SVN-BASE
34
字号
function [BIC, BICi] = espected_BIC(bnet, esc, m)% [BIC, BICi] = espected_BIC(bnet, esc, m)%% INPUTS :%   bnet - the current bayesian network%   esc - the espected counts of the dataset%   m - [optionnal] the number of examples in the dataset%% OUTPUTS :%   BIC - the espected BIC score of the bnet given the dataset%   BICi - the espected BIC score of the node i given the dataset%if nargin<3, m = esc{1}; while length(m)>1, m = sum(m); end, endtiny = exp(-700);CPT = CPT_from_bnet(bnet);[D, d] = compute_bnet_nparams(bnet);dag = bnet.dag;ns = bnet.node_sizes;N = size(ns,2);cas = ones(1,N);BICi = zeros(1,N);continu = 1;while continu  [p, indice] = compute_prob(dag, ns, CPT, cas);  for i=1:N    BICi(i) = BICi(i) + esc{i}(indice(i))*log(CPT{i}(indice(i))+tiny);  end  [cas, continu] = next_case(cas, ns);  endBICi = BICi-d*log(m)/2;BIC = sum(BICi);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?