# Emotional Health Detection in HAR: New Approach Using Ensemble SNN
## 5 Dataset and Model Design  
The research activities focused mainly on identifying, studying, and highlighting how the proposed AI ensemble approach can provide different advantages in the FER field. With this in mind, design choices can be characterized as \"stress tests.\"  
Figure 3: “Single frame” Configuration. In particular, a Kaggle dataset was chosen for the training and test sets (Figure 4). The dataset also predicts the \"neutral\" emotion, which we did not consider. This presents some critical issues:  
* Facial expressions, or gestures, are not always the primary characterization of images. * The numerical distribution of classes is very uneven and, in some cases, limited (Tables 1 and 2). * The \"distance\" between the reference classes is not very marked (we collected conflicting opinions of attribution through small surveys aimed at students). The single images are grayscale and have a resolution of 48 \(\times\) 48 pixels. The training set has been appropriately relabeled by generating six different training sets from two classes (\"reference emotion\" and \"other emotion\"). In this scenario, it seemed helpful and not too expensive in computational terms to use SNNs (self-normalizing neural networks). These are networks robust to noise and disturbances and do not exhibit high variation in their training errors. In deep learning, a widely used technique is batch normalization, which leads to the normalization of neuron activation towards mean zero and unit variance. Each level is normalized and used as an input to the next level. SNNs, on the other hand, are self-normalizing, neural activations that automatically converge towards mean zero and unit variance. This property is ensured by the activation function, which consists of scaled exponential linear units (SELU). This characteristic accelerates convergence in the formation process. SELU learns faster and \begin{table}
\begin{tabular}{l l} \hline
**Training set** & **Total** \\ \hline L0 (Anger) & 3995 \\ L1 (Disgust) & 436 \\ L2 (Fear) & 4097 \\ L3 (Happines) & 7215 \\ L4 (Sad) & 4830 \\ L5 (surprise) & 3171 \\ \hline \end{tabular}
\end{table} 
Table 1: Training set. \begin{table}
\begin{tabular}{l l} \hline
**Testset** & **Total** \\ \hline L0 (Anger) & 958 \\ L1 (Disgust) & 111 \\ L2 (Fear) & 1024 \\ L3 (Happines) & 1774 \\ L4 (Sad) & 1247 \\ L5 (surprise) & 831 \\ \hline \end{tabular}
\end{table} 
Table 2: Testset. Figure 4: Some emotions from the Kaggle Dataset. better than other activation functions without needing further processing. The SELU activation function can be expressed mathematically as:  
\[\text{f(x)}=\lambda\times\text{x if x}>0 \tag{1}\]  
\[\text{f(x)}=\lambda\times\alpha\left(\text{e}^{\text{x}}-1\right)\text{if x}\leq 0\]  
Graphically, it can be represented as in Figure 5.  
The \"SELU\" nonlinearity keeps the data standardized and prevents the gradients from becoming too small or too large. The effects are comparable to batch normalization while requiring significantly less calculation. In addition, the convergence property of SNNs towards mean zero and unit variance allows the training of deep networks with many levels and makes learning highly robust. The configuration of the networks (Figure 6) is as follows:  
* Input layer (48 \(\times\) 8 \(\times\) 1). * Layer with linear activation function (105 neurons on average). * Dropout layer, with a 30% activation rate; a layer present only during training that helps prevent the phenomenon of overfitting. * Layer with SELU activation function
* A linear output layer (Figure 7), this layer has two outputs for individual neural networks. * Epochs = 60
* Learning rate = 0.0001
* Accuracy = 98.4%  
Figure 5: SELU activation function. Figure 6: Network configuration. The control neural network has six outputs (as many as the emotions to be classified). For the training, we used the Adam stochastic optimizer [50], with a learning rate of 0.0001 and a minibatch size of 200.