Skip to content

Commit 7bb7f2f

Browse files
Merge pull request #50 from LAMPSPUC/add_cycle
add cycle component
2 parents 6b5b19f + 1338118 commit 7bb7f2f

File tree

9 files changed

+725
-128
lines changed

9 files changed

+725
-128
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ paper_tests/mv_probabilistic_forecast/
1313
docs/build
1414
longhorizon/
1515
test.jl
16-
test_ms.jl
16+
test_ms.jl
17+
new/
18+
test2.jl

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
name = "StateSpaceLearning"
22
uuid = "971c4b7c-2c4e-4bac-8525-e842df3cde7b"
33
authors = ["andreramosfc <[email protected]>"]
4-
version = "1.3.2"
4+
version = "1.4.0"
55

66
[deps]
77
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
88
GLMNet = "8d5ece8b-de18-5317-b113-243142960cc6"
99
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1010
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
11+
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1112
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1213
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1314

@@ -20,4 +21,5 @@ PlotsExt = "Plots"
2021
[compat]
2122
Distributions = "0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25"
2223
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"
24+
SparseArrays = "^1.0.0"
2325
julia = "1"

paper_tests/m4_test/m4_test.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ function append_results(filepath, results_df)
2525
if isfile(filepath)
2626
df_old = CSV.read(filepath, DataFrame)
2727
results_df = vcat(df_old, results_df)
28+
@info "MASE avg = $(mean(results_df[:, :MASE]))"
29+
@info "sMAPE avg = $(mean(results_df[:, :sMAPE]))"
2830
end
2931
return CSV.write(filepath, results_df)
3032
end
@@ -139,5 +141,3 @@ end
139141
create_dirs()
140142

141143
main()
142-
143-
#run_config(DataFrame(), false, "aic", 0.1, true, 2794)#max sample size

paper_tests/m4_test/m4_test.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
import statsmodels.api as sm
44
import numpy as np
55

6-
df_train = pd.read_csv("paper_tests/m4_test/Monthly-train.csv")
6+
df_train1 = pd.read_csv("paper_tests/m4_test/Monthly-train1.csv")
7+
df_train2 = pd.read_csv("paper_tests/m4_test/Monthly-train2.csv")
8+
df_train3 = pd.read_csv("paper_tests/m4_test/Monthly-train3.csv")
9+
df_train4 = pd.read_csv("paper_tests/m4_test/Monthly-train4.csv")
10+
df_train = pd.concat([df_train1, df_train2, df_train3, df_train4])
11+
m4_info = pd.read_csv("paper_tests/m4_test/M4-info.csv")
712
df_test = pd.read_csv("paper_tests/m4_test/Monthly-test.csv")
813
ssl_init_df = pd.read_csv("paper_tests/m4_test/init_SSL/SSL_aic_0.1_false.csv")
914

src/StateSpaceLearning.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module StateSpaceLearning
22

3-
using LinearAlgebra, Statistics, GLMNet, Distributions
3+
using LinearAlgebra, Statistics, GLMNet, Distributions, SparseArrays
44

55
abstract type StateSpaceLearningModel end
66

src/fit_forecast.jl

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,7 @@ function forecast(
121121
@assert size(Exogenous_Forecast, 1) == steps_ahead "Exogenous_Forecast must have the same number of rows as steps_ahead"
122122

123123
Exogenous_X = model.X[:, exog_idx]
124-
complete_matrix = create_X(
125-
model.level,
126-
model.stochastic_level,
127-
model.trend,
128-
model.stochastic_trend,
129-
model.seasonal,
130-
model.stochastic_seasonal,
131-
model.freq_seasonal,
132-
model.outlier,
133-
model.ζ_ω_threshold,
134-
Exogenous_X,
135-
steps_ahead,
136-
Exogenous_Forecast,
137-
)
124+
complete_matrix = create_X(model, Exogenous_X, steps_ahead, Exogenous_Forecast)
138125

139126
if typeof(model.output) == Output
140127
return AbstractFloat.(

0 commit comments

Comments
 (0)