Skip to content

Commit 4991e2a

Browse files
author
Jouni Helske
committed
restructure m-step, revert back to stricter tolerances
1 parent 9a8ddcd commit 4991e2a

File tree

6 files changed

+180
-174
lines changed

6 files changed

+180
-174
lines changed

R/fit_mnhmm.R

+9-17
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,20 @@ fit_mnhmm <- function(model, inits, init_sd, restarts, lambda, method,
2020
)
2121
control <- utils::modifyList(
2222
list(
23-
ftol_abs = 1e-6,
24-
xtol_abs = 1e-6,
25-
ftol_rel = 1e-10,
23+
ftol_rel = 1e-12,
24+
ftol_abs = 1e-8,
2625
xtol_rel = 1e-6,
26+
xtol_abs = 1e-6,
2727
maxeval = 1e4,
2828
print_level = 0,
2929
algorithm = "NLOPT_LD_LBFGS",
3030
maxeval_em_dnm = 100
3131
),
3232
control
3333
)
34+
# By default, use the same values for restart as for the final optimization
3435
control_restart <- utils::modifyList(
35-
list(
36-
ftol_abs = 1e-4,
37-
xtol_abs = 1e-4,
38-
ftol_rel = 1e-8,
39-
xtol_rel = 1e-4,
40-
maxeval = 1e4,
41-
print_level = 0,
42-
algorithm = "NLOPT_LD_LBFGS",
43-
maxeval_em_dnm = 100
44-
),
36+
control,
4537
control_restart
4638
)
4739
stopifnot_(
@@ -52,11 +44,11 @@ fit_mnhmm <- function(model, inits, init_sd, restarts, lambda, method,
5244
)
5345
control_mstep <- utils::modifyList(
5446
list(
55-
ftol_abs = 1e-6,
56-
xtol_abs = 1e-6,
57-
ftol_rel = 1e-10,
47+
ftol_rel = 1e-12,
48+
ftol_abs = 1e-8,
5849
xtol_rel = 1e-6,
59-
maxeval = 100,
50+
xtol_abs = 1e-6,
51+
maxeval = 1000,
6052
print_level = 0
6153
),
6254
control_mstep

R/fit_nhmm.R

+9-17
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,20 @@ fit_nhmm <- function(model, inits, init_sd, restarts, lambda, method,
2020
)
2121
control <- utils::modifyList(
2222
list(
23-
ftol_abs = 1e-6,
24-
xtol_abs = 1e-6,
25-
ftol_rel = 1e-10,
23+
ftol_rel = 1e-12,
24+
ftol_abs = 1e-8,
2625
xtol_rel = 1e-6,
26+
xtol_abs = 1e-6,
2727
maxeval = 1e4,
2828
print_level = 0,
2929
algorithm = "NLOPT_LD_LBFGS",
3030
maxeval_em_dnm = 100
3131
),
3232
control
3333
)
34+
# By default, use the same values for restart as for the final optimization
3435
control_restart <- utils::modifyList(
35-
list(
36-
ftol_abs = 1e-4,
37-
xtol_abs = 1e-4,
38-
ftol_rel = 1e-8,
39-
xtol_rel = 1e-4,
40-
maxeval = 1e4,
41-
print_level = 0,
42-
algorithm = "NLOPT_LD_LBFGS",
43-
maxeval_em_dnm = 100
44-
),
36+
control,
4537
control_restart
4638
)
4739
stopifnot_(
@@ -52,11 +44,11 @@ fit_nhmm <- function(model, inits, init_sd, restarts, lambda, method,
5244
)
5345
control_mstep <- utils::modifyList(
5446
list(
55-
ftol_abs = 1e-6,
56-
xtol_abs = 1e-6,
57-
ftol_rel = 1e-10,
47+
ftol_rel = 1e-12,
48+
ftol_abs = 1e-8,
5849
xtol_rel = 1e-6,
59-
maxeval = 100,
50+
xtol_abs = 1e-6,
51+
maxeval = 1000,
6052
print_level = 0
6153
),
6254
control_mstep

0 commit comments

Comments
 (0)