load yeasttotaldata;
datalabel = textdata(:,end);
classname = {
'CYT'
'NUC'
'MIT'
'ME3'
'ME2'
'ME1'
'EXC'
'VAC'
'POX'
'ERL'
}
numclasses = length(classname);
classlabel = 1:numclasses;
vector_yeastlabel = zeros(length(textdata),1);
for i = 1:numclasses
vector_yeastlabel(:,i) = strcmp(datalabel,classname{i}); end
class_elenum = sum(vector_yeastlabel,1);
[~,label] = max(vector_yeastlabel,[],2);
indices = crossvalind('Kfold',length(data),4);
select_train = ~(indices==1);
select_test = ~select_train;
% newpr(,vector_species(:,select_train),select_model);
train_data = data(select_train,:);
test_data = data(select_test,:);
train_labels = label(select_train,:);
test_labels = label(select_test,:);
[C,err,P,logp,coeff] = classify(test_data,train_data,...
train_labels,'linear');
correct_rate = sum(C==test_labels) / length(C);
correct_rate