Skip to contents

For each slot, picks the largest of (alpha, beta[, gamma]) and sets it to 1, the others to 0. Recovers the discrete grammar choice at every slot. After snapping, evaluating the master should reproduce the corresponding closed-form symbolic expression.

Usage

snap_master_params(par, depth)

Arguments

par

numeric vector of length master_n_params(depth).

depth

integer >= 1.

Value

Numeric vector of the same length as par.

Details

This is meaningful only when par is a per-slot simplex (the softmax output used by eml_fit() with parameterization = "simplex"), where the argmax corresponds to a grammar choice {1, x, f}. Applied to raw continuous coefficients ("direct" mode) the argmax has no such interpretation.

Examples

theta <- theta_for_exp()
snapped <- snap_master_params(theta, depth = 1)
identical(snapped, theta) # already one-hot
#> [1] TRUE