
Masked-concept and next-visit pre-training targets
Source:R/deep_dataset.R
make_pretraining_targets.RdFor a token array (N, V, L): each non-special position (id >= n_special) is selected with probability mask_prob;
a selected position becomes [MASK] 80 percent of the time, a random concept 10 percent, stays 10 percent. mlm_labels
holds the original id at selected positions and -100 elsewhere; next_visit_flag[i, v] is 1 when row i has a visit
after v. [MASK] is vocab_size (embedding needs vocab_size + 1 rows). Draws use R's RNG, so for the same seed
they differ from the Python function; the properties (rates, labels, flags) are the same.
Usage
make_pretraining_targets(
concept_tensor,
n_visits,
vocab_size,
mask_prob = 0.15,
seed = 20261104,
n_special = 5L
)