ksi_matrix.m

来自「greedy em 混和模型训练算法」· M 代码 · 共 28 行

M
28
字号
%%%% Create the Ksi matrix of size [ m X n ]                %%%%%
%%%% Each row i contains the probabilities P(x_j|theta_i)   %%%%%
%%%% where x_j (j=1,..,n) is the substring, and             %%%%%
%%%% theta_i is the probability matrix corresponds to       %%%%%
%%%% candidate i                                            %%%%%
%%%%                                                        %%%%%
%%%%%% Kostas Blekas, 19 Dec. 2001                          %%%%%
%%%%%% please contact at kblekas@cc.uoi.gr in case of problems %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [Ksi] = Ksi_matrix(n,m,alpha,lambda,L,W,thesh,C)
                
k = 1;

for i=1:m

    mtry = ones(L,W) .* (1.0 - lambda)/(L-1);
    for j=1:W
        mtry(find(C(i,j)==alpha),j) = lambda;
    end
    
    for j=1:n
        Ksi(i,j) = prod(diag(mtry(thesh(j,:),:)));      
    end 
    k = k+1;
end

⌨️ 快捷键说明

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