Splits the beats into consecutive blocks. The basis of each block after the first comes from attention with the energy-normalised moment of all earlier beats as query, so that it uses no beat of the block itself. The transmitted moments play the part of a fixed cache of keys and values, and only the query is updated.
Usage
stream_attention(X, moments, k, block = 50L, args = list(tau = Inf))Value
A list with one basis per block, T, and the block of each
beat, block. The first block has no basis.
Examples
sim <- simulate_beats(H = 5, n = 60, p = 20, q = 3, seed = 7)
m <- lapply(sim$X[-1], energy_moment, q = 5)
s <- stream_attention(sim$X[[1]], m, k = 3, block = 20,
args = list(tau = 0.05))
length(s$T)
#> [1] 3
