## 3 Materials and Methods
### Models Overview
#### 3.7.8 Temporal Convolutional Networks (TCN)  
Temporal Convolutional Networks (TCN) [28] are highly effective for sequence modeling, particularly in handling long-term dependencies through dilated causal convolutions. This enables TCNs to capture temporal patterns over extended periods without losing context. In this study, TCNs were employed to classify human activities based on multi-sensor data. Key parameters such as filter size, layers, and dilation factor were optimized for performance.  
The core dilated convolution operation in a TCN is given by the following:  
\[y(t)=\sum_{i=0}^{k-1}x(t-d\cdot i)\cdot w(i), \tag{26}\]  
where \(y(t)\) is the output at time \(t\), \(x(t)\) is the input signal, \(w(i)\) denotes filter weights, and \(d\) is the dilation factor. This formulation enhances the model's ability to recognize temporal dependencies across varying time steps.  
The TCN architecture, as shown in Figure 8, processes temporal sequences using convolutional layers that expand the receptive field efficiently. Dilations in increasing order capture long-range dependencies without a significant computational cost. Dropout layers  
\begin{table}
\begin{tabular}{l c c c c} \hline \hline
**Sensor Configuration** & **LSTM Layers** & **LSTM Units** & **Dropout Rate** & **Optimizer/Learning Rate** \\ \hline
2 Sensors—Non-overlapping & 2 & 32 & 0.30 & [PERSON]/0.0086 \\
2 Sensors—50\% Overlapping & 1 & 128 & 0.40 & RMSProp/0.0014 \\
4 Sensors—Non-overlapping & 1 & 128 & 0.20 & [PERSON]/0.0088 \\
4 Sensors—50\% Overlapping & 3 & 128 & 0.20 & Adam/0.0014 \\ \hline \hline \end{tabular}
\end{table}
Table 13: Optimal Hyperparameters for LSTM in Different Sensor Configurations.  
Figure 7: Architecture of a Long Short-Term Memory (LSTM) Network utilized in Activity Recognition. Adapted from [38], showing the flow of information through the forget, input, and output gates to manage long-term dependencies in sequential data.  
with a rate of 0.25 were applied to mitigate overfitting, and different optimizers (Adam, RMSProp) were used depending on sensor configurations.  
The TCN demonstrated robustness in handling complex sensor configurations. Dilated convolutions enabled the model to efficiently capture long-range temporal relationships, crucial for differentiating subtle variations in human activities. In more complex configurations, such as the four-sensor setup, dropout layers further improved generalization by reducing overfitting, especially with high-dimensional data.  
The optimal hyperparameters, identified through nested cross-validation, are summarized in Table 14. For the two-sensor 50%-overlapping setup, the best results were achieved using two layers with filter sizes of 96, 32, and 128, and an Adam optimizer with a learning rate of 0.0006. In contrast, the four-sensor non-overlapping setup favored filter sizes of 96, 64, and 32, using Adam with a learning rate of 0.0011.  
In the more complex four-sensor, 50%-overlapping configuration, a simplified architecture of one layer, with filter sizes of 32, 32, and 128, and RMSProp (learning rate 0.0025) was optimal. These configurations highlight the adaptability of TCNs in different sensor setups, capturing both local and long-range temporal dependencies effectively.  
The nested cross-validation approach ensured unbiased tuning, contributing to the model's ability to generalize across various sensor setups. By capturing both short-term and long-term dependencies, the TCN model achieved robust performance in human activity recognition tasks across different sensor configurations.