View source: R/04-optimization.R
Compute the conditional mode W-hat for one value of the hyperparameters theta. Uses trust region methods implemented in trustOptim::trust.optim. Makes use of the sparsity of the Hessian.
This is a wrapper for optimize_latentfield_trustoptim() that computes the conditional mode in parallel over a user-specified grid of theta values.
Parallelization only works on linux and mac; the "parallel" package needs to work. If you're on windows, you'll just have to wait a little longer (long enough to go to the store and buy a serious computer maybe?).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | optimize_latentfield_trustoptim(
theta,
model_data,
hessian_structure = NULL,
Q = NULL,
optcontrol = NULL
)
optimize_all_thetas_parallel(
thetagrid,
model_data,
hessian_structure = NULL,
optcontrol = NULL,
doparallel = TRUE
)
|
theta |
Vector, representing one configuration of hyperparameters (optimize_latentfield_trustoptim). List of vectors, each representing one configuration of hyperparameters (optimize_all_thetas_parallel). |
model_data |
ccmodeldata object as output by model_setup(). |
hessian_structure |
Optional, provide the sparsity structure of the Hessian. This doesn't change with different thetas, so when doing all hyperparameter configurations, only need to compute this once. It will be computed if not provided. |
Q |
Optional, provide pre-computed Q matrix for this theta. Will be computed if not provided. |
optcontrol |
Optional. Override the casecrossover default control parameters for trust.optim(). See cc_control()$opt_control. |
thetagrid |
A NIGrid object which contains the grid of theta values to be optimized for. |
doparallel |
Logical. Use parallel::mclapply (TRUE) or lapply (FALSE) for execution? Former executes in parallel, latter in series. Default TRUE. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.