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

📄 initclusters.m

📁 duke的tutorial on EM的matlab经典源码
💻 M
字号:
% Find K points (columns of m) somewhere in the cloud of the points formed
% by the columns of x.
% If so requested also find K equal standard deviations that are reasonable
% starting values for k-means or EM.
% If so requested, also give K mixing probabilities, all equal to 1/K.

function [m, sigma, p] = initClusters(x, K)

D = size(x, 1);

% Centroid of all the data points
m = colmean(x')';

% Standard deviation in each dimension
sigma = colstd(x')';

oK = ones(1, K);

% K initial means somewhere within the cloud of data points
m = m * oK + (sigma * oK) .* randn(D, K);

if nargout >= 2
    % K standard deviations
    sigma = sqrt(sum(sigma .^ 2)) * oK / (K ^ (1/D));
end

if nargout >= 3
	% K initial mixing probabilities
	p = oK / K;
end

⌨️ 快捷键说明

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