Skip to content

Commit

Permalink
✅ Add OCSB test
Browse files Browse the repository at this point in the history
  • Loading branch information
LuizFCDuarte committed Jun 11, 2024
1 parent 77de6a9 commit 46fce63
Show file tree
Hide file tree
Showing 4 changed files with 164 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
150 changes: 150 additions & 0 deletions test/datasets/series_38351.json
Original file line number Diff line number Diff line change
@@ -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
]
}
10 changes: 10 additions & 0 deletions test/models/sarima_fit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ using Statistics
using Test
using Random
using TimeSeries
using Revise
using JSON

# Testes dos modelos
include("models/sarima.jl")
Expand Down

0 comments on commit 46fce63

Please sign in to comment.