function Y=logist_X_response(X,w,b)
  [n,k]=size(X);
  C=length(w)/k+1;
  k2=[0:C-1]*k;
  
% compute u and mu
  u=zeros(n,C-1);
  mu=zeros(n,C);
  for i=1:C-1
    u(:,i)=X*w(k2(i)+1:k2(i+1))+b(i);
  end
  expu=exp(u);
  mu=zeros(n,C);
  mu(:,1)=1./(1+sum(expu,2));
  mu(:,2:C)=expu./repmat(1+sum(expu,2),1,C-1);
  assert(norm(sum(mu,2)-1)<1E-3);
  [dum,Y]=max(mu,[],2);