2.2.6. False Nearest Neighbors (FNN) for dimension (n)
- teaspoon.parameter_selection.FNN_n.FNN_n(ts, tau, maxDim=10, plotting=False, Rtol=15, Atol=2, Stol=0.9, threshold=10, method=None)[source]
This function implements the False Nearest Neighbors (FNN) algorithm described by Kennel et al. to select the minimum embedding dimension.
- Parameters:
ts (array) – Time series (1d).
tau (int) – Embedding delay.
- Kwargs:
maxDim (int): maximum dimension in dimension search. Default is 10.
plotting (bool): Plotting for user interpretation. Default is False.
Rtol (float): Ratio tolerance. Default is 15. (10 recommended for false strands)
Atol (float): A tolerance. Default is 2.
Stol (float): S tolerance. Default is 0.9.
threshold (float): Tolerance threshold for percent of nearest neighbors. Default is 10%.
method (string): ‘strand’ Use the composite false nearest strands algorithm (David Chelidze 2017), ‘cao’ Use the Cao method (Cao 1996). Default is None.
- Returns:
n, The embedding dimension.
- Return type:
(int)
The following is an example implementing the False Nearest Neighbors (FNN) algorithm for the dimension:
from teaspoon.parameter_selection.FNN_n import FNN_n
import numpy as np
fs = 10
t = np.linspace(0, 100, fs*100)
ts = np.sin(t)
tau=15 #embedding delay
perc_FNN, n = FNN_n(ts, tau, plotting = True)
print('FNN embedding Dimension: ',n)
Where the output for this example is:
FNN embedding Dimension: 2