# Cyber-Secure IoT and Machine Learning Framework for Optimal Emergency Ambulance Allocation
## 3 Methodology
### Development of Predictive Models for Emergency Resource Allocation  
The development of the proposed model was designed to optimize the nationwide deployment of 119 emergency ambulances in Korea, with an emphasis on achieving both high predictive accuracy based on empirical data and practical applicability for policy implementation. A supervised regression modeling framework was employed, integrating EMS dispatch records with variables such as population demographics, traffic metrics, and medical infrastructure to construct the learning dataset. The training dataset included preprocessed input variables such as the proportion of critical patients, the total and elderly population within each jurisdiction, the ratio of dispatches to available ambulances, traffic indices for general and express roads, average transfer time, alcohol consumption rate, and the density of food establishments. To enhance model efficiency, Lasso regression was applied to identify optimal variable combinations, mitigate multicollinearity, and extract sparsity-weighted coefficients for feature selection. Three tree-based ensemble regression models--Random Forest, XGBoost, and LightGBM--were implemented and comparatively evaluated. Random Forest offers strong resistance to overfitting, maintains high interpretability, and is relatively easy to implement. XGBoost provides superior generalization performance through L1 and L2 regularization and leverages sequential learning via gradient boosting, yielding high predictive accuracy. LightGBM, while structurally similar to XGBoost, is better suited for large-scale applications due to its high computational efficiency and ability to handle high-dimensional data using parallel processing, making it advantageous for real-time operational deployment. From a mathematical perspective, the core algorithms used in this study are based on distinct learning principles. Random Forest is an ensemble method that aggregates the output of multiple decision trees trained on bootstrapped samples. Its predictive output is expressed as  
\[\hat{y}=\frac{1}{T}\sum_{t=1}^{T}f_{t}(x)\]  
where \(f_{t}(x)\) represents the prediction from each individual decision tree, and \(T\) denotes the total number of trees in the ensemble [30]. Figure 5: Visualization-oriented data pipeline for EMS and hospital integration. XGBoost, an advanced implementation of gradient boosting, optimizes a regularized objective function defined as follows:  
\[L(\phi)=\sum_{i=1}^{n}l(y_{i},\hat{y}_{i})+\sum_{k=1}^{K}\Omega(f_{k})\]  
\[\Omega(f)=\gamma T+\frac{1}{2}\lambda\|w\|^{2}\]  
This formulation enables robust regularization and efficient convergence through second-order gradient approximation, which is a key advantage of XGBoost over traditional boosting methods [31]. Lasso regression employs L1-penalization to enforce sparsity in feature selection. Its optimization objective is  
\[\text{min}\beta\Bigg{\{}\frac{1}{2n}\sum_{i=1}^{n}\left(y_{i}-x_{i}^{T}\beta \right)^{2}+\lambda\sum_{j=1}^{p}\bigl{|}\beta_{j}\bigr{|}\Bigg{\}}\]  
where \(\lambda\) controls the strength of the penalty term. This formulation promotes model sparsity by shrinking less informative coefficients toward zero, thereby facilitating feature selection [32]. Hyperparameters for each model were independently tuned to maximize learning stability and minimize overfitting. Detailed parameter configurations for each model are provided in Section 4.1. For the Lasso regression, the regularization parameter alpha was set to 0.001, allowing for the extraction of sparse coefficients from the most relevant predictors while promoting model simplification. Model training was conducted using Python 3.10, employing libraries such as Scikit-learn, LightGBM, and XGBoost. An 80:20 train-validation split was applied, followed by 5-fold cross-validation to assess both the average performance and variance across folds.