summaryrefslogtreecommitdiff
path: root/calc_error.m
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-05-12 14:06:40 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-05-12 14:06:40 +0200
commitb0e25fbd55c8db08ec0e508c71c5142fe45a6c96 (patch)
tree24c5e4827d2dd3778eb07c4407a5820c78345ddd /calc_error.m
parent0cb152041b0f658e9acd7cbfac19509c037a7366 (diff)
downloaddmc-b0e25fbd55c8db08ec0e508c71c5142fe45a6c96.tar.gz
dmc-b0e25fbd55c8db08ec0e508c71c5142fe45a6c96.tar.bz2
dmc-b0e25fbd55c8db08ec0e508c71c5142fe45a6c96.zip
Implement calc_error and total_error as anonymous functions
Diffstat (limited to 'calc_error.m')
-rw-r--r--calc_error.m3
1 files changed, 3 insertions, 0 deletions
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)));