-
Notifications
You must be signed in to change notification settings - Fork 1
/
Demo_iris.m
37 lines (32 loc) · 958 Bytes
/
Demo_iris.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
% This demo shows the MDS/tsne/gsne embedding of iris dataset in 2-D space.
% Run this command to get the MATLAB private functions if it is the fist running.
GetPrivateFunction
%% iris data
load fisheriris
hFig = figure(1);
set(hFig,'position',[0 0 800 800])
repeats = 3;
% MDS maps of three repeats
for k = 1:repeats
Euc_dist = squareform(pdist(meas)); % Euclidean pairwise distances
Pos = mdscale(Euc_dist,2,'Start','random');
subplot(3,3,k)
gscatter(Pos(:,1),Pos(:,2),species,[],[],[])
title(['MDS, repeat ',num2str(k)])
end
% tsne maps of three repeats
lambda = 0;
for k = 1:repeats
Pos = gsne(meas,lambda,'Algorithm','exact');
subplot(3,3,3+k)
gscatter(Pos(:,1),Pos(:,2),species,[],[],[])
title(['tsne, repeat ',num2str(k)])
end
% gsne maps of three repeats
lambda = 1;
for k = 1:repeats
Pos = gsne(meas,lambda,'Algorithm','exact');
subplot(3,3,6+k)
gscatter(Pos(:,1),Pos(:,2),species,[],[],[])
title(['gsne, \lambda = 1, repeat ',num2str(k)])
end