function [result_3s result_5s accuracy] = classifyTestData( test_threes, test_fives, row, col, train_threes, train_fives)
%function [result_3s result_5s] = classifyTestData( test_threes, test_fives, row, col, train_threes, train_fives)
%function that returns a matrix of results for 3s and 5s based on bayes formula applied
[lik3 lik5] = likFromTraining( row, col, train_threes, train_fives);

%Testing the three images
for img_num = 1:size( test_threes, 3)
    %Apply bayes rule
    posteriors = BayesRule( test_threes( row, col, img_num), [lik3 lik5], [.5 .5]);
    post3 = posteriors(1);
    post5 = posteriors(2);
    %If posterior of 3 is greater than posterior of 5, then this is
    %a correctly classified 3 image
    result_3s( img_num) = (post3>post5);
end
%Testing the five images
for img_num = 1:size( test_fives, 3)
    %Apply bayes rule
    posteriors = BayesRule( test_fives( row, col, img_num), [lik3 lik5], [.5 .5]);
    post3 = posteriors(1);
    post5 = posteriors(2);
    %If posterior of 5 is greater than posterior of 3, then this is
    %a correctly classified 5 image
    result_5s( img_num) = (post5>post3);
end

%Find accuracies. Sum up all cases that were correctly classified
accuracy_3 = sum(result_3s)
accuracy_5 = sum(result_5s)
%Find overall accuracy by normalizing
accuracy = (accuracy_3 + accuracy_5)/(size( test_threes, 3) + size(test_fives, 3))

