Skip to content

Commit 6b5b19f

Browse files
Merge pull request #48 from LAMPSPUC/fix_model_without_stochastic_components
Fix model without stochastic components
2 parents 8855f2e + caa6cac commit 6b5b19f

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

Project.toml

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

66
[deps]
77
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"

docs/src/examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ y = solars[!, "values"]
8686
T = length(y)
8787
steps_ahead = 168
8888

89-
model = StructuralModel(y; freq_seasonal=24)
89+
model = StructuralModel(y; freq_seasonal=168)
9090
fit!(model)
9191
prediction = StateSpaceLearning.forecast(model, steps_ahead) # arguments are the output of the fitted model and number of steps ahead the user wants to forecast
9292

src/estimation_procedure.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,9 @@ function estimation_procedure(
294294

295295
if hasintercept
296296
penalty_factor = ones(size(Estimation_X, 2) - 1)
297-
penalty_factor[components_indexes["initial_states"][2:end] .- 1] .= 0
297+
if length(penalty_factor) != length(components_indexes["initial_states"][2:end])
298+
penalty_factor[components_indexes["initial_states"][2:end] .- 1] .= 0
299+
end
298300
coefs, _ = fit_lasso(
299301
Estimation_X,
300302
estimation_y,
@@ -307,7 +309,9 @@ function estimation_procedure(
307309
)
308310
else
309311
penalty_factor = ones(size(Estimation_X, 2))
310-
penalty_factor[components_indexes["initial_states"][1:end]] .= 0
312+
if length(penalty_factor) != length(components_indexes["initial_states"])
313+
penalty_factor[components_indexes["initial_states"][1:end]] .= 0
314+
end
311315
coefs, _ = fit_lasso(
312316
Estimation_X,
313317
estimation_y,

0 commit comments

Comments
 (0)