⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 estep.m

📁 greedy em 混和模型训练算法
💻 M
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%% The E-step of EM algorithm                           %%%%%
%%%%%%                                                      %%%%%
%%%%%% Kostas Blekas, 19 Dec. 2001                          %%%%%
%%%%%% please contact at kblekas@cc.uoi.gr in case of problems %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


function [Pr,z,new_LogL] = Estep(motif_pr,back_pr,alpha,new_seq,g,k,p,n,W,thesh);

f1 = zeros(1,W);

% Computation of Pr(x_i|theta_j) for motif & background

for j=1:g
    if k(j)
      for i=1:n
          for t=1:W               
               f1(t)=motif_pr(thesh(i,t),t,j);
          end
          Pr(i,j) = prod(f1);
      end
     else
        for i=1:n
          Pr(i,j)=prod(back_pr(thesh(i,:),j));
        end
     end 
end
   
% Computation of z(i,j)
 for i = 1:n
     z(i,:) = Pr(i,:) .* p / sum(Pr(i,:) .* p);
 end

% Log likelihood calculation
 new_LogL = sum(log(Pr * p'));
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -