function Display(M,res,nit,w,layer_size,x,t,beta)
tp=t*0;
tp=t*0;
layer_num=numel(layer_size); %layer number include the input and output

for m=1:M
 tp(m)=w'*x(:,m); 
  tp(m)=1./(1+exp(-tp(m)*beta)); %corrected by Zongcai
% if tp(m)>=.499;tp(m)=1;end
% if tp(m)<.499;tp(m)=0;end
end

titleNN=[];
for iter =1:layer_num %%%----- N (in book) ------%%%
titleNN=[titleNN,' ',num2str(layer_size(iter))];
end

subplot(121);plot(res(2:nit));
ylabel('Avg Misfit');xlabel('Iteration #')
title({[ 'a) 1-Node: # of In+hide+out Layers =',num2str(layer_num)];...
    ['Nodes/Layer = [',titleNN,']']});
subplot(122);plot([1:M],t,'r*',[1:M],tp,'g*')
ylabel(' Example Class');xlabel('Example #')
title({['b) Obs. (red) vs Pred. (green) Classes'];...
    [ 'Nodes/Layer = [',titleNN,']']});