Spectral Regression provides an efficient subspace learning framework. I strongly recommend using SR instead of the following ordinary subspace learning algorithms.
constructW: Function used to construct the affinity matrix.
dijkstra.dll (for Windows)
dijkstra.mexglx (for Linux): dijkstra algorithm (You can download the source code at here)
Deng Cai, Xiaofei He, and Jiawei Han, "Document Clustering Using Locality Preserving Indexing", in IEEE TKDE, 2005. Bibtex source
%===========================================
fea = rand(50,70);
gnd = [ones(10,1);ones(15,1)*2;ones(10,1)*3;ones(15,1)*4];
res = kmeans(fea,4);
res = bestMap(gnd,res);
%============= evaluate AC: accuracy ==============
AC = length(find(gnd == res))/length(gnd);
%============= evaluate MIhat: nomalized mutual information =================
MIhat = MutualInfo(gnd,res);
%===========================================