⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 find_max_configs.m

📁 The BNL toolbox is a set of Matlab functions for defining and estimating the parameters of a Bayesi
💻 M
字号:
function [post_traj, degeneracy]=find_max_configs(link,parms,design,parents,node_sizes...
    ,equiv_class,equiv_class_time,evidence_nodes,partial_evidence_nodes,terminal_merged_nodes,hid_nodes,...
    gausskwadnodes,...
    onames,preorder, postorder,cliquetable, septable,pot_to_CPT,N)    



%E step

lin_pred=construct_lin_pred(parms,design,parents,node_sizes,equiv_class,equiv_class_time,terminal_merged_nodes,N);

equiv_class_CPTs=construct_equiv_class_CPT(link,lin_pred,N);

bigCPTs=construct_bigCPTs(equiv_class_CPTs,equiv_class,...
    evidence_nodes,partial_evidence_nodes,terminal_merged_nodes,hid_nodes,...
    gausskwadnodes,N);

[cliquetable, septable]=franks_init_pot(cliquetable,septable,bigCPTs,parents);
%max_marginaliation
%collect
[septable,cliquetable]=max_propagate_messages(postorder,septable, cliquetable);%kan sneller!
%distribute
[septable,cliquetable]=max_propagate_messages(preorder,septable, cliquetable);
        
%find max configuration of cliques
[cliquetable,septable]=select_max_config(cliquetable,septable);

%look for degeneracies
%collect
[septable,cliquetable,schaal_collect]=propagate_messages(postorder,septable, cliquetable);
%distribute
[septable,cliquetable,schaal_distribute]=propagate_messages(preorder,septable, cliquetable);
        
%compute degeneracies (if ==1 no degeneracies)

schaal=schaal_collect+schaal_distribute;
degeneracy=exp(loglik(cliquetable.pots{1},schaal));

%max configs of joint CPTs
max_CPTs=compute_JPTs(cliquetable,pot_to_CPT,parents,node_sizes,N);

%select
max_configs=zeros(N,length(max_CPTs));

for i=1:length(max_CPTs)
    nd=ndims(max_CPTs{i});
    table=max_CPTs{i};
    for j=1:nd-2
        table=squeeze(sum(table));
    end
    f=find(table==1);
    k=mod(f-1,size(table,1));
    max_configs(:,i)=k;
end
    
%for hidden variables only

hn=sort([hid_nodes.nodenrs ; gausskwadnodes.nodenrs]);

post_traj.onames=onames(hn);
post_traj.traj=max_configs(:,hn);




⌨️ 快捷键说明

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