jtree_unrolled_dbn_inf_engine.m

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

M
46
字号
function engine = jtree_unrolled_dbn_inf_engine(bnet, T, onodes, fast, compiled)% JTREE_UNROLLED_DBN_INF_ENGINE Unroll the DBN for T time-slices and apply jtree to the resulting static net%% engine = jtree_unrolled_dbn_inf_engine(bnet, T)% Specifies that all sequences will have T time-slices.% For variable length sequences, use jtree_dbn_inf_engine.%% engine = jtree_unrolled_dbn_inf_engine(bnet, T, onodes)% 'onodes' specifies which nodes are observed nodes in every slice.%% engine = jtree_unrolled_dbn_inf_engine(bnet, T, onodes, fast)% where 'fast' is a non-empty argument means use jtree_fast instead of jtree.%% engine = jtree_unrolled_dbn_inf_engine(bnet, T, onodes, fast, compiled)% where 'compiled' is a non-empty argument means compile jtree_fast first.if nargin < 3, onodes = []; endif nargin < 4 | isempty(fast), fast = 0; else fast = 1; endif nargin < 5 | isempty(compiled), compiled = 0; else compiled = 1; end  bnet2 = dbn_to_bnet(bnet, T);ss = length(bnet.intra);onodes = unroll_set(onodes, ss, T);constrained_order = 0;% If constrained_order = 1 we constrain ourselves to eliminate slice t before t+1.% This prevents cliques containing nodes from far-apart time-slices.if constrained_order  stages = num2cell(unroll_set(1:ss, ss, T), 1);else  stages = { 1:length(bnet2.dag) };endclusters = [];if fast  jengine = jtree_fast_inf_engine(bnet2, onodes(:), clusters, compiled, stages);else  jengine = jtree_inf_engine(bnet2, onodes(:), clusters, stages);endengine.sub_engine = jengine;% we don't inherit from jtree_inf_engine, because that would only store bnet2,% and we would lose access to the DBN-specific fields like intra/interengine.nslices = T;engine = class(engine, 'jtree_unrolled_dbn_inf_engine', inf_engine(bnet));

⌨️ 快捷键说明

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