Attachment 'sheet02.m'
Download 1 function sheet02
2
3 % generate a swissroll data set
4 [X, Y] = swissroll(1000);
5
6 figure(1)
7 scatter3(X(:, 1), X(:, 2), X(:, 3), 30, Y, 'filled')
8
9 % apply t-SNE
10 no_dims = 2;
11 init_dims = 3;
12 perplexity = 50;
13
14 %mappedX = tsne(X, [], no_dims, init_dims, perplexity);
15 mappedX = X
16
17 % plot mapped data
18 figure(2)
19 scatter(mappedX(:, 1), mappedX(:, 2), 20, Y);
20
21 % load mnist data
22 load mnist_train.mat
23 ind = randperm(size(train_X, 1));
24 train_X = train_X(ind(1:1000),:);
25 train_labels = train_labels(ind(1:1000));
26
27 no_dims = 2;
28 init_dims = 30;
29 perplexity = 30;
30
31 mappedX = tsne(train_X, [], no_dims, init_dims, perplexity);
32
33 % plot data
34 figure(3)
35 show_mnist(mappedX, train_X, train_labels);
36
37
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 %
40 % Your solutions below
41 %
42
43 % Generate swissroll data
44 function [X, Y] = swissroll(N)
45 % your solution here...
46
47 % Show results on the mnist data set. Show all points as dots,
48 % show 50 random samples as small image.
49 function show_mnist(mappedX, train_X, train_labels)
50 % your solution here...
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.