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 / @softmax_CPD / private / extract_params.m @ 8:b5b38998ef3b

History | View | Annotate | Download (529 Bytes)

1
function [W, b] = extract_params(CPD)
2

    
3
% W(X,Y,Q), b(Y,Q)  where Y = ns(self), X = ns(cps), Q = prod(ns(dps))
4

    
5
glimsz = prod(CPD.sizes(CPD.dpndx));
6
ss = CPD.sizes(end);
7
cpsz       = sum(CPD.sizes(CPD.cpndx));
8
dp_as_cpsz = sum(CPD.sizes(CPD.dps_as_cps.ndx));
9
W = zeros(dp_as_cpsz + cpsz, ss, glimsz);
10
b = zeros(ss, glimsz);
11

    
12
for i=1:glimsz
13
  W(:,:,i) = CPD.glim{i}.w1;
14
  b(:,i) = CPD.glim{i}.b1(:);
15
end
16

    
17
W = myreshape(W, [dp_as_cpsz + cpsz ss CPD.sizes(CPD.dpndx)]);
18
b = myreshape(b, [ss CPD.sizes(CPD.dpndx)]);