comparison toolboxes/FullBNT-1.0.7/bnt/learning/learn_params.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function bnet = learn_params(bnet, data)
2 % LEARN_PARAMS Find the maximum likelihood params for a fully observed model
3 % bnet = learn_params(bnet, data)
4 %
5 % data(i,m) is the value of node i in case m (can be a cell array)
6 %
7 % We set bnet.CPD{i} to its ML/MAP estimate.
8 %
9 % Currently we assume no param tying
10
11 % AND THAT EACH DATA POINT IS A SCALAR - no longer assumed
12
13 %if iscell(data)
14 % data=cell2num(data);
15 %end
16 [n ncases] = size(data);
17 for j=1:n
18 e = bnet.equiv_class(j);
19 assert(e==j);
20 if adjustable_CPD(bnet.CPD{e})
21 fam = family(bnet.dag,j);
22 %bnet.CPD{j} = learn_params(bnet.CPD{j}, data(fam,:));
23 bnet.CPD{j} = learn_params(bnet.CPD{j}, fam, data, bnet.node_sizes, bnet.cnodes);
24 end
25 end
26