scg_unrolled_dbn_inf_engine.m

来自「麻省理工学院的人工智能工具箱,很珍贵,希望对大家有用!」· M 代码 · 共 46 行

M
46
字号
function engine = scg_unrolled_dbn_inf_engine(bnet, T, varargin)% SCG_UNROLLED_DBN_INF_ENGINE Unroll the DBN for T time-slices and apply stab_cond_gauss to the resulting static net% engine = scg_unrolled_dbn_inf_engine(bnet, T, ...)%% The following optional arguments can be specified in the form of name/value pairs:% [default value in brackets]%% constrained - 1 means we constrain ourselves to eliminate slice t before t+1 [1]%% set default paramsN = length(bnet.intra);constrained = 1;if nargin >= 3  args = varargin;  nargs = length(args);  for i=1:2:nargs    switch args{i},     case 'constrained',  constrained = args{i+1};     otherwise,        error(['invalid argument name ' args{i}]);           end  endendbnet2 = dbn_to_bnet(bnet, T);ss = length(bnet.intra);engine.ss = ss;% 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  stages = num2cell(unroll_set(1:ss, ss, T), 1);else  stages = { 1:length(bnet2.dag) };endscg_engine = stab_cond_gauss_inf_engine(bnet2, 'stages', stages);engine.unrolled_engine = scg_engine;% 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, 'scg_unrolled_dbn_inf_engine', inf_engine(bnet));

⌨️ 快捷键说明

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