%spiral SVC dlpc comparison

delfigs

n = 100;
x = [1:n]'/[n/25];
r=2.^([1:n]'*(0.04*200/n));
a = prdataset([sin(x).*r cos(x).*r]);
b = setlabels([a; -a],genlab([n n]));

scatterd(b);
axis equal
axis([-245 245 -245 245])
title('Total dataset')
xlabel('x')
ylabel('y')
fontsize(14)
set(gca,'ytick',[-200 -100 0 100 200])
%figsave('spiral_full')

x = b([1:2:end],:), y = b([2:2:end],:)

figure;
scatterd(b);
axis equal
axis([-12 12 -12 12])
title('Zoomed dataset')
xlabel('x')
ylabel('y')
fontsize(14)
set(gca,'ytick',[-10 -5 0 5 10])
set(gca,'xtick',[-10 -5 0 5 10])
%figsave('spiral_zoom')

u=proxm(x,'d'); v = u*fisherc(x*u); y*v*testc
figure;
scatterd(x)
axis equal
axis([-245 245 -245 245])
gridsize(200)
plotc(v)
title('Fisher in dis. space')
xlabel('x')
ylabel('y')
fontsize(14)
set(gca,'ytick',[-200 -100 0 100 200])
%figsave('spiral_fisher_full')

figure;
scatterd(x);
gridsize(200)
axis equal
axis([-12 12 -12 12])
plotc(v);
title('Fisher in dis. space')
xlabel('x')
ylabel('y')
fontsize(14)
set(gca,'ytick',[-10 -5 0 5 10])
set(gca,'xtick',[-10 -5 0 5 10])
%figsave('spiral_fisher_zoom')

v=svc(x,'r',2)
figure;
scatterd(x)
gridsize(200)
axis equal
axis([-245 245 -245 245])
plotc(v)
title('Optimized RB SVM')
xlabel('x')
ylabel('y')
fontsize(14)
set(gca,'ytick',[-200 -100 0 100 200])
%figsave('spiral_svc_full')

figure;
scatterd(x);
gridsize(200)
axis equal
axis([-12 12 -12 12])
plotc(v);
title('Optimized RB SVM')
xlabel('x')
ylabel('y')
fontsize(14)
set(gca,'ytick',[-10 -5 0 5 10])
set(gca,'xtick',[-10 -5 0 5 10])
%figsave('spiral_svc_zoom')

showfigs