summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Klemkow <j.klemkow@wemelug.de>2012-05-07 00:31:26 +0200
committerJan Klemkow <j.klemkow@wemelug.de>2012-05-07 00:31:26 +0200
commiteffe95641d24a389bd11b14f5f4bdc5286ba0408 (patch)
treee9ed64b8710317f63759a5ebb0476ba98f082768
parentdcbe7e13245eee0f0266f1549504a3bdc392a851 (diff)
downloaddmc-effe95641d24a389bd11b14f5f4bdc5286ba0408.tar.gz
dmc-effe95641d24a389bd11b14f5f4bdc5286ba0408.tar.bz2
dmc-effe95641d24a389bd11b14f5f4bdc5286ba0408.zip
Add total error calculation.
-rw-r--r--run_tests.m11
-rw-r--r--total_error.m5
2 files changed, 14 insertions, 2 deletions
diff --git a/run_tests.m b/run_tests.m
index e2975cc..52f7f05 100644
--- a/run_tests.m
+++ b/run_tests.m
@@ -1,3 +1,10 @@
[p, q] = get_products();
-meanerr = quad_error(q(29:42, :), mean_pred(q(1:28, :), 14))
-regresserr = quad_error(p(29:42, :), regress_pred(p, q(1:28, :)))
+quad = quad_error(q(29:42, :), mean_pred(q(1:28, :), 14));
+total = total_error(q(29:42, :), mean_pred(q(1:28, :), 14));
+printf('quad mean : %9d\n', quad);
+printf('total mean : %9d\n', total);
+
+quad = quad_error(p(29:42, :), regress_pred(p, q(1:28, :)));
+total = total_error(p(29:42, :), regress_pred(p, q(1:28, :)));
+printf('quad regress : %9d\n', quad);
+printf('total regress: %9d\n', total);
diff --git a/total_error.m b/total_error.m
new file mode 100644
index 0000000..78fac56
--- /dev/null
+++ b/total_error.m
@@ -0,0 +1,5 @@
+function err = total_error(a, b)
+
+ err = sum(sum(abs(a - b)));
+
+endfunction