dbn_predict.m

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

M
30
字号
function [engine] = dbn_predict(engine, bel, T, ev)% DBN_PREDICT K-step-ahead prediction (hmm)% [engine] = dbn_predict(engine, bel, K, ev, pot_type)%% bel = Pr(X(t-1)|Y(t-1)) is the prior% ev{i} is the evidence on slice t-1% We essentially unroll the network to create slices t-1, t, t+1, ..., t+K-1% so we can extract the predicted value of node i k steps into the future% using marginal_nodes(i, k+1)error('unfinished');onodes = find(~isemptycell(ev));hnodes = find(isemptycell(ev));bnet = bnet_from_engine(engine);ns = bnet.node_sizes_slice;assert(isequal(onodes, bnet.cnodes_slice)); % we currently assume observed leaves are Gaussiansassert(isequal(hnodes, bnet.dnodes_slice)); ns(onodes) = 1;alpha = zeros(prod(ns(hnodes)), T);M = engine.transmat';t = 1;alpha(:,t) = bel;for t=2:T  alpha(:,t) = M * alpha(:,t-1);end     

⌨️ 快捷键说明

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