Skip to content

Commit 3ad37b1

Browse files
Merge pull request #90 from LAMPSPUC/update_estimation_procedure
update estimation procedure and paper experiments
2 parents 8ac9155 + 09b4096 commit 3ad37b1

23 files changed

Lines changed: 1130 additions & 48474 deletions

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ paper_tests/m4_test/evaluate_model2.jl
2323
results_PROPHET/
2424
results_SS/
2525
sarima/
26+
27+
results_simulation/
28+
results_metrics/
29+
ssl_vs_kalman_paired_tests.csv

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
name = "StateSpaceLearning"
22
uuid = "971c4b7c-2c4e-4bac-8525-e842df3cde7b"
33
authors = ["andreramosfc <andreramosfdc@gmail.com>"]
4-
version = "2.0.15"
4+
version = "2.1.0"
55

66
[deps]
77
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
88
GLMNet = "8d5ece8b-de18-5317-b113-243142960cc6"
9+
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
910
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1011
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1112
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

README.md

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ log_air_passengers = log.(airp.passengers)
7373
steps_ahead = 30
7474

7575
model = StructuralModel(log_air_passengers)
76-
fit!(model)
77-
prediction_log = forecast(model, steps_ahead) # arguments are the output of the fitted model and number of steps ahead the user wants to forecast
76+
StateSpaceLearning.fit!(model)
77+
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
7878
prediction = exp.(prediction_log)
7979

8080
plot_point_forecast(airp.passengers, prediction)
@@ -234,36 +234,63 @@ StateSpaceModels.fit!(ss_model)
234234

235235
## Paper Results Reproducibility
236236

237-
The paper has two experiments (results for the M4 competition and a simulation study). To reproduce each experiment follow the instructions below:
237+
To reproduce the paper results, run the following experiments:
238+
239+
### M4 Competition Test
238240

239-
### M4 Experiment
241+
Evaluates SSL and SS (StateSpaceModels) benchmark models on M4 competition dataset across all granularities (Monthly, Quarterly, Daily, Hourly, Weekly, Yearly).
240242

241-
To reproduce M4 paper results you can clone the repository and run the following commands on terminal:
243+
**Before running:** Add PyCall to your Julia environment:
244+
```julia
245+
using Pkg
246+
Pkg.add("PyCall")
247+
```
248+
249+
The script also requires Python packages (`statsmodels`, `numpy`) for the SS benchmark evaluation.
242250

243251
```shell
244252
julia paper_tests/m4_test/m4_test.jl
245-
python paper_tests/m4_test/m4_test.py
246253
```
247254

248-
The results for SSL model in terms of MASE and sMAPE for all 48000 series will be stored in folder "paper_tests/m4_test/results_SSL". The average results of MASE, sMAPE and OWA will be saved in file "paper_tests/m4_test/metric_results/SSL_METRICS_RESULTS.csv".
255+
The script:
256+
- Downloads M4 competition datasets directly from GitHub
257+
- Runs SSL models with various configurations (with/without outliers, different selection methods, and alpha values)
258+
- Runs SS (StateSpaceModels) benchmark models using PyCall
259+
- Calculates metrics (MASE, sMAPE, OWA, CRPS) for all models
249260

250-
The results for SS model in terms of MASE and sMAPE for all 48000 series will be stored in folder "paper_tests/m4_test/results_SS". The average results of MASE, sMAPE and OWA will be saved in file "paper_tests/m4_test/metric_results/SS_METRICS_RESULTS.csv".
261+
Results are saved in:
262+
- `paper_tests/m4_test/results_SSL/` - SSL model results by granularity
263+
- `paper_tests/m4_test/metrics_results/` - Summary metrics and benchmark results
251264

252-
### Simulation Experiment
265+
### Simulation Parameter Study
253266

254-
To reproduce the simulation results you can clone the repository and run the following commands on terminal:
267+
Compares SSL vs Kalman filter on simulated data.
255268

256269
```shell
257-
julia paper_tests/simulation_test/simulation.jl 0
270+
julia paper_tests/simulation_param/simulation.jl [repetitions] [sample_sizes]
258271
```
259272

260-
As this test takes a long time, you may want to run it in parallel, for that you can change the last argument to be number of workers to use in the parallelization:
273+
Example:
274+
```shell
275+
julia paper_tests/simulation_param/simulation.jl 100 60,120,240
276+
```
277+
278+
Results are saved in `paper_tests/simulation_param/ssl_vs_kalman_paired_tests.csv`.
279+
280+
### Simulation Test
281+
282+
Large-scale simulation comparing SSL, SS, and other methods.
283+
284+
```shell
285+
julia paper_tests/simulation_test/simulation.jl [num_workers]
286+
```
261287

288+
Example (with 4 parallel workers):
262289
```shell
263-
julia paper_tests/simulation_test/simulation.jl 3
290+
julia paper_tests/simulation_test/simulation.jl 4
264291
```
265292

266-
The results will be saved in two separated files: "paper_tests/simulation_test/results_metrics/metrics_confusion_matrix.csv" and "paper_tests/simulation_test/results_metrics/metrics_bias_mse.csv"
293+
Results are saved in `paper_tests/simulation_test/results_simulation/` and `paper_tests/simulation_test/results_metrics/`.
267294

268295

269296
## Contributing

0 commit comments

Comments
 (0)