annotate toolboxes/FullBNT-1.0.7/bnt/CPDs/@softmax_CPD/private/extract_params.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function [W, b] = extract_params(CPD)
wolffd@0 2
wolffd@0 3 % W(X,Y,Q), b(Y,Q) where Y = ns(self), X = ns(cps), Q = prod(ns(dps))
wolffd@0 4
wolffd@0 5 glimsz = prod(CPD.sizes(CPD.dpndx));
wolffd@0 6 ss = CPD.sizes(end);
wolffd@0 7 cpsz = sum(CPD.sizes(CPD.cpndx));
wolffd@0 8 dp_as_cpsz = sum(CPD.sizes(CPD.dps_as_cps.ndx));
wolffd@0 9 W = zeros(dp_as_cpsz + cpsz, ss, glimsz);
wolffd@0 10 b = zeros(ss, glimsz);
wolffd@0 11
wolffd@0 12 for i=1:glimsz
wolffd@0 13 W(:,:,i) = CPD.glim{i}.w1;
wolffd@0 14 b(:,i) = CPD.glim{i}.b1(:);
wolffd@0 15 end
wolffd@0 16
wolffd@0 17 W = myreshape(W, [dp_as_cpsz + cpsz ss CPD.sizes(CPD.dpndx)]);
wolffd@0 18 b = myreshape(b, [ss CPD.sizes(CPD.dpndx)]);