Skip to contents

For 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
)

Arguments

concept_tensor

integer array

n_visits

visits per row

vocab_size

tokenizer size.

mask_prob

selection probability

seed

RNG seed

n_special

number of special ids (5).

Value

list(masked_concept_tensor, mlm_labels, next_visit_flag).