📄 visualise.m
字号:
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')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -