# Adaptive Learning Approach for Human Activity Recognition Using Data from Smartphone Sensors
## 2 Adaptive Activity Recognition  
The proposed system for human activity recognition consists of the following components, representing data processing stages: data gathering, preprocessing, feature extraction, and training or classification [25, 26]:  
* Data gathering: A specified sampling rate is used for collecting sensor data from smartphones. * Preprocessing: At this step, the gathered raw data are transformed in a useful and efficient format. Since the data can consist of many irrelevant and missing parts, data cleaning is conducted, followed by windowing or segmentation of the data [27]. * Feature extraction: From the segmented raw data, various data features are extracted. Several types of data feature extraction analyses, such as frequency analysis (e.g., Fourier Transform) or statistical analysis (e.g., moments: Mean, Std-Deviation, 3 rd Moment, 4 th Moment, etc. ), of the available features can be applied to create new features [28]. * Training and classification:
* Training: The classifiers in an activity recognition system must be trained before they can be used. Training is a step that calculates the model parameters further used in classification. Training can be conducted either offline on a desktop computer or online on a smartphone. If offline training is used, raw data of human activities is gathered, stored on a computer, and then used in training to obtain model parameters [29]. If training is performed online, the raw data are processed immediately without storing the on the device. The model parameters obtained during training are then used in the online recognition of human activities. Classification: Human activities are classified using trained classifiers. Like in training, it can be performed either offline using a machine learning tool or online directly on the smartphone [29]. In the activity recognition process, classification is an essential part. Over the last few years, different types of classification algorithms have been implemented on smartphones such as support vector machines (SVMs), decision trees, K-nearest neighbors (KNN), fuzzy classification, and neural networks [11; 30]. As previously mentioned, supervised learning can be used to train activity recognition models for smartphones in either an online or offline mode. In an online mode, the classifiers are trained on smartphones in real-time, whereas in an offline mode, the classifiers are trained beforehand, typically on a computer. Likewise, there are two alternatives for using the trained model to perform classification--locally on the device (offline and real-time) or in the cloud (online). These options have a significant effect on speed, power, privacy, and cost [15]. For example, if the cloud is used to make a prediction, the application must be connected to the internet, whereas if the predictions are performed locally on the device, some hardware constraints must be met. In this case, a smartphone might not be able to perform any type of machine learning due to RAM and CPU limitations. Performing classification directly on the device (in an offline mode) might be useful in cases where an application cannot rely on network connectivity. In this case, speed and reliability are the main advantages because all sensor data are processed and used in real-time predictions locally on the smartphone, without sending requests to the cloud online. However, in the case of a static offline trained model, it is challenging to update the training model once it is being used to make predictions. The model might become out-of-date over time and stop working exactly as expected. Subsequently, it must be re-trained with more or newer data and updated with the application which contains it. On the other hand, in the cloud, the model can be continuously updated. Thus, it will be unnecessary to update the application of human activity recognition. And in the case of re-training, the updated model will be available to all users [31].