%get the kernel weights                   
function  [theta] = MK_theta(p0,X,Y)
          
% p1 partial of positive samples will be droped in the centerlized process;

      Xp = preprocess(X);
      K_1 = TrainKernelMatrix('gaussian',1,Xp);
      K_05 = TrainKernelMatrix('gaussian',0.5,Xp);
      K_02 = TrainKernelMatrix('gaussian',0.2,Xp);
%specified initial kernels 
      True = find(Y==1);
      False = find(Y==-1);
      TrueNumber = length(True);
      FalseNumber = length(False);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%    stage   1   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%  centerlized process  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      K_1_False = K_1(Y==-1,Y==-1); 
      K_05_False = K_05(Y==-1,Y==-1); 
      K_02_False = K_02(Y==-1,Y==-1);
      K_1SumFalseTemp = sum(K_1_False);
      K_05SumFalseTemp = sum(K_05_False);
      K_02SumFalseTemp = sum(K_02_False);
      
      K_1SumFalse = sum(K_1SumFalseTemp);
      K_05SumFalse = sum(K_05SumFalseTemp);
      K_02SumFalse = sum(K_02SumFalseTemp);
      
      K_1_Mix = K_1(Y==1,Y==-1);
      K_05_Mix = K_05(Y==1,Y==-1);
      K_02_Mix = K_02(Y==1,Y==-1);
      
      K_1DistanceTrue = ones(TrueNumber,1) + K_1SumFalse/(FalseNumber*FalseNumber)*...
                         ones(TrueNumber,1) - 2*sum(K_1_Mix,2)/FalseNumber;
      K_05DistanceTrue = ones(TrueNumber,1) + K_05SumFalse/(FalseNumber*FalseNumber)*...
                             ones(TrueNumber,1) - 2*sum(K_05_Mix,2)/FalseNumber;
      K_02DistanceTrue = ones(TrueNumber,1) + K_02SumFalse/(FalseNumber*FalseNumber)*...
                              ones(TrueNumber,1) - 2*sum(K_02_Mix,2)/FalseNumber;
      DistanceTrue_temp = [K_1DistanceTrue,K_05DistanceTrue,K_02DistanceTrue];
      DistanceTrue = max(DistanceTrue_temp,[],2);
                 
% compte the distance between positive samples and center of negative samples
% DistanceN = ones(NegativeNumber,1) + SumNegative/(NegativeNumber*NegativeNumber)*...
%             ones(NegativeNumber,1) - 2*sum(Knegative,2)/NegativeNumber;
      DistanceTrueTemp = sort(DistanceTrue);
      DistanceThreshold = DistanceTrueTemp(round(p0*TrueNumber));        
      index1 = DistanceTrue > DistanceThreshold; 
      True1 = True(index1);
      c = [True1;False];   
% drop the positive samples with Distance<DistanceThreshold
      Y1 = Y(c);  
      m1 = length(c);
% multiple kernel learning procedure
      K_1_1 = K_1(c,c);
      K_05_1 = K_05(c,c);
      K_02_1 = K_02(c,c);

      global K_stack
      K_stack = [K_1_1;K_05_1;K_02_1];
      C0 = 1; 
      % regulization parameter
      train = 1:m1;
      test = 1:length(Y1);
     [Predict SKM] = learn_SKM2(C0,Y1,train,test);
     theta = SKM.etas_tilde';