X-Git-Url: https://git.auder.net/?p=talweg.git;a=blobdiff_plain;f=pkg%2Ftests%2Ftestthat%2Ftest-Forecaster.R;fp=pkg%2Ftests%2Ftestthat%2Ftest-Forecaster.R;h=b961c684da7fa3061ac67c079870cf7f1d0fd07b;hp=3f5cf9cc7f7aeff5bf371056d257ab769891485e;hb=81cb8b9e38ae82f2c108f11df56d53c9e29366ed;hpb=a3344f7591f6f4b3d337a69e4a568e9b16e33415 diff --git a/pkg/tests/testthat/test-Forecaster.R b/pkg/tests/testthat/test-Forecaster.R index 3f5cf9c..b961c68 100644 --- a/pkg/tests/testthat/test-Forecaster.R +++ b/pkg/tests/testthat/test-Forecaster.R @@ -9,7 +9,7 @@ pred_order = c(7,1:6) #will facilitate tests test_that("Average method behave as expected", { - pred00_z = computeForecast(data_p, indices, "Average", "Zero", 1, Inf, 24, ncores=1) + pred00_z = computeForecast(data_p, indices, "Average", "LastValue", 1, Inf, 24, ncores=1) pred00_p = computeForecast(data_p, indices, "Average", "Persistence", 1, Inf, 24) for (i in 1:7) { @@ -22,7 +22,7 @@ test_that("Average method behave as expected", #NOTE: 24h-block become #1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 (14h-->0h then 1h-->13h) #No jump between days, thus zero and persistence are equivalent (and correct) - pred13_z = computeForecast(data_p, indices, "Average", "Zero", 14, Inf, 24) + pred13_z = computeForecast(data_p, indices, "Average", "LastValue", 14, Inf, 24) pred13_p = computeForecast(data_p, indices, "Average", "Persistence", 14, Inf, 24) for (i in 1:7) { @@ -40,9 +40,9 @@ test_that("Average method behave as expected", test_that("Persistence method behave as expected", { #Situation A: +Zero; (generally) correct if jump, wrong otherwise - pred00_sd = computeForecast(data_p, indices, "Persistence", "Zero", 1, Inf, 24, + pred00_sd = computeForecast(data_p, indices, "Persistence", "LastValue", 1, Inf, 24, ncores=1, same_day=TRUE) - pred00_dd = computeForecast(data_p, indices, "Persistence", "Zero", 1, Inf, 24, + pred00_dd = computeForecast(data_p, indices, "Persistence", "LastValue", 1, Inf, 24, ncores=1, same_day=FALSE) for (i in 1:7) { @@ -50,9 +50,9 @@ test_that("Persistence method behave as expected", expect_equal(pred00_dd$getForecast(i), rep(pred_order[i],24)) } - pred13_sd = computeForecast(data_p, indices, "Persistence", "Zero", 14, Inf, 24, + pred13_sd = computeForecast(data_p, indices, "Persistence", "LastValue", 14, Inf, 24, ncores=1, same_day=TRUE) - pred13_dd = computeForecast(data_p, indices, "Persistence", "Zero", 14, Inf, 24, + pred13_dd = computeForecast(data_p, indices, "Persistence", "LastValue", 14, Inf, 24, ncores=1, same_day=FALSE) for (i in 1:7) { @@ -96,12 +96,12 @@ test_that("Persistence method behave as expected", test_that("Neighbors method behave as expected", { #Situation A: +Zero; correct if jump, wrong otherwise - pred00 = computeForecast(data_p, indices, "Neighbors", "Zero", 1, Inf, 24, + pred00 = computeForecast(data_p, indices, "Neighbors", "LastValue", 1, Inf, 24, simtype="mix", local=FALSE, window=c(1,1)) for (i in 1:7) expect_equal(pred00$getForecast(i), rep(pred_order[i],24)) - pred13 = computeForecast(data_p, indices, "Persistence", "Zero", 14, Inf, 24, + pred13 = computeForecast(data_p, indices, "Persistence", "LastValue", 14, Inf, 24, simtype="mix", local=FALSE, window=c(1,1)) for (i in 1:7) expect_equal(pred13$getForecast(i), rep(i,24) )