# Anomaly Detection in Elderly Health Monitoring via IoT for Timely Interventions
## 2 Materials and Methods
### Proposed Health Anomaly Detector Algorithm  
Focusing on a single dataset facilitates the identification of trends specific to each individual. This approach reduces the complexity of analysis, allowing HADA to focus on human organism specificity for prompt medical interventions. This analysis must be personalized because each patient has different physiological characteristics and lifestyles, requiring the adjustment of alert thresholds based on individual reference values. Thus, a correct interpretation of the data is ensured, optimizing treatments and preventing complications through interventions tailored to the specific needs of each individual.  
The authors chose this option due to its compatibility with Microsoft technologies. This choice was based on the native compatibility with the development environment used for the back-end, namely Visual Studio C#. A second reason stems from the ability to quickly implement anomaly detection models by accessing data from the Microsoft Azure infrastructure.  
The steps of processing and training of HADA are schematically illustrated in Figure 3 and described as follows:  
* The data is acquired from M5 Stack and transmitted to Microsoft Azure via an API request. Subsequently, through an Azure Function, the data is preprocessed, centralized, and organized into a suitable format for model training.
* The feature variables (AR, mR, MR, S, DST, and SST) are identified.  
Unlike the data used in classification and clustering models, which is scaled and normalized to eliminate any potential disproportionalities that could negatively impact model training, the data is not altered in this case. This is a particularly important remark! It must be emphasized that the authors did not remove or modify the acquired data to avoid altering potential alerts.
* The authors started the investigation by simultaneously examining all input parameters. Later, they also analyzed models with one input at a time. Additionally, various anomaly detection hyperparameters were evaluated for the Randomized PCA method. For each algorithm, hyperparameters were adjusted to identify the scenario with the best performance. Performance was determined based on standard AI model evaluation metrics. The algorithm with the best performance was selected for integration into HADA's software pipeline.
* After establishing the final HADA configuration, the model is integrated into a.NET application that runs on a local server in collaboration with Azure functionalities.
* Implement the alert emission component to ensure the system responds with the lowest possible latency.  
During the development of HADA, mechanisms for monitoring the model's performance were implemented. It is noted that the model is periodically retrained for each individual separately, as physiological changes can occur in every person's life due to aging, changes in medication, or other factors that cause alterations in the organism's usual behavior. A concrete example in this regard is a scenario where an elderly person experiences a hip fracture. Their physical activity will not be the same for an extended period. Therefore, it is periodically adjusted to maintain an accurate record of the model's performance in various usage scenarios.