From b0e25fbd55c8db08ec0e508c71c5142fe45a6c96 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Sat, 12 May 2012 14:06:40 +0200 Subject: Implement calc_error and total_error as anonymous functions --- calc_error.m | 3 +++ 1 file changed, 3 insertions(+) (limited to 'calc_error.m') diff --git a/calc_error.m b/calc_error.m index bedee9e..90b3dd9 100644 --- a/calc_error.m +++ b/calc_error.m @@ -1,5 +1,8 @@ function [quad, total, local] = calc_error(name, data, pred) + quad_error = @(a, b) sqrt(sum(sum((a - b) .^ 2))); + total_error = @(a, b) sum(sum(abs(a - b))); + quad = quad_error(data, round(pred)); total = total_error(data, round(pred)); local = sum(abs(data - round(pred))); -- cgit