To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Revision:

root / _FullBNT / BNT / CPDs / @gaussian_CPD / private / CPD_to_linear_gaussian.m @ 8:b5b38998ef3b

History | View | Annotate | Download (420 Bytes)

1
function [mu, Sigma, W] = CPD_to_linear_gaussian(CPD, domain, ns, cnodes, evidence)
2

    
3
ps = domain(1:end-1);
4
dnodes = mysetdiff(1:length(ns), cnodes);
5
dps = myintersect(ps, dnodes); % discrete parents
6

    
7
if isempty(dps)
8
  Q = 1;
9
else
10
  assert(~any(isemptycell(evidence(dps))));
11
  dpvals = cat(1, evidence{dps});
12
  Q = subv2ind(ns(dps), dpvals(:)');
13
end
14

    
15
mu = CPD.mean(:,Q);
16
Sigma = CPD.cov(:,:,Q);
17
W = CPD.weights(:,:,Q);
18

    
19