%%%% for HCC
times = 100;
acc = zeros(times,1);
for ii = 1:times
    mdata = importdata('HCCidemodscore.txt');
    ndata = zscore(mdata');
    data = ndata';
    label = importdata('HCClabel.txt');
    kfold=crossvalind('kfold',size(data,2),5);
    class=zeros(numel(label),1);
    acc = zeros(1,max(kfold));
    for i=1:max(kfold)
        data_train=data(:,kfold~=i);
        label_train=label(kfold~=i);
        data_test=data(:,kfold==i);
        label_test=label(kfold==i);
    
        %data_train=data_train';
        %data_test=data_test';
        acc(1,i) = centroid(data_test,data_train,label_train,label_test);
    end
    accu(ii) = mean(acc);
end
ac = mean(accu)  %% 0.8407


%%%% for Breast Cancer
times = 100;
acc = zeros(times,1);
for ii = 1:times
    mdata = importdata('BreastCanceridemodscore.txt');
    ndata = zscore(mdata');
    data = ndata';
    label = importdata('BreastCancerlabel.txt');
    kfold=crossvalind('kfold',size(data,2),5);
    class=zeros(numel(label),1);
    acc = zeros(1,max(kfold));
    for i=1:max(kfold)
        data_train=data(:,kfold~=i);
        label_train=label(kfold~=i);
        data_test=data(:,kfold==i);
        label_test=label(kfold==i);
    
        %data_train=data_train';
        %data_test=data_test';
        acc(1,i) = centroid(data_test,data_train,label_train,label_test);
    end
    accu(ii) = mean(acc);
end
ac = mean(accu)  %% 0.8283



