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

📄 showmixture.m

📁 使用matlab进行实现的kmeans算法。数据集。
💻 M
字号:
function showmixture(x,z,sigma)% showmixture: project data matrix on first eigenvectors (if necessary)%              and show Gaussian mixture in that space% showmixture(x,z,sigma)%	x     - data%	z     - d*K cluster centroids%   sigma - standard deviation of components% Copyright (c) 2001 Frank Dellaert% All rights Reserved%----------------------------------------------------------------------% first, coerce the data into displayable space, i.e. <= 3D, using PCA%----------------------------------------------------------------------[d,n] = size(x);K=size(z,2);if (d==1)  projected(1,:) = 1:n;  projected(2,:) = x;  means = zeros(2,K);  means(2,:)=z;  d = 2;elseif (d<=3)  projected = x;  means = z;else  [projected,mu,vc,ev] = projectpca(x,3);  means = projectpca(z,mu,vc,ev);  d = 3;end;%----------------------------------------------------------------------% now, plot the data and ellipsoids in the space%----------------------------------------------------------------------% plot the data in 2d or 3dif (d==2)   plot(projected(1,:), projected(2,:), '.');   hold on   plot(means(1,:), means(2,:), 'r*');else   plot3(projected(1,:), projected(2,:), projected(3,:), '.');   hold on   plot3(means(1,:), means(2,:), means(3,:), 'r*');endrotate3d on

⌨️ 快捷键说明

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