## 3 Methods
### Emotion Detection Based on Voice Features
#### 3.2.3 Model Architecture  
The built emotion identification model uses a sequential model architecture, a type of multilayer neural network structure commonly employed in natural language processing (NLP) and speech recognition, and is also used in a multitude of different scenarios as a flexible model that allows stacking different types of layers. The sequential model comprises multiple layers: an input layer, an output layer, and a variable number of hidden layers in between. Each layer has different weights that are learned during the training phase. Data are passed through the layers in sequence; the output of one layer serves as the input for the next layer, hence the name of the model. To determine the best neural network architecture, multiple designs with varying hidden layers and parameters were tested, comprising the following:  
* Convolutional layers apply 1D filters moving along the time axis of the data. Each convolution layer detects local features from the audio signal. * Long short-term memory (LSTM) layers/bidirectional LSTM layers  
LSTM layers are a type of recurrent neural network (RNN) architecture designed to handle the vanishing gradient problem, common in traditional RNNs. LSTMs are considered effective for learning long-term dependencies in sequential data. Bidirectional LSTMs consist of two LSTM layers: one processes the input sequence from start to finish (forward direction), while the other processes it in reverse (backward direction). This allows the network to capture information from both past and future states simultaneously. Bidirectional LSTMs are used for enhanced context understanding and improved performance in time series forecasting and other sequential data tasks. * Gated recurrent unit (GRU) layers  
GRU layers use two gates to control the flow of information: a reset gate that determines how much of the past information to lose track of and an update gate that controls how much of the past information should be passed along to future iterations or layers. * Batch normalization layers
* Batch normalization normalizes the output of the previous layer by subtracting the batch mean and dividing by the batch standard deviation. * Different activation functions: rectified linear unit (ReLU) and leaky ReLU. ReLU outputs the input directly if it is positive; otherwise, it outputs zero. It is a popular activation function used in neural networks but can have the problem of 'killing' negative inputs. This is why Leaky ReLU, which addresses this issue, might yield better results. The difference is in how leaky ReLU treats negative inputs; it multiplies them with a positive constant, preventing \"dead\" neurons. The steps for building the classification algorithms are as follows:  
* Data preparation: The dataset is split in training (80%) and testing (20%) sets. * Building the classification model: The architecture for the classification model is created. Different model architectures were created using the layers described above. All tested architectures contain a number of convolutional layers at the top, followed by two fully connected layers at the end, the last one being the one that outputs the classification decision. Models were also built that contain two _bidirectional LSTM_ or two _GRU_ layers between the _CNN_ layers and the fully connected layers. Batch normalization is applied to normalize the activations of the previous layers in order to improve training. Pooling layers (in this case, _max-pooling_) reduce the data size and extract dominant features. After several layers of convolution and pooling, the data are flattened and passed through dense layers. Dense layers combine the extracted features and allow the model to make predictions based on these features. Activation functions, such as _ReLU_ or _Leaky ReLU_, for the intermediatelayers and the output layer are used to introduce nonlinearities into the model.