3
3
model::StateSpaceModel;
4
4
filter::KalmanFilter=default_filter(model),
5
5
optimizer::Optimizer=Optimizer(Optim.LBFGS()),
6
- save_results ::Bool=true
6
+ save_hyperparameter_distribution_results ::Bool=true
7
7
)
8
8
9
9
Estimate the state-space model parameters via maximum likelihood. The resulting optimal
@@ -30,7 +30,7 @@ function fit!(
30
30
model:: StateSpaceModel ;
31
31
filter:: KalmanFilter = default_filter (model),
32
32
optimizer:: Optimizer = default_optimizer (model),
33
- save_results :: Bool = true
33
+ save_hyperparameter_distribution_results :: Bool = true
34
34
)
35
35
isfitted (model) && return model
36
36
@assert has_fit_methods (typeof (model))
@@ -48,7 +48,7 @@ function fit!(
48
48
opt_hyperparameters = opt. minimizer
49
49
update_model_hyperparameters! (model, opt_hyperparameters)
50
50
51
- if save_results
51
+ if save_hyperparameter_distribution_results
52
52
numerical_hessian = Optim. hessian! (func, opt_hyperparameters)
53
53
try
54
54
std_err = numerical_hessian |> pinv |> diag .| > sqrt
@@ -60,11 +60,15 @@ function fit!(
60
60
" If you are interested in estimates of the distribution of ther hyperparameters we advise you to" *
61
61
" change the optimization algorithm by using the kwarg fit(...; optimizer = " *
62
62
" Optimizer(StateSpaceModels.Optim.THE_METHOD_OF_YOUR_CHOICE()))" *
63
- " The list of possible algorithms can be found on this link https://julianlsolvers.github.io/Optim.jl/stable/#"
63
+ " The list of possible algorithms can be found on this link https://julianlsolvers.github.io/Optim.jl/stable/#" *
64
+ " Otherwise you can simply skip this proccess by using fit(...; save_hyperparameter_distribution_results=false) "
64
65
)
65
66
std_err = fill (NaN , number_hyperparameters (model))
66
67
fill_results! (model, opt_loglikelihood, std_err)
67
68
end
69
+ else
70
+ std_err = fill (NaN , number_hyperparameters (model))
71
+ fill_results! (model, opt_loglikelihood, std_err)
68
72
end
69
73
return model
70
74
end
0 commit comments