Cell contents reference from a non-cell array object.
显示 更早的评论
function bnet = mk_chmm(N, Q, Y, discrete_obs, coupled, CPD)
if nargin < 2, Q = 2; end
if nargin < 3, Y = 1; end
if nargin < 4, discrete_obs = 0; end
if nargin < 5, coupled = 1; end
if nargin < 6, rnd = 1; else rnd = 0; end
ss = N*2;
hnodes = 1:N;
onodes = (1:N)+N;
intra = zeros(ss);
for i=1:N
intra(hnodes(i), onodes(i))=1;
end
inter = zeros(ss);
if coupled
for i=1:N
inter(i, max(i-1,1):min(i+1,N))=1;
end
else
inter(1:N, 1:N) = eye(N);
end
ns = [Q*ones(1,N) Y*ones(1,N)];
eclass1 = [hnodes onodes];
eclass2 = [hnodes+ss onodes];
if discrete_obs
dnodes = 1:ss;
else
dnodes = hnodes;
end
bnet = mk_dbn(intra, inter, ns, 'discrete', dnodes, 'eclass1', eclass1, 'eclass2', eclass2, ...
'observed', onodes);
if rnd
for i=hnodes(:)'
bnet.CPD{i} = tabular_CPD(bnet, i);
end
for i=onodes(:)'
if discrete_obs
bnet.CPD{i} = tabular_CPD(bnet, i);
else
bnet.CPD{i} = gaussian_CPD(bnet, i);
end
end
for i=hnodes(:)'+ss
bnet.CPD{i} = tabular_CPD(bnet, i);
end
else
for i=hnodes(:)'
bnet.CPD{i} = tabular_CPD(bnet, i, CPD{i}.CPT);
end
for i=onodes(:)'
if discrete_obs
bnet.CPD{i} = tabular_CPD(bnet, i, CPD{i}.CPT);
else
bnet.CPD{i} = gaussian_CPD(bnet, i, CPD{i}.mean, CPD{i}.cov);
end
end
for i=hnodes(:)'+ss
bnet.CPD{i} = tabular_CPD(bnet, i, CPD{i}.CPT);
end
end
5 个评论
yihao wu
2018-4-14
编辑:Walter Roberson
2018-4-14
Walter Roberson
2018-4-14
This seems to have something to do with Dynamic Bayesian Networks http://www.cs.ubc.ca/~murphyk/Software/BNT/usage_dbn.html but I am not sure which software package you are using.
yihao wu
2018-4-14
Stephen23
2018-4-14
What class is bnet.CPD ?
Walter Roberson
2018-4-14
bnet itself might not be a struct or object. For example bnet might be empty.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Title 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!