Expand description
Takens Delay Embedding and Correlation Dimension estimator.
Takens’ theorem (1981): if a time series is generated by a deterministic
dynamical system with attractor dimension d, then 2d+1 delay-embedded
observations faithfully reconstruct the attractor — regardless of total
sequence length.
Applied to KV caches: the minimum number of KV vectors needed for lossless
attention reconstruction is bounded by 2d+1, where d is the correlation
dimension of the KV sequence treated as a dynamical trajectory.
§Workflow
- Collect a KV sequence as rows of a matrix.
- Embed with
delay_embedding(series, tau, embed_dim). - Estimate
dwithcorrelation_dimension(points, ...). - Compute minimum cache size:
min_cache_size_takens(d).
Functions§
- correlation_
dimension - Estimate the correlation dimension of a point cloud using the Grassberger–Procaccia algorithm (1983).
- delay_
embedding - Build a delay-embedded point cloud from a scalar or vector time series.
- min_
cache_ size_ takens - Minimum number of KV vectors needed to reconstruct the attractor, per
Takens’ theorem:
2 * ceil(d) + 1.