非線形次元削減法 t-SNE でスイスロールを開いてみた
3 次元のスイスロールを、t-SNE を使って開いて (?) みました。MATLAB で書いています。
スイスロールデータを用意し、
% swiss roll data npt= 1000; t = linspace(0,2*pi*1.5,npt); r = linspace(1,10,npt); x = r .* cos(t); y = r .* sin(t); z = rand(1,npt)*10; c = linspace(0,1,npt);
MATLAB の t-SNE 関数に放り込み、
% t-SNE X = [x' y' z']; Y = tsne(X);
プロットしました。
% plot figure(1); clf subplot(121) scatter3(x,y,z,10,c,'filled') axis equal; view([50,50]) title('Original swiss roll') subplot(122) scatter(Y(:,1),Y(:,2),10,c,'filled') title('t-SNE on swiss roll')
開けたのか微妙な感じではありますが、tsne 関数が用意されているので実装は簡単ですね。
Isomap で開いてみた例はこちら ↓