score_find_in_cache.m.svn-base

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

SVN-BASE
60
字号
function [bool, score] = score_find_in_cache(cache,j,ps,scoring_fn)% cache = score_find_in_cache(cache,j,ps,scoring_fn)%ticL=size(cache,1);N=size(cache,2)-3;if N<1  bool=0;  score=0;  returnendparents=zeros(1,N+1);parents(ps)=1;parents(N+1)=j;switch scoring_fn  case 'bic',    fn=1;  case 'bayesian',    fn=2;  otherwise,    error(['unrecognized scoring fn ' scoring_fn]);     end%parent = str2num(num2str(parents,'%1d'));%[tmp y]=find(cache(:,N+3)==fn);%if ~isempty(tmp)%  [tmp2 y]=find(str2num(num2str(cache(tmp,1:N+1),'%1d'))==parent);%  candidats=tmp(tmp2);%else%  candidats=[];%end[tmp y]=find(cache(2:L,N+3)==fn);tmp=tmp+1;[tmp2 y]=find(cache(tmp,N+1)==j);candidats=tmp(tmp2);if ~isempty(candidats)  for i=1:N      % N=size(cache,2)-3;    if ~isempty(candidats)      [tmp2 y]=find(cache(tmp,i)==parents(i));      candidats=intersect(candidats,tmp(tmp2));    end  endend%Tpre=tocif ~isempty(candidats)  bool=1;else  bool=0;endif bool  score=cache(candidats(1),N+2);else  score=0;end

⌨️ 快捷键说明

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