fn_get_optimal_param_idx | R Documentation |
Since we allow multiple family
s to be evaluated at once with the same
grid of parameter values, we first need to identify the 'raw' index that
tells us the optimal family
choice. Then we can within this family identify
the 'wrapped' optimum index that gives the optimal params
choice.
fn_get_optimal_param_idx(log_joint, idx_wrap)
log_joint |
A vector of length |
idx_wrap |
The number of params (same for each |
When only a single family
is evaluated, the 'raw' and 'wrapped' indices are
the same.
A list of two scalar integers, named raw
and wrapped
# let's say there are 5 parameter sets being evaluated
log_joint_params <- rnorm(n = 5, sd = 5)
idx_wrap <- length(log_joint_params)
# we evaluate the parameter sets for three different family choices, which
# creates 3 * 5 different sets of models to be evaluated
log_joint <- c(
log_joint_params + rnorm(n = 1, sd = 5),
log_joint_params + rnorm(n = 1, sd = 5),
log_joint_params + rnorm(n = 1, sd = 5)
)
ls_opt_idx <- tulip:::fn_get_optimal_param_idx(
log_joint = log_joint,
idx_wrap = idx_wrap
)
plot(x = 1:idx_wrap,
y = seq(-30, 30, length.out = idx_wrap),
type = "n", xlab = "idx", ylab = "log joint")
for (i in 1:(length(log_joint) / idx_wrap)) {
lines(
x = 1:idx_wrap,
y = log_joint[(i*idx_wrap - 4):(i*idx_wrap)],
lty = i
)
}
points(ls_opt_idx$wrapped, log_joint[ls_opt_idx$raw], pch = 19)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.