function sheet02

% generate a swissroll data set
[X, Y] = swissroll(1000);

figure(1)
scatter3(X(:, 1), X(:, 2), X(:, 3), 30, Y, 'filled')

% apply t-SNE
no_dims = 2;
init_dims = 3;
perplexity = 50;

%mappedX = tsne(X, [], no_dims, init_dims, perplexity);
mappedX = X

% plot mapped data
figure(2)
scatter(mappedX(:, 1), mappedX(:, 2), 20, Y);

% load mnist data
load mnist_train.mat
ind = randperm(size(train_X, 1));
train_X = train_X(ind(1:1000),:);
train_labels = train_labels(ind(1:1000));

no_dims = 2;
init_dims = 30;
perplexity = 30;

mappedX = tsne(train_X, [], no_dims, init_dims, perplexity);

% plot data
figure(3)
show_mnist(mappedX, train_X, train_labels);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Your solutions below
%

% Generate swissroll data
function [X, Y] = swissroll(N)
% your solution here...

% Show results on the mnist data set. Show all points as dots,
% show 50 random samples as small image.
function show_mnist(mappedX, train_X, train_labels)
% your solution here...
