## 2 Data Analysis Methodology  
The main component of the IoT system is a Fibit Versa smart wearable, which records raw data and forwards it to a private server. It was determined to be the main source of data needed to detect early signs of frailty based on [PERSON]'s phenotype [8]. The data acquisition protocol involved recording data concerning the performance of different activities for a limited period. In Figure 1, the general architecture and main data flow are illustrated. The captured data frame has eight values from four built-in input sensors:  
* an accelerometer which outputs x, y, and z accelerations;
* a gyroscope sensor, with px, gy, and gz representing the rotation around each axis;
* an orientation sensor, with \(q_{0}\) representing the scalar part of the quaternion and \(q_{1}\), \(q_{2}\), and \(q_{3}\) representing the factors of the quaternion;The data frame is presented in Table 1. The system's input data are ingested by a data processing (DP) module. In this data frame, activity represents the type of activity recorded and timestamp indicates the time the data were recorded. An accelerometer is used for frailty detection and an orientation sensor gives additional insights (this sensor can give output related to the rotation of the individual). The heart rate monitor sensor is used to distinguish between activities with different accelerations and orientation quaternion amplitudes (for example, activities which require short movements of the arms, but which require high energy usage).  
As Figure 1 shows, four components of the system can be distinguished:  
* The data capture module, represented by the smartwatch with input sensors. This module is represented by a system which had been previously designed, developed, and tested to record raw data obtained from smart watches [22].  
\begin{table}
\begin{tabular}{c c c c c c c c c c c} \hline \hline activity x & y & z & gx & gy & gz & \(q_{0}\) & \(q_{1}\) & \(q_{2}\) & \(q_{3}\) & W & timestamp \\ \hline \hline \end{tabular}
\end{table}
Table 1: Data frame structure.  
Figure 1: General architecture of IoT system and main data flow.  
* The data processing component, responsible for removing noise and normalizing data for other components. It prepares data in different input formats so that they can be used by the plotter and the analyzer;
* The activity data plotter, represented by a MATLAB module.
* The machine learning algorithms analyzer, represented by a python module which automatically sets parameters for each classifier based on user input, trains models, and tests the performance of each one. This module handles multiple classifiers, including logistic regression, decision tree, random forest, gradient boosting, KNN, support vector machines (SVMs), and Gaussian naive Bayes. It is composed of the following: \(\odot\) Parameter setting, which automatically sets the parameters for each classifier based on the user's input. Parameters play a crucial role in machine learning algorithms as they define the behavior of the models during training. By allowing users to input their desired parameters, the module ensures flexibility and customization. \(\odot\) Model training, which takes the specified parameters and trains models for each classifier. Training involves feeding the model with labeled input data (known as the training set) and allowing it to learn patterns and relationships within the data. \(\odot\) Performance evaluation, which tests the performance of each model after it has been trained. Performance evaluation is essential to determine how well the models generalize to unseen data. Common evaluation metrics include accuracy, precision, recall, and F1 score. \(\odot\) Classifiers, several of which are supported, each with its own characteristics and advantages.