csci5521/assignments/hwk02/Error_Rate.m

17 lines
399 B
Mathematica
Raw Permalink Normal View History

2023-10-12 23:51:06 +00:00
% implements Error_Rate, returns nothing but prints the percentage of
% predicted labels that are incorrrect.
function [] = Error_Rate(predictions, labels)
2023-10-22 04:32:00 +00:00
% compute error rate and print it out
c = 0;
[total_rows, ~] = size(predictions);
for i = 1:total_rows
2023-10-25 13:32:53 +00:00
if predictions(i) ~= labels(i)
2023-10-25 10:20:44 +00:00
c = c + 1;
end
2023-10-22 04:32:00 +00:00
end
2023-10-25 10:20:44 +00:00
fprintf('%d%% ', 100 * c / total_rows);
2023-10-12 23:51:06 +00:00
end % Function end