%% generate data
prettySpiral = true;
if ~prettySpiral
% generate some random
gaussian like data
rand('state', 0);
randn('state', 0);
N= 50;
D= 2;
X1 = mgd(N, D, [4 3], [2
-1;-1 2]);
X2 = mgd(N, D, [1 1], [2 1;1
1]);
X3 = mgd(N, D, [3 -3], [1 0;0
4]);
X= [X1; X2; X3];
X= bsxfun(@rdivide,
bsxfun(@minus, X, mean(X)), var(X));
Y= [ones(N, 1); ones(N, 1)*2;
ones(N, 1)*3];
scatter(X(:,1), X(:,2), 20,
Y)
else
% generate twirl data!
N= 50;
t = linspace(0.5, 2*pi,
N);
x = t.*cos(t);
y = t.*sin(t);
t = linspace(0.5, 2*pi,
N);
x2 = t.*cos(t+2);
y2 = t.*sin(t+2);
t = linsp