function good = shattersample(X) % can we shatter the sample X? Should be able to global NODISPLAY NODISPLAY = 1; N = length(X); G = zeros(N); for i=1:N for j=1:N xi = X{i}; xj = X{j}; G(i,j) = ptker2(xi,xj); end end tic PROGstart(2^N) for i=2:2^N-1 Y = zeros(N,1); ystr = dec2bin(i-1,N); ii1 = find(ystr=='1'); Y(ii1) = ones(length(ii1),1); Y = 2*Y - 1; H = G .* (Y*Y'); [nsv, alpha, b0] = svc_gram(H,Y); %ii=find(alpha>0); %aa=alpha(ii).*Y(ii); %y_hat = compute_yhat_gram(H,[1:N],aa,b0); y_hat = sign(b0 + H*(Y.*alpha)); good = all(Y==y_hat); if ~good save PTFAIL X Y keyboard end PROGupdate(i); %fprintf(' %1.9f done; seconds = %1.5f \n',i/2^N,toc); end PROGend; NODISPLAY = 0; return function y_hat = compute_yhat_gram(G,xii,alpha,b) GX = G(:,xii); y_hat = sign(b + GX*alpha); return nx = length(xii); % for how many x's are we evaluating? y_hat = zeros(nx,1); for n=1:nx j = xii(n); Gj = G(:,j); s = b + alpha'*Gj; %s = b; %for i=1:length(alpha) % s = s + alpha(i) * G(i,j); %end y_hat(n) = sign(s); end return