function [predictedValue] = OneNN10by3(testset, dataset, currentPreProcessor)

% this function finds the closest instance
% then returns the predicted value
predictedValue = [];
featureSize = size(dataset,2);
testSize = size(testset,1);

if strcmp(currentPreProcessor, 'normalize') ~= 1 && strcmp(currentPreProcessor, 'log') ~= 1
    % firstly normalize the row and data
    myTempToNormalize = [testset;dataset];
    myTempToNormalize = myNormalizer(myTempToNormalize);
    % get normalized train data and replace cost with actual cost
    testset = myTempToNormalize(1:testSize,:);     % store normalized test data
    myTempToNormalize(1:testSize,:) = []; % delete test data
    dataset = myTempToNormalize;
end

% do for each test instance
for testIndex = 1:testSize
    myRow = testset(testIndex,:);
    % initially let the first instance have the best distance
    bestDist = sqrt(sum(abs(myRow(1,1:(featureSize-1)) - dataset(1,1:1:(featureSize-1))).^2));
    bestIndex = 1;
    
    % check other instances for being closest
    for i=2:size(dataset,1)
        tempDist = sqrt(sum(abs(myRow(1,1:1:(featureSize-1)) - dataset(i,1:1:(featureSize-1))).^2));
        if tempDist < bestDist
            bestDist = tempDist;
            bestIndex = i;
        end
    end
    
    % save the effort value of the closest neighbor
    predictedValue = [predictedValue dataset(bestIndex,featureSize)];
end

end