title: how to improve accuracy of the following logistic regression code, which tests the accuracy using 10-fold cross-validation tchnique
body: <p>How to improve accuracy of the following logistic regression code, which tests the accuracy using 10-fold cross-validation technique.I have implemented this code using <code>glmfit</code> and <code>glmval</code>. The desired accuracy is somewhat higher and it requires the parameters to be found using maximum likelihood estimator. 
  Also when I run this code in matlab I get the following error:</p>
  
  <blockquote>
    <p>Warning: X is ill conditioned, or the model is overparameterized, and
    some coefficients are not identifiable.  You should use caution in
    making predictions.  In glmfit at 245 In LR at 8</p>
  </blockquote>
  
  <pre><code>function LR( X,y)
  y(y==-1)=0;
  X=[ones(size(X,1),1) X];
  disp(size(X,2));
  indices = crossvalind('Kfold',y,10);
  for i = 1:10
      test = (indices == i); train = ~test;
      b = glmfit(X(train,:),y(train),'binomial','logit');
      y_hat= glmval(b,X(test,:),'logit');
      y_true=y(test,:);
      error(i)=mean(abs(y_true-y_hat));
  end
  accuracy=(1-error)*100;
  fprintf('accuracy= %f +- %f\n',mean(accuracy),std(accuracy));
  end
  </code></pre>
  
  <p>please help</p>