collapse_mog.m

来自「麻省理工学院的人工智能工具箱,很珍贵,希望对大家有用!」· M 代码 · 共 16 行

M
16
字号
function [new_mu, new_Sigma] = collapse_mog(mu, Sigma, coefs)% COLLAPSE_MOG Collapse a mixture of Gaussians to a single Gaussian.% [new_mu, new_Sigma] = collapse_mog(mu, Sigma, coefs)%% coefs(i) - weight of i'th mixture component% mu(:,i), Sigma(:,:,i) - params of i'th mixture componentnew_mu = sum(mu * diag(coefs), 2); % weighted sum of columnsn = length(new_mu);new_Sigma = zeros(n,n);for j=1:length(coefs)  m = mu(:,j) - new_mu;  new_Sigma = new_Sigma + coefs(j) * (Sigma(:,:,j) + m*m');end

⌨️ 快捷键说明

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