function [predictedValue] = ABE0(myRow, dataset, currentPreProcessor)

% this function finds the closest instance
% then returns the predicted value

featureSize = size(dataset,2);

% firstly normalize the row and data
if strcmp(currentPreProcessor, 'normalize') ~= 1
    myTempToNormalize = [myRow;dataset];
    myTempToNormalize = myNormalizer(myTempToNormalize);
    myRow = myTempToNormalize(1,:);     % store normalized test data
    myTempToNormalize(1,:) = [];        % delete test data
    dataset = myTempToNormalize;
end

% kValue is 5 in that case
if size(dataset,1) < 5
   kValue = size(dataset,1); 
else
    kValue = 5;
end

% below array keeps the kNN effort values
kEffort = zeros(kValue,1);

for counter = 1:kValue
    
   % initially let the first instance have the best distance
   bestDist = sqrt(sum(abs(myRow(1,1:(featureSize-1)) - dataset(1,1:(featureSize-1))).^2)); 
   bestIndex = 1; 
   
   for i=2:size(dataset,1)
       tempDist = sqrt(sum(abs(myRow(1,1:(featureSize-1)) - dataset(i,1:(featureSize-1))).^2));
       if tempDist < bestDist
          bestDist = tempDist;
          bestIndex = i;
       end
   end
   
   % save the effort value of the closest neighbor
   kEffort(counter,1) = dataset(bestIndex,featureSize);
   
   % delete the closest neighbor for the next run (if there is any)
   dataset(bestIndex,:) = [];
   
end

% return the median of the kNN
predictedValue = median(kEffort);


end