annotate _FullBNT/BNT/learning/learn_params.m @ 9:4ea6619cb3f5 tip

removed log files
author matthiasm
date Fri, 11 Apr 2014 15:55:11 +0100
parents b5b38998ef3b
children
rev   line source
matthiasm@8 1 function bnet = learn_params(bnet, data)
matthiasm@8 2 % LEARN_PARAMS Find the maximum likelihood params for a fully observed model
matthiasm@8 3 % bnet = learn_params(bnet, data)
matthiasm@8 4 %
matthiasm@8 5 % data(i,m) is the value of node i in case m (can be a cell array)
matthiasm@8 6 %
matthiasm@8 7 % We set bnet.CPD{i} to its ML/MAP estimate.
matthiasm@8 8 %
matthiasm@8 9 % Currently we assume no param tying
matthiasm@8 10
matthiasm@8 11 % AND THAT EACH DATA POINT IS A SCALAR - no longer assumed
matthiasm@8 12
matthiasm@8 13 %if iscell(data)
matthiasm@8 14 % data=cell2num(data);
matthiasm@8 15 %end
matthiasm@8 16 [n ncases] = size(data);
matthiasm@8 17 for j=1:n
matthiasm@8 18 e = bnet.equiv_class(j);
matthiasm@8 19 assert(e==j);
matthiasm@8 20 if adjustable_CPD(bnet.CPD{e})
matthiasm@8 21 fam = family(bnet.dag,j);
matthiasm@8 22 %bnet.CPD{j} = learn_params(bnet.CPD{j}, data(fam,:));
matthiasm@8 23 bnet.CPD{j} = learn_params(bnet.CPD{j}, fam, data, bnet.node_sizes, bnet.cnodes);
matthiasm@8 24 end
matthiasm@8 25 end
matthiasm@8 26