function Y=logist_phi_response(phi,w,b)
  C=length(phi);
  n=size(phi{1},1);
  kall=length(w);
  ks=cellfun('size',phi,2);k2=[0;cumsum(ks(:))];
  assert(k2(end)==kall);

  % compute u and mu
  u=zeros(n,C);
  mu=zeros(n,C);
  for i=1:C
    u(:,i)=phi{i}*w(k2(i)+1:k2(i+1))+b(i);
  end
  u=u-repmat(max(u,[],2),1,C);  % to avoid getting exp(u)=Inf
  expu=exp(u);
  mu=expu./repmat(sum(expu,2),1,C);
  assert(norm(sum(mu,2)-1)<1E-3);
  [dum,Y]=max(mu,[],2);