支持向量域是近几年采用的一种较新的分类器

源代码在线查看: mykmeans.m

软件大小: 1029 K
上传用户: luyibo54618
关键词: 向量 分类器
下载地址: 免注册下载 普通下载 VIP

相关代码

				%MYKMEANS K-means clustering				%				%      [LABS,MEANS] = MYKMEANS(X,K)				%				% Place K centers in the data X using the k-means procedure.								% Copyright: D.M.J. Tax, D.M.J.Tax@prtools.org				% Faculty EWI, Delft University of Technology				% P.O. Box 5031, 2600 GA Delft, The Netherlands								function [labs,means,err] = mykmeans(x,k,errtol)								if nargin				  errtol = 1e-5;				end								% init:				[n,d] = size(x);								% use k random objects as initialization				I = randperm(n);				means = x(I(1:k),:);								% label all objects:				D = distm(x,means);				[mn, labs] = min(D,[],2);								% the reconstruction error:				err = sum(mn);				olderr = 10*err;								% update the means until the error does not change				while ((olderr-err)>errtol*err)									% update the means:					for i=1:k						I = find(labs==i);						if length(I)>0							means(i,:) = mean(x(I,:),1);						end					end					% relabel all objects:					D = sqeucldistm(x,means);					[mn, labs] = min(D,[],2);					% the error:					olderr = err;					err = sum(mn);				end								return							

相关资源