0

I am using Matlab to classify data using LDA.

  mdl = fitcdiscr(dbimgs1,indx,'DiscrimType','linear');
  C=predict(mdl,testimgs1);

I get the following error:

Predictor x741 has zero variance. Either exclude this predictor or set 'discrimType' to 'pseudoLinear' or 'diagLinear'.

I do not wish to use 'pseudoLinear' or 'diagLinear' as it degrades the performance. How can I exclude the zero predictor?

4

1 回答 1

0
  delete_id=[];
  for id_var_chk=1:size(dbimgs1,2)
      if(var(dbimgs1(:,id_var_chk))<1)
             delete_id=[delete_id,id_var_chk]
      end
  end

循环检查每列的方差。然后通过以下方式删除具有低方差的值:

 dbimgs1(:,delete_id_1(i))=[];
于 2016-05-02T11:52:20.890 回答