Daniel@0: function [W, b] = extract_params(CPD) Daniel@0: Daniel@0: % W(X,Y,Q), b(Y,Q) where Y = ns(self), X = ns(cps), Q = prod(ns(dps)) Daniel@0: Daniel@0: glimsz = prod(CPD.sizes(CPD.dpndx)); Daniel@0: ss = CPD.sizes(end); Daniel@0: cpsz = sum(CPD.sizes(CPD.cpndx)); Daniel@0: dp_as_cpsz = sum(CPD.sizes(CPD.dps_as_cps.ndx)); Daniel@0: W = zeros(dp_as_cpsz + cpsz, ss, glimsz); Daniel@0: b = zeros(ss, glimsz); Daniel@0: Daniel@0: for i=1:glimsz Daniel@0: W(:,:,i) = CPD.glim{i}.w1; Daniel@0: b(:,i) = CPD.glim{i}.b1(:); Daniel@0: end Daniel@0: Daniel@0: W = myreshape(W, [dp_as_cpsz + cpsz ss CPD.sizes(CPD.dpndx)]); Daniel@0: b = myreshape(b, [ss CPD.sizes(CPD.dpndx)]);