summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-05-11 09:30:42 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-05-11 09:30:42 +0200
commitccae14cc315c735450a63faeeaab3d8c0a6a05a5 (patch)
treebb9277c1a88e145f94aaa9f96090c812636c5013
parent39e62a38bf8725dba7c044f2395d5307a26ded08 (diff)
downloaddmc-ccae14cc315c735450a63faeeaab3d8c0a6a05a5.tar.gz
dmc-ccae14cc315c735450a63faeeaab3d8c0a6a05a5.tar.bz2
dmc-ccae14cc315c735450a63faeeaab3d8c0a6a05a5.zip
Add sevenday removal algorithm to optimize-prediction
-rw-r--r--run_tests.m25
1 files changed, 13 insertions, 12 deletions
diff --git a/run_tests.m b/run_tests.m
index 0d44f1a..bee4fd0 100644
--- a/run_tests.m
+++ b/run_tests.m
@@ -14,7 +14,14 @@ lq_data = [log_data(:,1:334) quad_data(:,335) log_data(:,336:570)];
sevenday_data = repmat(sevenday_pred(train_data, 4), 2, 1);
random_data = rand_pred(train_data, 14);
-pred_list = {mean_data regress_data quad_data log_data lq_data sevenday_data random_data};
+[q2, removed] = remove_sevenday_frequency(q(1:14, :));
+regress2_data = regress_pred(p([1:14 29:42],:), q2);
+regress2_data = fft(regress2_data);
+%regress2_data = (regress2_data .* (removed == 0)) + removed;
+regress2_data = regress2_data + removed;
+regress2_data = real(ifft(regress2_data));
+
+pred_list = {mean_data regress_data quad_data log_data lq_data sevenday_data random_data regress2_data};
opt_data = opt_pred(real_data, pred_list);
@@ -28,9 +35,10 @@ opt_data = opt_pred(real_data, pred_list);
[seqerr, seterr] = calc_error('sevenday', real_data, sevenday_data);
[raqerr, raterr] = calc_error('random', real_data, random_data);
[opqerr, opterr] = calc_error('optimize', real_data, opt_data);
+[re2qerr, re2terr] = calc_error('regress2', real_data, regress2_data);
-qerr = [meqerr reqerr quqerr loqerr lqqerr seqerr raqerr opqerr];
-terr = [meterr reterr quterr loterr lqterr seterr raterr opterr];
+qerr = [meqerr reqerr quqerr loqerr lqqerr seqerr raqerr opqerr re2qerr];
+terr = [meterr reterr quterr loterr lqterr seterr raterr opterr re2terr];
bar(qerr);
bar(terr);
@@ -42,15 +50,8 @@ lq_err = sum(abs(real_data - lq_data));
sevenday_err = sum(abs(real_data - sevenday_data));
random_err = sum(abs(real_data - random_data));
opt_err = sum(abs(real_data - opt_data));
+regress2_err = sum(abs(real_data - regress2_data));
-err = [mean_err;regress_err;quad_err;log_err;lq_err;sevenday_err;random_err];
+err = [mean_err;regress_err;quad_err;log_err;lq_err;sevenday_err;random_err;regress2_err];
min_err = sum(min(err));
printf('global min. error: %d\n', min_err);
-
-[q2, removed] = remove_sevenday_frequency(q(1:14, :));
-tmp = regress_pred(p([1:14 29:42],:), q2);
-tmp = fft(tmp);
-%tmp = (tmp .* (removed == 0)) + removed;
-tmp = tmp + removed;
-tmp = real(ifft(tmp));
-calc_error('regress2', q(29:42, :), tmp);