function yout = nb(Xphi,yt,t,N,ss,p)

if nargin<4 N  = 400;  end;   % training set
if nargin<5 ss = 100;  end;   % regularization set
if nargin<6 p  = .516;  end;   % prior --> P(y=1)


% ---- set the training set
Xtr = Xphi(1:N,:);
Xte = Xphi(N+1:size(Xphi,1),:);

ytr = yt(1:N);
yte = yt(N+1:size(yt,1));
tte = t(N+1:size(t,1));

% ---- run LOOCV
%[cv,perr] = crossvalid(Xphi,yt,ss,p);

% ---- train and predict
[theta,prior] = nbtrain(Xtr,ytr,ss,p);
yres = nbpredict(theta,prior,Xte,yte);

%       (compute additional metrics)
yerr = mean(yres(:,4));
miss = yres(find(yres(:,4)),:);

llike=0;
for i=1:size(yres,1)
   llike   = llike + (yres(i,3)*log2(yres(i,1)) ...
                   + (1-yres(i,3))*log2((1-yres(i,1))));
end;

yout{1} = yres;
yout{2} = [llike yerr];
yout{3} = miss;
yout{4} = tte(find(yres(:,4)));
yout{5} = find(yres(:,4));

% % ---- test regularization parameters
% i=1;
% j=1;
% for ss=1:10:600
%     for p=.3:.05:.6
%         [theta,prior] = nbtrain(Xtr,ytr,ss,p);
%         yres = nbpredict(theta,prior,Xte,yte);
%         yout(i,j) = mean(yres(:,4));
%         i=i+1;
%     end;
%    j=j+1;
% end;