Rebuilds the model object from a portable fit, checks optimizer convergence, the independently recalculated maximum gradient, estimability, every MLE biological state (including mortality at every age), the harvest-wall implementation, and any LL4 contract embedded in the fit metadata.
Usage
check_mle(
fit,
gradient_tolerance = NULL,
cores = 1L,
mode = c("auto", "full", "skip"),
stop_on_failure = TRUE
)Arguments
- fit
An
sbt_fit()object.- gradient_tolerance
Optional maximum absolute gradient. By default the value is read from the fit's run identity, falling back to
0.01.- cores
Number of workers used for biological-state evaluation.
- mode
Validation mode.
"auto"reuses a matching embedded record and otherwise performs the check,"full"always performs the check, and"skip"returns the fit without checking or creating a record.- stop_on_failure
Stop when a gate fails. Set to
FALSEto retain the MLE, store a failed validation record, and return it with a warning.
Value
The checked sbt_fit, with recalculated diagnostics stored in
fit$fit$diagnostics and a payload-bound record stored in
fit$validation.
See also
Other fit workflow:
check_mcmc(),
sbt_add_bounds(),
sbt_add_map(),
sbt_add_msy(),
sbt_add_parameters(),
sbt_add_priors(),
sbt_build_object(),
sbt_example_fit(),
sbt_fit(),
sbt_fit_compatibility(),
sbt_fit_io,
sbt_fit_rebuild(),
sbt_fit_report(),
sbt_fit_validate(),
sbt_fit_validation(),
sbt_mcmc(),
sbt_obj(),
sbt_optimise()
Examples
fit <- sbt_example_fit(rebuild = FALSE)
#> Warning: Dependency versions differ: RTMBdist, TMB
fit <- check_mle(fit, mode = "auto")
sbt_fit_validation(fit, scope = "mle", require_pass = TRUE)$passes
#> [1] TRUE
