# Anxiety Detection System Based on Galvanic Skin Response Signals
## 4 Experimental Design
### Proposed System
#### 4.2.2 Feature Extraction  
In the feature extraction stage, relevant features were extracted from the preprocessed EDA signals to represent the physiological changes associated with stress. Here, two feature extraction approaches were employed, i.e., traditional statistical feature extraction and automatic feature extraction (code in Supplementary Material).  
We utilized the pyEDA [35] toolkit, which is an open-source Python 3.12 toolkit, for preprocessing and feature extraction of the EDA data. First, both the approaches adjusted the EDA signal to a different sample rate, where the input signal was resampled from its original data rate to a new sample rate. Then, the resampled data were segmented into smaller windows of a specified width (referred to as a segment). Each segment of the resampled data was preprocessed by applying a rolling mean filter using the rolling mean function, which helped to smooth out the signals. In the following discussion, we explain each feature extraction approach in detail.  
* Statistical Feature Extraction  
Statistical feature extraction involves calculating the descriptive statistics of the EDA signals within each window obtained from the preprocessed segments. These statistics capture the overall characteristics of the signals, e.g., mean, standard deviation, minimum, maximum, and peak-to-peak amplitude. These statistical features provide valuable insights into the characteristics of the data within each segment, e.g., the overall level of arousal and phasic changes in skin conductance. Then, the extracted statistical features and preprocessed data are aggregated across all segments.  
* Automatic Feature Extraction  
Automatic feature extraction autoencoders were used, which are unsupervised neural networks that learn efficient data coding by compressing and encoding the data. Herein, the autoencoder comprised an encoder and a decoder, which transformed the input data into a lower-dimensional representation (latent variables) and reconstructed the original data, respectively. Note that the latent variables served as the extracted features for the classification process.  
The automatic feature extraction process in pyEDA had two functions: prepare automatic and process automatic. The first function was used to prepare the EDA signals and train an autoencoder, while the second function used a pretrained autoencoder model to obtain latent variables of the EDA signals.  
We modified the autoencoder model to fit our purpose. In particular, the modified autoencoder model had 14 layers, including 7 encoding layers and 7 decoding layers. Each encoding layer comprised a linear layer and LeakyReLU activation function, and each decoding layer comprised a linear layer and the sigmoid activation function, as shown in Figure 3.  
Figure 2: Data preprocessing.  
Figure 3: Architecture of the proposed autoencoder.  
The 14-layer architecture was determined through experimental evaluation, balancing model complexity with performance on the validation set. Deeper and shallower architectures were explored, and we achieved good results with the 14-layer autoencoder architecture.