summaryrefslogtreecommitdiff
path: root/calc_error.m
blob: 2f7e9c616f2f0b318c069ae561856fdb69c9dd3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function [quad, total, local] = calc_error(name, data, pred)

	quad = quad_error(data, round(pred));
	total = total_error(data, round(pred));
	local = sum(abs(data - round(pred)));

	printf('%-11s quad: %d\t total: %d\n', name, quad, total);

	plot((sum(abs(data - pred))), '-ob;unsorted;');
	hold on;
	plot(sort(sum(abs(data - pred))), '-or;sorted;');
	hold off;
	xlabel('products');
	ylabel('total error');
end