Build Per-Timestep LTM Count Tables with Online Update
build_online_ltm_timestep_counts.RdFor ltm+/both+ models: records the LTM state BEFORE observing x[t] at each timestep, then updates the LTM with x[t]. This matches IDyOM's online-update semantics, where prediction at position t uses only the training corpus plus x[1:t-1], not x[t:T].
Usage
build_online_ltm_timestep_counts(
x,
N,
alphabet,
init_ltm,
ltm_update_exclusion = FALSE,
ltm_start_token = TRUE
)Arguments
- x
Character vector of events (the prediction sequence).
- N
Maximum n-gram order.
- alphabet
Character vector of all symbols.
- init_ltm
List of data.tables (format of counts_ltm): the pre-trained LTM state before any events from x are observed.
- ltm_update_exclusion
Logical. Apply update exclusion during online update.
- ltm_start_token
Logical. If FALSE, skip NA-lag contexts (IDyOM-compatible).