
Autoformer decomposition plus Auto-Correlation, eqs. (1), (5), (6)
Source:R/ts_joseph.R
morie_autoform.RdQuoted from the paper: (5) "R_XX(tau) = lim (1/L) sum_t X_t X_{t-tau}"; (6) "tau_1..tau_k = arg Topk(R_{Q,K}(tau))" with "k = floor(c x log L)", "Rhat = SoftMax(R(tau_1)..R(tau_k))", "Auto-Correlation(Q,K,V) = sum_i Roll(V, tau_i) Rhat(tau_i)" – Wu, Xu, Wang and Long, NeurIPS 2021 (arXiv:2106.13008). Ties in the Topk are broken by the smaller lag, so selection is deterministic.
Examples
morie_autoform(q = c(1, 2, 3, 4, 5, 6, 7, 8), k = c(1, 2, 3, 4, 5, 6, 7, 8),
v = c(1, 2, 3, 4, 5, 6, 7, 8))
#> $out
#> [1] 5 2 3 4 5 6 7 4
#>
#> $taus
#> [1] 1 7
#>
#> $weights
#> [1] 0.5 0.5
#>
#> $k
#> [1] 2
#>
#> $L
#> [1] 8
#>
#> $r1
#> [1] 22
#>
#> $outmean
#> [1] 4.5
#>
#> $outmax
#> [1] 7
#>
#> $trendmean
#> [1] 4.5
#>
#> $seasrange
#> [1] 0.6666667
#>