spkit
.TD_Embed¶
- spkit.TD_Embed(x, order=3, delay=1)¶
Time delay Embedding Matrix
Extracting Embeddings
- Parameters:
- x1d-array
time series of shape (n,)
- orderint, default=3
Embedding dimension (order).
- delayint, default=1
Delay.
- Returns:
- X: Embedded Matrix: ndarray
Embedded time-series, of shape (n - (order - 1) * delay, order)
See also
signal_embeddings
Signal Embeddings
create_multidim_space_signal
Creating Multi-Dimensional Signal Space
Examples
#sp.TD_Embed import numpy as np import matplotlib.pyplot as plt import spkit as sp X, fs, ch_names = sp.data.eeg_sample_14ch() x1 = X[500:700,0] t = np.arange(len(x1))/fs Xe = sp.TD_Embed(x1,order=3,delay=2) plt.figure(figsize=(10,4)) plt.subplot(211) plt.plot(t,x1) plt.xlim([t[0],t[-1]]) plt.ylabel('x') plt.xticks([]) plt.subplot(212) plt.plot(t[:Xe.shape[0]],Xe) plt.xlim([t[0],t[-1]]) plt.ylabel('Embeddings') plt.xlabel('time (s)') idx = 47 plt.axvline(t[idx],color='k',lw=1,alpha=0.5) plt.plot([t[idx],t[idx],t[idx]],Xe[idx],'o',ms=3) plt.plot(t[[idx,idx+5,idx+10]],Xe[idx]+50,ls='-',marker='.',color='k') plt.text(t[idx+10],80,' embedding') plt.tight_layout() plt.show()