## 3 Materials and Methods
### Machine Learning Algorithms for Fall Detection
#### 3.4.2 Steps Involved in Developing AI Algorithms for Fall Detection  
**Data Acquisition with GaitBand**: The process begins with collecting movement data using the GaitBand, which captures real-time acceleration data essential for detecting patterns indicative of falls. The raw data consists of multiaxis acceleration signals that capture various types of movements and potential fall events. For the purposes of model training and evaluation, both typical daily activities and simulated fall scenarios were performed and recorded under controlled conditions (e.g., jumping, walking, sitting, standing, and intentional falls in four directions--forward, left side, right side, and backward), resulting in a dataset that is both realistic and suitable for analysis. The data was collected from five adult subjects, all members of the development team, who voluntarily participated in the data recording process. Given that no sensitive personal data was recorded and the participants were fully informed and consenting team members, no formal ethical approval was required for this preliminary study.  
**Data Storage in ICIPRO Cloud**: Once the data is collected, it is transferred to ICIPRO Cloud for secure storage and management.  
**Data Preparation for Training and Testing**: The next step involves preparing the data for the machine learning algorithms by splitting it into training and testing sets. The raw sensor data, which includes time-stamped X, Y, and Z-axis acceleration values, is transformed. The magnitude of the acceleration is computed using the Euclidean norm, simplifying the data into a single value that reflects overall movement intensity. The dataset is then divided into training (80%) and testing (20%) sets, and a random seed is applied to ensure the split is consistent and reproducible in future runs. The method for calculating total acceleration is presented in Equation (1), where Ax, Ay, and Az represent the acceleration along each axis, and M is the magnitude.  
\[\text{M}=\sqrt{\text{A}_{\text{x}}^{2}+\text{A}_{\text{y}}^{2}+\text{A}_{ \text{z}}^{2}}, \tag{1}\]  
**Algorithm Development and Training**: Various AI algorithms are then developed and trained using the training dataset. These models are fine-tuned with grid search to optimize hyperparameters for better performance in recognizing fall patterns. To improve the robustness of fall detection and reduce the risk of overfitting, classification decisions were aggregated over sliding windows of 30 s with a step size of 20 s. This window size was selected because fall events generally happen within a 30 s period, allowing the model to adequately represent the temporal progression of a fall.  
**Model Evaluation using Accuracy**: Finally, the trained models are evaluated on the test dataset. Accuracy is the primary metric used to assess how well the model performs in detecting falls, providing insight into the model's ability to generalize to new, unseen data.  
Figure 4 shows the diagram for gathering acceleration data in real time with a GaitBand and analyzing it with machine learning algorithms.  
To further validate the models during the training phase and to reduce the risk of overfitting, 5-fold cross-validation was employed, applied exclusively to the training set. In this approach, the training data is partitioned into 5 equally sized folds; the model is trained iteratively on 4 folds and validated on the remaining fold. The process is repeated 5 times, with each fold serving once as the validation set.