## 3 Methods
### Features of EEG Signals
#### 3.1.4 Lyapunov Exponents and Fractal Dimension  
Epileptic seizures are irregular and nonlinear phenomena. Chaos theory provides tools for describing and analyzing such irregular and nonlinear processes. Lyapunov exponents are one of the tools in chaos theory that allow for measuring the sensitivity of a system to small initial changes. In the case of epileptic seizures, changes in the dynamics of EEG signals can lead to variations in the values of Lyapunov exponents, indicating the presence of irregularities and nonlinearities characteristic of seizures. Lyapunov exponents allow for assessing the sensitivity of a dynamic system's trajectories to small initial perturbations and serve as indicators of chaos in the system. The first step is the proper processing and preparation of signals, including noise removal and optionally value normalization. Then, we construct the trajectories of the dynamic system in phase space. This is the step where input data are transformed into trajectories that will serve as the basis for further analysis. This process can be accomplished using techniques such as time delay embedding or phase space reconstruction. Time delay embedding involves creating trajectories by delaying consecutive samples of the time signal. This means that each sample of the signal is extended by several subsequent samples, forming a multidimensional vector. The time delay is controlled by a parameter \(\tau\), which determines the number of samples by which the time is shifted. The reconstructed time delay vector \(\mathbf{Y}_{i}\) in the lagged phase space is given by [78]:  
\[Y_{i}(d)=[x(i),x(i+\tau),x(i+2\tau),\ldots,x(i+(d-1)\tau)] \tag{8}\]  
where \(x(i)\) represents the original time series data at time \(i\), \(\tau\) is the time delay (lag), and \(m\) is the embedding dimension. The lagged phase space representation allows us to capture the underlying dynamics and dependencies of the system by creating a multidimensional representation of the time series. It should be noted that the appropriate embedding dimension, \(d\), and time delay, \(\tau\), need to be determined for the discrete signal \(x\). To determine the optimal time delay, \(\tau\), we can utilize the autocorrelation function or mutual information. On the other hand, to calculate the optimal embedding dimension, \(d\), we can use the method proposed by [PERSON] [79]. The concept of trajectory construction is based on the idea that the dynamic properties of a system are visible in the phase space (Figures 7 and 8). Figure 7 presents the trajectory for a segment of the iEEG signal during a seizure. Figure 7: A phase trajectory for a fragment of an iEEG signal recorded during an epileptic seizure. Figure 8, on the other hand, presents the trajectory for a segment of the iEEG signal when no seizure was detected. These presented phase trajectories enable us to visually capture changes in the analyzed signals. When observing the phase trajectory of an iEEG signal recorded during a seizure, it becomes apparent that it is more regular and organized. In contrast, the phase trajectory for the non-seizure signal is less organized and exhibits fewer distinct structures. Similar relationships can also be observed in other examples. Lyapunov exponents are measures of the local exponential rates of divergence or convergence of nearby trajectories in a dynamical system. They provide information about the sensitivity of the system to initial conditions and quantify the degree of chaos or complexity present in the system. The Lyapunov exponents can be calculated using the formula [78]:  
\[\lambda_{i}=\log_{e}\bigl{|}f^{\prime}(\mathbf{Y}_{i}(d))\bigr{|} \tag{9}\]  
where \(f^{\prime}(\mathbf{Y}_{i}(d))\) is the rate of divergence of two neighboring trajectories at point \(\mathbf{Y}_  
dimension of an attractor for a discrete signal \(x\) is based on the \"box-counting\" method (the Grassberger-Procaccia method [81]).