## 4 Methodology
### Data Segmentation  
After data preprocessing, the data stream, which consists of the body acceleration component, gravity acceleration component and the activity labels, is divided into windows by adopting the change point-based segmentation method. The novel segmentation method is clarified as a two-step procedure (as shown in Algorithm 1), which aims to map the accelerometer data segment with the corresponding activity label to the most accurate extent (detailed in [36]). ```
Input: Acceleration data stream \(x_{1},x_{2},\ldots,x_{q}\) Output: A set of segments of \(S_{1},S_{2},\ldots,S_{n}\), \(n<a\)
1. Denote the sensor observations within a window as \(x_{1},x_{2},\ldots,x_{n}\), \(n\leq q\), then pad analysis window contains sensor observations \(x_{1-m},\ldots,x_{n+m}\) over the data stream, where \(n\) is the analysis window length and \(m\) is the padding size. 2. Slide an index variable, \(l,1<l\leq n\), compute means: \(\tilde{J}_{1}(l),\tilde{J}_{2}(l)\) and variance-covariance matrices: \(\mathcal{S}_{1}(l)\), \(\mathcal{S}_{2}(l)\) of the component distributions separated at \(l\), recursively. 3. Calculate summary statistics before and after \(l\), then compute the \(F\) statistic \(F_{l}\) at position \(l\). 4. Choose the point \(l\) which maximises \(F_{l}\) as the most likely change point within a window, obtain a set of change point indices, \(c_{1},c_{2},\ldots,c_{n},n\leq q\). 5. Divide data stream into segments of \(S_{1},S_{2},\ldots,S_{n}\), \(n<a\), where according to the indices of change points, and the \(S_{i}\) segment contains the sensor observations \([x_{c_{i}},\ldots,x_{c_{i+1}-1}]\). ```  
**Algorithm 1**. Chang Point-Based Data Segmentation. At the first step, the proposed change point-based segmentation method is developed based on the Multivariate Online Change detection Algorithm (MOCA) to detect transitions through the multivariate data stream, and the aim of change point detection is to identify transitions in a user's  
Figure 1: The conceptual procedure of the ensemble classification approach for activity recognition. activity so that determining the starting position of windows [37]. MOCA detects change points autonomously through an input data stream as follows: consider an input data stream of length \(q\), which consisting of a set of sensor observations \(\mathbf{x}_{1},\mathbf{x}_{2},\ldots,\mathbf{x}_{q}\). Each sensor observation \(\mathbf{x}\) is treated as one \(b\) element vector, here, \(b\) donates the number of sensor observations for each activity. The input data stream may include sensor observations with multiple distributions, for instance, \(\mathbf{x}_{1},\mathbf{x}_{2},\ldots,\mathbf{x}_{k-1}\) may follow data distribution \(D_{1}\) while \(\mathbf{x}_{k},\mathbf{x}_{k+1},\ldots,\mathbf{x}_{q}\) may follow data distribution \(D_{2}\). Therefore, the overall goal of the algorithm is to identify the position in the input data stream of significant change points \(k(1\leq k\leq q)\). Let \(\mathbf{x}_{1},\mathbf{x}_{2},\ldots,\mathbf{x}_{q}\) represents the sensor observations in the acceleration data stream acquired from the wearable accelerometer. The result of MOCA is a set of change point indices, \(c_{1},c_{2},\ldots,c_{n},n\leq q\). With the assumption that there exists a maximum of one change point per window, an analysis window of length \(n\) is passed over the input data stream. The movement of the analysis window passing over the input data stream may be distinct, for example, the start position of a new window is at \(m+cn+1\) (\(m\) donates the padding size and \(c\) donates the number of previous windows). Conversely, the sliding window may be implemented with the start position that increased by a predetermined number of sensor observations. The sensor observations within a window are donated as \(\mathbf{x}_{1},\mathbf{x}_{2},\ldots,\mathbf{x}_{n}\) despite their original position within the input data stream.