From 46fce63470cd6e9ba475f60ca59dd655bd969870 Mon Sep 17 00:00:00 2001 From: LuizFCDuarte Date: Mon, 10 Jun 2024 21:53:11 -0300 Subject: [PATCH] :white_check_mark: Add OCSB test --- Project.toml | 3 +- test/datasets/series_38351.json | 150 ++++++++++++++++++++++++++++++++ test/models/sarima_fit.jl | 10 +++ test/runtests.jl | 2 + 4 files changed, 164 insertions(+), 1 deletion(-) create mode 100644 test/datasets/series_38351.json diff --git a/Project.toml b/Project.toml index 9e0d203..1c4af74 100644 --- a/Project.toml +++ b/Project.toml @@ -28,6 +28,7 @@ TimeSeries = "9e3dc215-6440-5c97-bce1-76c03772f85e" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" [targets] -test = ["Test", "JSON"] +test = ["Test","JSON"] diff --git a/test/datasets/series_38351.json b/test/datasets/series_38351.json new file mode 100644 index 0000000..c0cca0d --- /dev/null +++ b/test/datasets/series_38351.json @@ -0,0 +1,150 @@ +{ + "test": [ + 2570, + 2550, + 1920, + 1730, + 1450, + 1320, + 1170, + 1110, + 1240, + 1550, + 1810, + 2090, + 2380, + 2360, + 1830, + 1700, + 1460, + 1330 + ], + "train": [ + 1070, + 1040, + 1130, + 1380, + 1520, + 1810, + 2140, + 2130, + 1590, + 1430, + 1320, + 1250, + 1090, + 1030, + 1130, + 1360, + 1530, + 1870, + 2200, + 2220, + 1620, + 1510, + 1380, + 1320, + 1140, + 1080, + 1190, + 1390, + 1580, + 1910, + 2230, + 2230, + 1650, + 1510, + 1350, + 1300, + 1100, + 1060, + 1180, + 1400, + 1630, + 1910, + 2280, + 2240, + 1640, + 1520, + 1340, + 1280, + 1080, + 1040, + 1150, + 1350, + 1580, + 1840, + 2230, + 2190, + 1740, + 1480, + 1320, + 1280, + 1050, + 1010, + 1120, + 1370, + 1540, + 1830, + 2250, + 2210, + 1720, + 1490, + 1310, + 1280, + 1060, + 1030, + 1140, + 1390, + 1570, + 1880, + 2310, + 2280, + 1630, + 1520, + 1340, + 1270, + 1100, + 1070, + 1200, + 1410, + 1600, + 1960, + 2360, + 2340, + 1720, + 1540, + 1350, + 1360, + 1170, + 1110, + 1250, + 1470, + 1640, + 2010, + 2500, + 2410, + 1800, + 1630, + 1470, + 1420, + 1220, + 1160, + 1280, + 1500, + 1710, + 2030, + 2520, + 2470, + 1820, + 1640, + 1480, + 1430, + 1250, + 1190, + 1270, + 1520, + 1750, + 2070 + ] +} \ No newline at end of file diff --git a/test/models/sarima_fit.jl b/test/models/sarima_fit.jl index 86370ad..d6094af 100644 --- a/test/models/sarima_fit.jl +++ b/test/models/sarima_fit.jl @@ -88,4 +88,14 @@ end @test ARcoeff ≈ modelBILEVEL.ϕ atol = 1e-3 @test seasCoeff ≈ modelBILEVEL.Φ[1] atol = 1e-3 end + + @testset "fit M4 series" begin + test_series_json = JSON.parsefile("datasets/series_38351.json") + train_dict = Dict{String,Vector{Float64}}("train" => test_series_json["train"]) + test_series_df = DataFrame(train_dict) + series = loadDataset(test_series_df) + autoModel = auto(series; seasonality = 12, seasonalIntegrationTest="ocsb", assertStationarity=true, assertInvertibility=true) + @test autoModel.d == 1 + @test autoModel.D == 1 + end end \ No newline at end of file diff --git a/test/runtests.jl b/test/runtests.jl index aa079a4..4a5529b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -6,6 +6,8 @@ using Statistics using Test using Random using TimeSeries +using Revise +using JSON # Testes dos modelos include("models/sarima.jl")