summaryrefslogtreecommitdiff
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
parent0cb152041b0f658e9acd7cbfac19509c037a7366 (diff)
downloaddmc-b0e25fbd55c8db08ec0e508c71c5142fe45a6c96.tar.gz
dmc-b0e25fbd55c8db08ec0e508c71c5142fe45a6c96.tar.bz2
dmc-b0e25fbd55c8db08ec0e508c71c5142fe45a6c96.zip
Implement calc_error and total_error as anonymous functions
-rw-r--r--calc_error.m3
-rw-r--r--quad_error.m5
-rw-r--r--total_error.m5
3 files changed, 3 insertions, 10 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)));
diff --git a/quad_error.m b/quad_error.m
deleted file mode 100644
index bdf327b..0000000
--- a/quad_error.m
+++ /dev/null
@@ -1,5 +0,0 @@
-function err = quad_error(a, b)
-
- err = sqrt(sum(sum((a - b) .^ 2)));
-
-endfunction
diff --git a/total_error.m b/total_error.m
deleted file mode 100644
index 78fac56..0000000
--- a/total_error.m
+++ /dev/null
@@ -1,5 +0,0 @@
-function err = total_error(a, b)
-
- err = sum(sum(abs(a - b)));
-
-endfunction