franks_init_pot.m

来自「The BNL toolbox is a set of Matlab funct」· M 代码 · 共 34 行

M
34
字号
function [cliquetable, septable,schaal]=franks_init_pot(cliquetable,septable,CPT,parents)
%initialization of cliques , CPT is cell array of conditional probability tables
numb_clqs=length(cliquetable.ind);
a=size(cliquetable.pots{1});
N=a(end);
schaal=0;
for i=1:numb_clqs
    nodes=cliquetable.nod{i};
    cliquetable.pots{i}=ones([ cliquetable.dim{i}]);
    for j=nodes
        set=[parents{j} j];
        %enter_evidence
        %map=parents{nodes(j)} ;%identification number of the nodes to replicate across
        %over=find_equiv_posns(map,set);
        table=CPT{j};
        %table=table.*replicate_pot(likelihood{nodes(j)},over,size(table));
        %absorb cpts into potentials
        map=mysetdiff(cliquetable.ind{i},set);%identification number of the nodes to replicate across
        over=find_equiv_posns(map,cliquetable.ind{i});
        %if ~isempty(over)
        cliquetable.pots{i}=cliquetable.pots{i}.*replicate_pot(table,over,cliquetable.dim{i});
        %end
    end
    %new lines
    [cliquetable.pots{i},sch]=franksnormalize(cliquetable.pots{i},N,1);
        schaal=schaal+sch;
        %%%
end

%put potentials of separators to 1
a= find(~isemptycell(septable.pots));
for i=a'
    septable.pots{i}(:)=1;
end

⌨️ 快捷键说明

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