compute_prob.m.svn-base
来自「bayesian network structrue learning mat」· SVN-BASE 代码 · 共 24 行
SVN-BASE
24 行
function [p, indice] = compute_prob(dag, node_sizes, CPT, cas)% Compute P(X1=a,...,Xn=z) for the sub-jacente law from the pair <dag, CPT>%% p = compute_prob(dag, node_sizes, CPT, cas)%N = size(dag,1);p = 1;indice = ones(1,N);for n = 1:N fam = find(dag(:,n))'; pred = []; for c = fam if isempty(pred) indice(n) = cas(c); else indice(n) = indice(n) + (cas(c)-1)*prod(node_sizes(pred)); end pred = myunion(pred,c); end indice(n) = indice(n) + (cas(n)-1)*prod(node_sizes(pred)); p = p*CPT{n}(indice(n));end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?