summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Klemkow <j.klemkow@wemelug.de>2012-05-10 13:41:44 +0200
committerJan Klemkow <j.klemkow@wemelug.de>2012-05-10 13:41:44 +0200
commit88ffa1b0209419f3eddd55312f80fbd93de033a3 (patch)
treea6dd7dc45ec9a2b8334ab7181ea4458712f6606a
parentaf4d8f4f38f5da8f98c9c40bcb84d2d8e994b154 (diff)
downloaddmc-88ffa1b0209419f3eddd55312f80fbd93de033a3.tar.gz
dmc-88ffa1b0209419f3eddd55312f80fbd93de033a3.tar.bz2
dmc-88ffa1b0209419f3eddd55312f80fbd93de033a3.zip
run_tests: Code clean up.
-rw-r--r--run_tests.m22
1 files changed, 16 insertions, 6 deletions
diff --git a/run_tests.m b/run_tests.m
index 358c6dc..5d06086 100644
--- a/run_tests.m
+++ b/run_tests.m
@@ -3,14 +3,24 @@
% quantity sum over a day
%plot(sum(q'));
+train_data = q( 1:28, :);
+real_data = q(29:42, :);
+
+mean_data = mean_pred(train_data, 14);
+regress_data = regress_pred(p, train_data);
+quad_data = quad_regress_pred(p, train_data);
+log_data = log_regress_pred(p, train_data);
+sevenday_data = repmat(sevenday_pred(train_data, 4), 2, 1);
+random_data = rand_pred(train_data, 14);
+
% plot prediction quallity
-calc_error('mean', q(29:42, :), mean_pred(q(1:28, :), 14));
-calc_error('regress', q(29:42, :), regress_pred(p, q(1:28, :)));
+calc_error('mean', real_data, mean_data);
+calc_error('regress', real_data, regress_data);
% quadratic just for reference, it sucks more than mean-predicition
-calc_error('quad regress', q(29:42, :), quad_regress_pred(p, q(1:28, :)));
-calc_error('log regress', q(29:42, :), log_regress_pred(p, q(1:28, :)));
-calc_error('sevenday', q(29:42, :), repmat(sevenday_pred(q(1:28, :), 4), 2, 1));
-calc_error('random', q(29:42, :), rand_pred(q(1:28, :), 14));
+calc_error('quad reg.', real_data, quad_data);
+calc_error('log reg.', real_data, log_data);
+calc_error('sevenday', real_data, sevenday_data);
+calc_error('random', real_data, random_data);
[q2, removed] = remove_sevenday_frequency(q(1:14, :));
tmp = regress_pred(p([1:14 29:42],:), q2);