Skip to content

Commit 6bb437f

Browse files
Merge pull request #288 from LAMPSPUC/fix-bug-es
fix es seasonal upper bound
2 parents b1723e7 + a4e3fd9 commit 6bb437f

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "StateSpaceModels"
22
uuid = "99342f36-827c-5390-97c9-d7f9ee765c78"
33
authors = ["raphaelsaavedra <[email protected]>, guilhermebodin <[email protected]>, mariohsouto"]
4-
version = "0.5.17"
4+
version = "0.5.18"
55

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

src/hyperparameters.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ The mapping is
324324
``\\psi = lb + \\frac{ub - lb}{1 + \\exp(-\\psi_{*})}``
325325
"""
326326
function constrain_box!(model::StateSpaceModel, str::String, lb::Fl, ub::Fl) where Fl
327-
@assert ub > lb
327+
@assert ub >= lb
328328
update_constrained_value!(
329329
model, str, lb + ((ub - lb) / (1 + exp(-get_unconstrained_value(model, str))))
330330
)
@@ -341,7 +341,7 @@ The mapping is
341341
``\\psi_* = -\\ln \\frac{ub - lb}{\\psi - lb} - 1``
342342
"""
343343
function unconstrain_box!(model::StateSpaceModel, str::String, lb::Fl, ub::Fl) where Fl
344-
@assert ub > lb
344+
@assert ub >= lb
345345
update_unconstrained_value!(
346346
model, str, -log((ub - lb) / (get_constrained_value(model, str) - lb) - 1)
347347
)

src/models/exponential_smoothing.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ function constrain_hyperparameters!(model::ExponentialSmoothing)
181181
end
182182
end
183183
if model.seasonal > 0
184-
ub = min(Fl(0.9999), 1 - get_constrained_value(model, "smoothing_level"))
184+
ub = min(Fl(0.9999), 1 - min(Fl(0.99989), get_constrained_value(model, "smoothing_level")))
185185
constrain_box!(model, "smoothing_seasonal", Fl(0.0001), ub)
186186
for i in 1:model.seasonal - 1
187187
constrain_identity!(model, "initial_seasonal_$i")
@@ -204,7 +204,7 @@ function unconstrain_hyperparameters!(model::ExponentialSmoothing)
204204
end
205205
end
206206
if model.seasonal > 0
207-
ub = min(Fl(0.9999), 1 - get_constrained_value(model, "smoothing_level"))
207+
ub = min(Fl(0.9999), 1 - min(Fl(0.99989), get_constrained_value(model, "smoothing_level")))
208208
unconstrain_box!(model, "smoothing_seasonal", Fl(0.0001), ub)
209209
for i in 1:model.seasonal - 1
210210
unconstrain_identity!(model, "initial_seasonal_$i")

0 commit comments

Comments
 (0)