diff options
author | Jan Klemkow <j.klemkow@wemelug.de> | 2012-05-07 17:54:54 +0200 |
---|---|---|
committer | Jan Klemkow <j.klemkow@wemelug.de> | 2012-05-07 17:54:54 +0200 |
commit | ad3ddb368e83fdd93426eb8d9433ecaaef526925 (patch) | |
tree | e9a22a9c00f2f5c7d26061a9d2512b753943af97 | |
parent | 9673ff90c642d0344238d710b7c7501c48d43931 (diff) | |
download | dmc-ad3ddb368e83fdd93426eb8d9433ecaaef526925.tar.gz dmc-ad3ddb368e83fdd93426eb8d9433ecaaef526925.tar.bz2 dmc-ad3ddb368e83fdd93426eb8d9433ecaaef526925.zip |
Calculate errors in seperate function and plot error graph.
-rw-r--r-- | calc_error.m | 13 | ||||
-rw-r--r-- | run_tests.m | 19 |
2 files changed, 19 insertions, 13 deletions
diff --git a/calc_error.m b/calc_error.m new file mode 100644 index 0000000..1f525ba --- /dev/null +++ b/calc_error.m @@ -0,0 +1,13 @@ +function calc_error(data, pred) + + quad = quad_error(data, pred); + total = total_error(data, pred); + + printf('quad mean : %9d\n', quad); + printf('total mean : %9d\n', total); + + plot((sum(abs(data - pred))), 'b'); + hold on; + plot(sort(sum(abs(data - pred))), 'r'); + hold off; +end diff --git a/run_tests.m b/run_tests.m index 4f56094..031dd82 100644 --- a/run_tests.m +++ b/run_tests.m @@ -1,16 +1,9 @@ [p, q] = get_products(); -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); +% quantity sum over a day +plot(sum(q')); -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); - -quad = quad_error(q(29:42, :), repmat(sevenday_pred(q(1:28, :), 4), 2, 1)); -total = total_error(q(29:42, :), repmat(sevenday_pred(q(1:28, :), 4), 2, 1)); -printf('quad sevenday : %9d\n', quad); -printf('total sevenday: %9d\n', total); +% plot prediction quallity +calc_error(q(29:42, :), mean_pred(q(1:28, :), 14)); +calc_error(q(29:42, :), regress_pred(p, q(1:28, :))); +calc_error(q(29:42, :), repmat(sevenday_pred(q(1:28, :), 4), 2, 1)); |