Skip to content

Commit 483666a

Browse files
author
andre_ramos
committed
add multiple seasonality feature
1 parent edc4297 commit 483666a

24 files changed

+2025
-318
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ paper_tests/mv_probabilistic_forecast/
1212

1313
docs/build
1414
longhorizon/
15-
test.jl
15+
test.jl
16+
test_ms.jl

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"liveServer.settings.port": 5501
3+
}

Project.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1111
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1212
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1313

14+
[weakdeps]
15+
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
16+
17+
[extensions]
18+
PlotsExt = "Plots"
19+
1420
[compat]
15-
GLMNet = "0.5.0, 0.5.1, 0.5.2, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.7.4"
1621
Distributions = "0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25"
22+
GLMNet = "0.5.0, 0.5.1, 0.5.2, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.7.4"
1723
julia = "1"

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Current features include:
5656
Quick example of fit and forecast for the air passengers time-series.
5757

5858
```julia
59+
using StateSpaceLearning
5960
using CSV
6061
using DataFrames
6162
using Plots
@@ -69,20 +70,15 @@ fit!(model)
6970
prediction_log = StateSpaceLearning.forecast(model, steps_ahead) # arguments are the output of the fitted model and number of steps ahead the user wants to forecast
7071
prediction = exp.(prediction_log)
7172

72-
plot(airp.passengers, w=2 , color = "Black", lab = "Historical", legend = :outerbottom)
73-
plot!(vcat(ones(length(log_air_passengers)).*NaN, prediction), lab = "Forecast", w=2, color = "blue")
73+
plot_point_forecast(airp.passengers, prediction)
7474
```
7575
![quick_example_airp](./docs/src/assets/quick_example_airp.PNG)
7676

7777
```julia
7878
N_scenarios = 1000
7979
simulation = StateSpaceLearning.simulate(model, steps_ahead, N_scenarios) # arguments are the output of the fitted model, number of steps ahead the user wants to forecast and number of scenario paths
8080

81-
plot(airp.passengers, w=2 , color = "Black", lab = "Historical", legend = :outerbottom)
82-
for s in 1:N_scenarios-1
83-
plot!(vcat(ones(length(log_air_passengers)).*NaN, exp.(simulation[:, s])), lab = "", α = 0.1 , color = "red")
84-
end
85-
plot!(vcat(ones(length(log_air_passengers)).*NaN, exp.(simulation[:, N_scenarios])), lab = "Scenarios Paths", α = 0.1 , color = "red")
81+
plot_scenarios(airp.passengers, exp.(simulation))
8682

8783
```
8884
![airp_sim](./docs/src/assets/airp_sim.svg)
@@ -103,7 +99,7 @@ fit!(model)
10399

104100
level = model.output.components["μ1"]["Values"] + model.output.components["ξ"]["Values"]
105101
slope = model.output.components["ν1"]["Values"] + model.output.components["ζ"]["Values"]
106-
seasonal = model.output.components["γ1"]["Values"] + model.output.components["ω"]["Values"]
102+
seasonal = model.output.components["γ1_12"]["Values"] + model.output.components["ω_12"]["Values"]
107103
trend = level + slope
108104

109105
plot(trend, w=2 , color = "Black", lab = "Trend Component", legend = :outerbottom)

0 commit comments

Comments
 (0)