ntsa.tools.embedding
At a glance
| Function | One-liner |
|---|---|
delay_embed(x, dim, lag) |
Takens delay-embedding matrix (N-(dim-1)*lag, dim). |
average_mutual_information(x, max_lag, n_bins=64) |
AMI for lags 1..max_lag. |
optimal_lag(x, max_lag=None, n_bins=64) |
Delay \(\zeta\) = first local minimum of the AMI (samples). |
false_nearest_neighbours(x, lag, ...) |
Kennel FNN embedding dimension d and per-dimension fractions. |
Full reference
ntsa.tools.embedding
Delay embeddings and lag/dimension selection (Kantz & Schreiber ch. 3 and 9).
delay_embed(x, dim, lag)
Delay-coordinate embedding of a scalar series: rows (x[i], x[i+lag], ...).
Source code in ntsa/tools/embedding.py
9 10 11 12 13 14 15 | |
average_mutual_information(x, max_lag, n_bins=64)
AMI (nats) between x(t) and x(t+lag) for lags 1..max_lag; shape (max_lag,).
Source code in ntsa/tools/embedding.py
18 19 20 21 22 23 24 25 26 27 28 29 | |
optimal_lag(x, max_lag=None, n_bins=64)
Embedding lag (samples): first local minimum of the AMI curve (Fraser & Swinney 1986).
When the AMI is nearly lag-independent (min > 0.5*max — e.g. noiseless periodic signals, where local minima are pure histogram-quantization jitter), falls back to the first zero crossing of the autocorrelation (Kantz & Schreiber sec. 3.3.1).
Source code in ntsa/tools/embedding.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
false_nearest_neighbours(x, lag, d_max=10, Rtol=10.0, Atol=2.0, threshold=0.01, n_query=5000, seed=0)
Embedding dimension via false nearest neighbours (Kennel et al. 1992).
Returns:
| Name | Type | Description |
|---|---|---|
d |
int
|
First dimension with FNN fraction < |
fractions |
ndarray(d_max)
|
FNN fraction per dimension 1..d_max; nan where not computed (early exit). |
Source code in ntsa/tools/embedding.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |