## 3 Human Activity Recognition Techniques
### Sensing Techniques
#### 3.1.2 Data Preprocessing and Feature Extraction  
The raw data collected from various sensor modalities are often noisy and high dimensional, necessitating robust preprocessing and feature extraction techniques before being applied for training machine learning algorithms and inference. This section discusses the critical steps and techniques in data preprocessing and feature extraction for HAR, considering the diverse sensor modalities involved. Data preprocessing is the first and essential step in HAR pipelines, which is aimed at preparing raw data for feature extraction and classification. Due to data heterogeneity, the major challenges include varying the sampling rates, formats, and noise characteristics associated with different sensors. The main preprocessing tasks include data cleaning, synchronization, segmentation, and transformation. Data cleaning addresses noise, missing values, and outliers that often exist in sensor data. Techniques vary depending on the sensor modality. For wearable sensors, signal noise caused by movement artifacts can be reduced by filters such as Butterworth or Savitzky-Golay. Missing data can be imputed using interpolation or predictive models. For environmental sensors, redundant or conflicting signals caused by overlapping sensor ranges can be removed using statistical methods or clustering. Filtering GPS signals collected by mobile devices by Kalman filters is common practice to account for location inaccuracies. And low-pass filters are often applied to address jitter in motion capture data on gaming devices. Incomplete posts or erroneous timestamps can be handled by natural language processing (NLP) techniques. Data synchronization and segmentation can ensure that data from different sensors align temporally and divide continuous data streams into smaller, meaningful segments. For example, timestamps can be used for the synchronization of wearable and environmental sensors. Cross-correlation can identify and correct time lags. For data segmentation, the sliding window is a common approach suitable for continuous and repetitive activities like walking or running. Event-based segmentation, which detects specific events, such as phone calls in mobile data or hand movements in VR systems, is particularly helpful in scenarios where human activities are triggered by discrete events or involve task-specific actions. Finally, data transformation, such as normalization and standardization, prepares the data for feature extraction. Feature extraction transforms preprocessed data into representative attributes that capture the essence of human activities. Features can be broadly categorized into time domain, frequency domain, and domain-specific features. Time domain features are computed directly from raw data and are straightforward to interpret. Common time domain features include statistical measures, such as mean, median, variance, and standard deviation, and the signal magnitude area (SMA), which captures the overall activity level, zero-crossing rate useful for cyclic activities, peak intensity such as steps in walking data, and autocorrelation, which measures the similarity between signal segments at different time lags to detect periodic patterns. Frequency domain features are often derived using fast Fourier transform (FFT) or wavelet transform. These features are crucial for recognizing periodic and oscillatory activities. The power spectral density (PSD), dominant frequency, and spectral entropy are often calculated for repetitive activities, while wavelet coefficients are useful for transient activities. Machine learning models benefit from feature-rich datasets, emphasizing domain-specific feature extraction. Domain-specific features leverage knowledge of the application or sensor modality to extract meaningful attributes. For wearable sensors, gait parameters, such as stride length, cadence, or joint angles using inertial data, are often extracted.