# MLPs Are All You Need for Human Activity Recognition
## 4 Datasets
### Sliding Windows  
For the datasets to be trained and tested by the Mixer, a sliding window approach is used on the dataset. This splits the dataset into multiple sequences with the dimensions (\(D_{f}\times S_{L}\)), where \(D_{f}\) is the number of features in the dataset and \(S_{L}\) is the sliding window length. These 2D sequences, in the case of the Mixer, are treated as images. The length of the sliding window maintains a fixed length throughout each separate training process but varies across the different datasets and experiments. As mentioned in Section 3.1, the Mixer takes an input image with dimensions (\(H\), \(W\)) that is split into patches with identical dimensions (\(P\), \(P\)). This requires the patch resolution, \(P\), to be fully divisible by both dimensions of the input. This limits the length of the sliding window to either be divisible by the number of features in the dataset or divisible by the patch resolution.  
The Mixer outputs a prediction of the activity for every sliding window interval after observing it; however, there would be multiple predictions in the sliding window instead of a single ground truth prediction. There are multiple methods around this [35], which involve using the prediction at the end of the sliding window, max-pooling all of the sequence predictions over time, or returning the most frequent predictions. The Mixer benefits from mixing its features at a given spatial location across channels and between different spatial locations. In addition, the token-mixing MLP provides a global context of the input to the model. Therefore, using the most frequent predictions as the ground truth prediction is preferred to other methods since the Mixer learns context from the whole input. The details of the sliding window for each dataset are briefly described below, and the summary of their parameters is tabulated in Table 1.  
* **Opportunity:** The dataset was fit into a sliding window with an interval of 2.57 s. This duration represents 77 samples, which makes the input dimensions identical, allowing the patch resolution to be a factor of 77. The dataset was normalised to account for the wide range of sensors used in the dataset. After preprocessing the data, there were no labels of \"close drawer 2\" activity in the test set (ADL4 and AD5 from subjects 2 and 3).
* **PAMAP2:** Before downsampling, the dataset was fitted into a sliding window interval of 0.84 s, which corresponds to 84 samples. The \"rope-jumping\" activity in subject 6 had a very small number of samples. After preprocessing, there were no labels of this activity present in the test set (subject 6).
* **Daphnet Gait:** Before downsampling, a sliding window interval of 2.1 s was used to fit the dataset; this interval corresponds to 126 samples. Daphnet Gait contains a lot of longer activities, so a wider sliding window interval was chosen to provide the Mixer with more information.  
Large sliding windows were used to give the Mixer access to more information and enable the sequence to be divided into patches correctly and in an error-free manner. Smaller step sizes were used because the Mixer tends to overfit, giving it more training  
\begin{table}
\begin{tabular}{l c c c} \hline \hline  & **Opportunity** & **PAMAP2** & **Daphnet Gait** \\ \hline
**Parameters** & & & \\ \hline
**Number of Activities** & 18 & 19 & 2 \\
**Number of Features** & 77 & 40 & 9 \\
**Sliding Window Length** & 77 & 84 & 126 \\
**Sampling Rate** & 30 Hz & 100 Hz & 64 Hz \\
**Downsampling** & 1 & 3 & 2 \\
**Step Size** & 3 & 3 & 3 \\
**Normalisation** & True & False & False \\
**Interpolation** & False & True & False \\
**Includes Null activities** & True & False & False \\ \hline \hline \end{tabular}
\end{table}
Table 1: The parameters used for each dataset. Note, the parameters are chosen in order to make them comparable to prior literature for a fair comparison.  
points and ensuring that there were enough data points for adequate testing on the various activities in each dataset.