You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
Running the following code will reproduce the problem:
intra = [0 1; 0 0];
inter = [1 0; 0 0];
num_nodes = 2;
num_states = [2 2];% num of states
dnodes = [1 2]; % indices of discrete nodes
onodes = 2;% indices of observed nodes
eclass1 = [1 2];
eclass2 = [3 2];
N = max([eclass1 eclass2]);
CPT = cell(1,N);
bnet = mk_dbn(intra, inter, num_states, 'discrete', dnodes, ...
'observed', onodes, 'eclass1', eclass1, 'eclass2', eclass2);
bnet.CPD{1} = tabular_CPD(bnet,1);
bnet.CPD{2} = tabular_CPD(bnet,2);
bnet.CPD{3} = tabular_CPD(bnet,3);
engine = smoother_engine(jtree_2TBN_inf_engine(bnet));
ss = 2;%slice size(ss)
ncases = 10;%number of examples
T=10;
max_iter=2;%iterations for EM
cases = cell(1, ncases);
for i=1:ncases
ev = sample_dbn(bnet, T);
cases{i} = cell(ss,T);
cases{i}(onodes,:) = ev(onodes, :);
cases{i}{2,3} = [];
cases{i}{2,4} = [];
end
[bnet2 LLTrace]= learn_params_dbn_em(engine, cases);
for i=1:N
s=struct(bnet2.CPD{i});
CPT{i}=s.CPT;
end
celldisp(CPT);
What is the expected output? What do you see instead?
I expect to see CPTs printed to the screen for the prior, transition, and
emission probabilities. Instead, I get the following error:
Error using .*
Matrix dimensions must agree.
Error in mult_by_table (line 7)
bigT(:) = bigT(:) .* Ts(:); % must have bigT(:) on LHS to preserve
shape
Error in dpot/multiply_by_pot (line 11)
Tbig.T = mult_by_table(Tbig.T, Tbig.domain, Tbig.sizes,
Tsmall.T, Tsmall.domain, Tsmall.sizes);
Error in jtree_inf_engine/init_pot (line 17)
clpot{c} = multiply_by_pot(clpot{c}, pots{i});
Error in jtree_2TBN_inf_engine/fwd (line 36)
[f.clpot, f.seppot] = init_pot(engine.jtree_engine, clqs, pots,
engine.pot_type, engine.observed);
Error in smoother_engine/enter_evidence (line 14)
[f{t}, ll(t)] = fwd(engine.tbn_engine, f{t-1}, ev(:,t), t);
Error in learn_params_dbn_em>EM_step (line 131)
[engine, ll] = enter_evidence(engine, evidence);
Error in learn_params_dbn_em (line 82)
[engine, loglik, logpost] = EM_step(engine, evidence,
temperature);
Error in mem_no_aux (line 58)
bnet2 = learn_params_dbn_em( engine, cases);
What version of the product are you using? On what operating system?
I am using BNT Full Version 1.07 on 64 bit Windows 7.
Please provide any additional information below.
What has been provided is one of the sample HMM learning codes - it has been
slightly augmented so that there are missing values in the samples for the
observed nodes. Substituting a sample with the missing value symbol, [], causes
element wise matrix multiplication errors in mult_by_table preventing the
program from continuing.
Original issue reported on code.google.com by [email protected] on 25 Jul 2012 at 1:02
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 25 Jul 2012 at 1:02The text was updated successfully, but these errors were encountered: