function Tau = visualise(K,k)

%function Tau = visualise(K,k)
%
% Computes a good representation of the data in which cluster
% structure should be visible, and plots the dominant two-
% dimensional subspace of this representation
%
%INPUTS
% K = the kernel matrix (ell x ell)
% k = the number of components desired
%
%OUTPUTS
% Tau = a matrix storing the k-dimensional representation of
%       the data (ell x k)
%
%
%For more info, see www.kernel-methods.net


% original kernel matrix stored in variable K
% tau gives the embedding in k dimensions
D = diag(sum(K));
L = D - K;
[V,Lambda] = eigs(L,k+1,'SR');
Lambda = diag(Lambda);
I = find(abs(Lambda) > 0.00001)
objective = 2*sum(Lambda(I(1:k)))
Tau = V(:,I(1:k));
plot(Tau(:,1), Tau(:,2), 'x')
