Reputation:
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?
Upvotes: 0
Views: 683
Reputation:
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
The loop checks the variance of each column. The values with low variance are then deleted by:
dbimgs1(:,delete_id_1(i))=[];
Upvotes: 0