📄 learn_struct_tan_em.m.svn-base
字号:
function dag = learn_struct_tan_EM(data, class, node_sizes, root, prior, nbloopmax, thresh)% LEARN_STRUCT_TAN_EM % [bnet, Ebic] = learn_struct_mwstem(data, class, node_sizes, prior, root, nbloopmax, thresh)%% Input : % data{i,m} a cell where the node i in the case m,% class is the number of the class node,% discrete = [ 1 if discret-node 0 if not ], (1:N)% node_sizes = 1 if gaussian node, (max on complete samples)% prior = 1 to use uniform Dirichlet prior (0)% root is the futur root-node of the tree T. (random)% nbloopmax = max loop number (ceil(log(N*log(N))))% thresh = the convergence test's threshold (1e-3)%% Output :% bnet = the output bayesian network% Ebic = the espected BIC score of bnet given the data%[N, m]=size(data);log_m = log(m);if nargin<7, thresh = 1e-3; endmax_iter = 10; % for learn_struct_paramsif nargin<6, nbloopmax = ceil(log(N*log(N))), endif nargin<5, prior = 0; endif nargin<4, root = ceil(N*rand(1)), endif nargin<3, misv = -9999; data_mat = bnt_to_mat(data,misv); node_sizes = max(data_mat'), clear data_matenddiscrete = 1:N;nbloop = 0;variab = mysetdiff(1:N, class);[Bbest1, Sbest, Obest] = learn_struct_mwst_EM(data(variab, :), 1:N-1, node_sizes(variab), prior, nbloopmax, thresh);%[Bbest, Sbest, Obest] = learn_struct_mwst_EM(data, discrete, node_sizes, prior, nbloopmax, thresh)dag = zeros(N);dag(variab, variab) = Bbest1.dag;dag(root, variab) = 1;%Bbest = mk_bnet(dag, discrete);%for i=discrete, Bbest.CPD{i} = tabular_CPD(Bbest, i, 'prior_type', 'dirichlet', 'dirichlet_type', 'unif'); end%engine = jtree_inf_engine(Bbest);%Bbest = learn_params_em(engine, data, max_iter, thresh);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -