ff_inf_engine.m

来自「Bayes网络工具箱」· M 代码 · 共 44 行

M
44
字号
function engine = ff_inf_engine(bnet, onodes)% FF_INF_ENGINE Factored frontier inference engine for DBNs% engine = ff_inf_engine(bnet, onodes)%% The model must obey the same topological restrictions as hmm_inf_engine.% In addition, each hidden node is assumed to have at most one observed child,% and each observed child is assumed to have exactly one hidden parent.%% For details of this algorithm, see% "The Factored Frontier Algorithm for Approximate Inference in DBNs",% Kevin Murphy and Yair Weiss, submitted to NIPS 2000.%% THIS IS HIGHLY EXPERIMENTAL CODE!ss = length(bnet.intra);hnodes = mysetdiff(1:ss, onodes);[persistent_nodes, transient_nodes] = partition_dbn_nodes(bnet.intra, bnet.inter);assert(isequal(onodes, transient_nodes));assert(isequal(hnodes, persistent_nodes));engine.onodes = onodes;engine.hnodes = hnodes;engine.marginals = [];engine.fwd = [];engine.back = [];engine.CPDpot = [];engine.filter = [];obschild = zeros(1,ss);for i=engine.hnodes(:)'  %ocs = myintersect(children(bnet.dag, i), onodes);  ocs = children(bnet.intra, i);  assert(length(ocs) <= 1);  if length(ocs)==1    obschild(i) = ocs(1);  endend  engine.obschild = obschild;engine = class(engine, 'ff_inf_engine', inf_engine(bnet));

⌨️ 快捷键说明

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