## 3 Methodology
### Deep Learning  
Similar to the above pipeline, a two-stage approach is followed here and includes a binary classifier (movement disorder detection) and a multi-label classifier (movement disorder classification). This study computes the magnitude of the raw 3D accelerations (see Equation (3)) to convert the 3D signal into a 1D signal, which is then passed to the deep learning model for training and inference. Using the 1D magnitude computed from 3D input significantly improves the computational efficiency, making the solution more suitable for real-time applications and helping to reduce the impact of sensor orientation [41]. This deep learning-based pipeline is also trained and evaluated using six different data configurations, which are made using three different window sizes for segmentation, and two different segment labeling approaches. \[\widehat{mag_{a}}=\sqrt{(a_{x}^{2}+a_{y}^{2}+a_{z}^{2})} \tag{3}\]  
Figure 3: Class distribution for movement disorder detection and movement disorder classification. Here, the top half shows the class distribution for movement disorder detection, and the bottom half shows the class distribution for movement disorder classification. In both halves, A represents using segment size of 250 and S1 labeling, and B represents using segment size of 250 and S2 labeling. Classes-T&D: Tremor and Dyskinesia; T&B: Tremor and Bradykinesia; T&D&B: Tremor, Dyskinesia, and Bradykinesia; D&B: Dyskinesia and Bradykinesia. Overview of the Algorithm  
This study employs our previously developed deep learning algorithm, HARDenseRNN [41], as our deep learning model for training and validation. The HARDenseRNN is a combination of two multi-kernel convolutional neural network (CNN) modules followed by a recurrent neural network (RNN) module (see Figure 5). This model first passes \(\widehat{img_{a}}\) as input through the CNN-based network for spatial feature extraction. The spatial features are then concatenated with the \(\widehat{img_{a}}\) and passed to the RNN-inspired network (bi-directional GRU) for capturing temporal features. The concatenation of the raw input signal, with the feature map generated by the CNN, ensures that the RNN can take advantage of both the raw signal and the CNN features for temporal feature extraction. These features are then passed through batch normalization, and are then flattened. Afterwards, the flattened output is passed through a dropout layer and then finally through a series of dense (fully connected) layers for making predictions. For the first stage, which involves binary classification, a single output node is used, with a sigmoid activation function and binary cross-entropy loss function. The second stage, involving multi-label classification, uses three output nodes, with a sigmoid activation function and binary cross-entropy loss function. For the first stage of binary classification, the model had 753,035 trainable parameters and 896 non-trainable parameters. For the second stage of multi-label classification, the model had 754,061 trainable  
Figure 4: A comparison of top 10 important features for anomaly detection (AD) and anomaly classification (AC), using the GeneActiv smartwatch, with a window size of 250, across S1 and S2 labeling methodologies. Figure 5: The architecture of our previously developed HARDenseRNN model, which was used in this study, consists of two multi-kernel CNN modules followed by a 128-unit bi-directional GRU. parameters and 896 non-trainable parameters. Deep learning model training was carried out on Google Colab Pro with a GPU (Tesla P100), with the help of TensorFlow 2.4 and Keras 2.4.3 for model construction and training. The model was trained for 100 epochs using a batch size of 128. The number of epochs were selected empirically by monitoring the plot of training and validation loss and accuracy values, as shown in Figure 6. The pipeline also uses early stopping with the'max' option for validation accuracy with a patience of 10 epochs.