function decode = som_decode(sM, svm_validation_data,svm_validation_label)
% the number of hits in each map-unit.

sValD = som_data_struct(svm_validation_data,'labels',num2str(svm_validation_label));
% h   = som_hits(sM,sValD);
bmu = som_bmus(sM, sValD, 'best');

correct = 0;
nElements = length(svm_validation_label);
nBMUs = length(bmu);

for i = 1:nBMUs
    if isnan(bmu(i))
        nElements = nElements - 1;
    elseif ( cell2mat(sM.labels(bmu(i))) == cell2mat(sValD.labels(i)) )
        correct = correct + 1;
    end
end
    
decode = correct/nElements*100;
end