Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ paper_tests/mv_probabilistic_forecast/
docs/build
longhorizon/
test.jl
test_ms.jl
test_ms.jl
new/
test2.jl
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name = "StateSpaceLearning"
uuid = "971c4b7c-2c4e-4bac-8525-e842df3cde7b"
authors = ["andreramosfc <[email protected]>"]
version = "1.3.2"
version = "1.4.0"

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

Expand All @@ -20,4 +21,5 @@ PlotsExt = "Plots"
[compat]
Distributions = "0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25"
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"
SparseArrays = "^1.0.0"
julia = "1"
4 changes: 2 additions & 2 deletions paper_tests/m4_test/m4_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ function append_results(filepath, results_df)
if isfile(filepath)
df_old = CSV.read(filepath, DataFrame)
results_df = vcat(df_old, results_df)
@info "MASE avg = $(mean(results_df[:, :MASE]))"
@info "sMAPE avg = $(mean(results_df[:, :sMAPE]))"
end
return CSV.write(filepath, results_df)
end
Expand Down Expand Up @@ -139,5 +141,3 @@ end
create_dirs()

main()

#run_config(DataFrame(), false, "aic", 0.1, true, 2794)#max sample size
7 changes: 6 additions & 1 deletion paper_tests/m4_test/m4_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
import statsmodels.api as sm
import numpy as np

df_train = pd.read_csv("paper_tests/m4_test/Monthly-train.csv")
df_train1 = pd.read_csv("paper_tests/m4_test/Monthly-train1.csv")
df_train2 = pd.read_csv("paper_tests/m4_test/Monthly-train2.csv")
df_train3 = pd.read_csv("paper_tests/m4_test/Monthly-train3.csv")
df_train4 = pd.read_csv("paper_tests/m4_test/Monthly-train4.csv")
df_train = pd.concat([df_train1, df_train2, df_train3, df_train4])
m4_info = pd.read_csv("paper_tests/m4_test/M4-info.csv")
df_test = pd.read_csv("paper_tests/m4_test/Monthly-test.csv")
ssl_init_df = pd.read_csv("paper_tests/m4_test/init_SSL/SSL_aic_0.1_false.csv")

Expand Down
2 changes: 1 addition & 1 deletion src/StateSpaceLearning.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module StateSpaceLearning

using LinearAlgebra, Statistics, GLMNet, Distributions
using LinearAlgebra, Statistics, GLMNet, Distributions, SparseArrays

abstract type StateSpaceLearningModel end

Expand Down
15 changes: 1 addition & 14 deletions src/fit_forecast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,7 @@ function forecast(
@assert size(Exogenous_Forecast, 1) == steps_ahead "Exogenous_Forecast must have the same number of rows as steps_ahead"

Exogenous_X = model.X[:, exog_idx]
complete_matrix = create_X(
model.level,
model.stochastic_level,
model.trend,
model.stochastic_trend,
model.seasonal,
model.stochastic_seasonal,
model.freq_seasonal,
model.outlier,
model.ζ_ω_threshold,
Exogenous_X,
steps_ahead,
Exogenous_Forecast,
)
complete_matrix = create_X(model, Exogenous_X, steps_ahead, Exogenous_Forecast)

if typeof(model.output) == Output
return AbstractFloat.(
Expand Down
Loading
Loading