function [Est,al]=lrLearnU(y,x)
  // [Est,al]=lrLearn(y,x)    learning of Mixture logistic
  //                          regression model - pyrymida
  // y    class label (column - nd x 1)
  // x    data vectors (vectors in rows - nd x nx)
  // Est  estimation structure
  // al   stationary probs.

  nc=max(y);
  n1=min(y);
  if n1~=1, 
    disp('Error: y must start with 1'); 
    return
  end
  for i=1:nc
    c=find(y==i);
    Y=y(c);
    X=x(c,:);
    thU=max(X,'r');
    thL=min(X,'r');
    Est(i).thL=thL;
    Est(i).thU=thU;
    Est(i).Cen=(thL+thU)/2;
    Est(i).Bas=prod(thU-thL); // normaizing constant od distribution
    ga(i)=length(Y);          // number of data in a component
  end
  al=ga/sum(ga);
endfunction
