## 2 Methodology
### Profile Extraction Algorithm  
Raw sensor data collected from elevator systems typically encompass a large collection of data points sampled at high frequency. In order to feed large sensor data to cloud-based applications, it is often desirable to pre-process the data and perform compression before transmission, for example in the form of edge computing performed in the device end. Here we assume that raw data is in the form of a one-dimensional time-series vector with equidistant sampling times. The goal of the proposed  
Figure 1: Fault detection approach (Acc and Mag represent acceleration and magnetic signals respectively). method is to compress the raw time series obtained from machinery while maintaining the information about key events, and secondly, to make the data more applicable for machine learning. The algorithm works in two stages. In the first stage, the signal is pre-processed and normalized, followed by low-pass filtering. The low-pass filtered signal is used for peak detection, which for each elevator travel detects a local minimum and maximum corresponding to acceleration and deceleration (start and stop) events. The algorithm uses crude low-pass filtering with a low cut-off frequency for peak detection, which ensures that a sustained period of acceleration is required for a peak to be registered. This prevents short bursts of noise from being detected as a movement window. Low-pass filtering is applied to ensure that only a sustained acceleration or deceleration event is registered as a peak as opposed to noise. Low-pass filter is used to avoid noise spikes being detected as peaks. From low-pass filter signal, the algorithm cannot detect the precise magnitude or timing of peaks, but it will detect the approximate region in which to align the event profiles. Unfiltered data is then used for profile alignment. In the second stage, alignment and collection of equal length profiles is performed based on windowing of the acceleration signal near the peak events. In this stage, the raw acceleration signal is used instead of the filtered signal. A number of time domain alignment methods have been proposed in the literature. Dynamic time warping (DTW) has been commonly applied, e.g., in speech recognition [35], whereas various alignment techniques for sensor data have been presented in [36]. Here alignment is performed against a reference profile. The reference profile is aligned against the raw data in the window of the detected peaks. The length of the initial profile window \(m\) is selected empirically based on the sample frequency and the maximum estimated length of the elevator acceleration events. The criterion for optimal alignment was defined as the alignment that minimizes the sum of the Euclidean or \(L_{2}\) norm. The output from this operation is an \(n\times m\) matrix of aligned profiles describing \(n\) acceleration and deceleration events of length \(m\). To improve the alignment accuracy, the reference profile is updated iteratively following each batch run. Each sequence in the profile matrix is closely synchronized in time and can hence be considered a repetition of the same signal. Using signal averaging, the new reference profile is calculated as the mean of the n extracted profiles. This both maintains the main characteristics of the signal and reduces the noise. Assuming white noise and perfect synchronization, signal averaging improves the signal-to-noise ratio (\(SNR\)) by a factor of \(\sqrt{n}\). Information in the obtained reference profile can be used to update the window size \(m\). Assuming an overestimated size of the event window, the averaged reference profile will contain superfluous close to zero values corresponding to no acceleration. The number of elements \(s\) below this threshold in the reference profile can be used to estimate the optimal window length by reducing the window length \(m\) by \(s\) for the following iteration. The off-line profile extraction algorithm is described as following. **Off-line profile extraction algorithm**  
_Pre-process_  
1.