This function performs kernel version of kmeans algorithm. When the linear kernel (i.e., inner product) is used, the algorithm is equivalent to standard kmeans algorithm.
Input
K: n x n a semi-definite matrix computed by a kernel function on all sample pairs
m: the number of clusters k (1 x 1) or the initial label of samples (1 x n, 1<=label(i)<=k)
reference: [1] Kernel Methods for Pattern Analysis
by John Shawe-Taylor, Nello Cristianini
sample code:
load data;
K=x'*x; % use linear kernel
label=knkmeans(K,3);
spread(x,label) |