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

📄 checksizes.m

📁 duke的tutorial on EM的matlab经典源码
💻 M
字号:
function [N, D, K] = checkSizes(x, p, m, sigma)

% Number of data points and space dimension
if max(size(x)) == 1
    % x is really N
    N = x;
    D = [];
else
    N = size(x, 2);
    D = size(x, 1);
end

% Number of mixture components
if max(size(p)) == 1
    % p is really K
    K = p;
else
    K = length(p);
end

% Check input sizes
if ~isempty(D)
	if size(m, 1) ~= D
        error('Means and data points must have the same number of dimensions')
	end
end
if size(m, 2) ~= K
    error('The number of means must equal the number of mixing probabilities')
end

if nargin >= 4
	if min(size(sigma) ~= 1)
        error('Only isotropic Gaussians are allowed')
	end
	if length(sigma) ~= K
        error('The number of standard deviations must equal the number of mixing probabilities')
	end
end

⌨️ 快捷键说明

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