summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--run_tests.m22
1 files changed, 11 insertions, 11 deletions
diff --git a/run_tests.m b/run_tests.m
index 57cb722..da1f7d9 100644
--- a/run_tests.m
+++ b/run_tests.m
@@ -6,26 +6,26 @@
train_data = q( 1:28, :);
real_data = q(29:42, :);
-pred_methods = {
- { 'mean', @mean_pred },
- { 'regress', @regress_pred },
- { 'quad', @quad_regress_pred },
- { 'log reg.', @log_regress_pred },
- { 'sevenday' @sevenday_pred },
- { 'random' @rand_pred },
- { 'regress2' @regress_frequency_removal }
-};
+pred_methods = [
+ struct('name', 'mean', 'func', @mean_pred )
+ struct('name', 'regress', 'func', @regress_pred )
+ struct('name', 'quad', 'func', @quad_regress_pred )
+ struct('name', 'log reg.', 'func', @log_regress_pred )
+ struct('name', 'sevenday', 'func', @sevenday_pred )
+ struct('name', 'random', 'func', @rand_pred )
+ struct('name', 'regress2', 'func', @regress_frequency_removal )
+];
num_methods = size(pred_methods, 1);
pred_list = {};
for i = 1:num_methods
- pred_list{i} = pred_methods{i}{2}(p, train_data);
+ pred_list{i} = pred_methods(i).func(p, train_data);
end
qerr = terr = zeros(1, num_methods);
err = zeros(num_methods, size(real_data,2));
for i = 1:num_methods
- [qerr(i), terr(i), err(i, :)] = calc_error(pred_methods{i}{1}, real_data, pred_list{i});
+ [qerr(i), terr(i), err(i, :)] = calc_error(pred_methods(i).name, real_data, pred_list{i});
end
opt_data = opt_pred(real_data, pred_list);