## 2 Materials and Methods
### Feature Selection for Physical Activity Detection  
Previous work [15] demonstrated that it is feasible to use artificial intelligence classification models to classify different activity types. In a frailty context, the aim is to assess for how much time a person performs a certain physical activity. This information is used to determine different frailty insights, such as daily energy expenditure, physical activity levels, and daily sedentary times. Data were collected for four types of activities: Fast walk (the subject is walking at a fast pace), Slow walk (the subject is walking at slow pace), Resting (the subject is standing still), and Climbing upstairs (the subject is going up a staircase). _By using data acquired from a smartwatch's sensor, the aim is to determine four main activities performed by an elderly person during a day: resting, walking, running, and climbing stairs. For these activities, five one-minute recording sessions were carried out. A five-minute pause was taken between sessions to avoid data compromise. The sensors (Fitbit Versa built-in sensors: accelerometer, gyroscope, orientation sensor, and optical sensors) were set to record data ten times per second (except the optical sensor, which only recorded one datum per session) [15]. Data recording sessions were  
Figure 5: Non-relational database structure. performed by one healthy individual, with an average weight and height and no health conditions, classified as non-frail. Based on our previous analysis detailed in [PERSON] et al. (2023) ([PERSON] et al., 2023), the decision tree classifier (DTC), random forest classifier (RFC), and gradient boosting classifier (GBC) models were identified as the most reliable in terms of performance. This selection was made after comparing these models against other algorithms, such as logistic regression (LR), k-nearest neighbors (KNN), support vector (SVC) and Gaussian naive Bayes (GNB) classifiers. The chosen models demonstrated remarkable consistency in their performance metrics across diversified datasets ([PERSON] et al., 2023), making them the optimal choice for developing a high performance classifier for activities. A total of 5515 data samples was recorded using smartwatch sensors, annotated using the methodology presented by [PERSON] et al. 2023 ([PERSON] et al., 2023). The set has the following attributes:  
* Accelerometer_x, Accelerometer_y, and Accelerometer_z--accelerations (m/s\({}^{2}\)), obtained from the accelerometer sensor; and AccMagnitude--vector magnitude derived from accelerations (m/s\({}^{2}\));
* Gyroscope_x, Gyroscope_y, and Gyroscope_z--angular velocities (rad/s), obtained from the gyroscope sensor;
* Roll, pitch, and yaw--rotation angles in three angles, derived from quaternions (rad), obtained from the orientation sensor;
* Activity: annotated type of activity for models to distinguish between (resting, walking, running, and stair climbing). To identify the optimal set of attributes, considering the three chosen algorithms, a routine was developed that takes the default dataset as the input and calculates all possible feature combinations, ranking them based on their performance. To assess the performance of a combination, accuracy, a specific machine learning metric, was used. Accuracy is the ratio between the correct predictions and the total number of predictions, in this specific case, the ratio between the correct classifications and total classifications. Considering that the default attribute set has 10 features, the total number of feature combinations is \(2^{10}-1\), meaning 1023 possibilities. To check each possibility's performance, the Python class concurrent.futures library was used. This library provides the capability of asynchronous execution of code, using a pool of processes that are running in parallel. The number of processes is defined by the max_workers variable, allowing multiple CPU cores to execute instructions concurrently.