# Cyber-Secure IoT and Machine Learning Framework for Optimal Emergency Ambulance Allocation
## 3 Methodology
### Variable Design and Data Preprocessing
To ensure data quality and integrity, we collaborated with the National Fire Agency to identify  
Figure 3: Multi-stage data preparation process for EMS deployment modeling. and remove outliers and missing values based on domain expert assessments. Where appropriate, statistical imputation techniques were applied to correct for missing data. In addition, reverse geocoding procedures were performed to convert geographic coordinates (latitude and longitude) into standardized administrative district codes and addresses. This process ensured spatial alignment across datasets from heterogeneous sources, thereby enhancing the consistency and reliability of the integrated dataset. Numerical input variables used in the model were scaled using either min-max normalization or z-score standardization, depending on distribution characteristics. Categorical variables (e.g., urban vs. rural classification, hospital types) were converted into numeric form using one-hot encoding. An initial set of approximately 20 candidate variables was considered. To mitigate overfitting and multicollinearity, Lasso regression was applied, resulting in the selection of six key predictors with high explanatory power. These selected variables were subsequently used for training tree-based machine learning models, including Random Forest, XGBoost, and LightGBM. Considering the heterogeneous and dynamic nature of EMS data, characterized by spatial variability in population distribution, temporal fluctuations in emergency dispatch frequency, and complex nonlinear interactions among multiple explanatory variables, this study employed ensemble-based tree models including Random Forest, XGBoost, and LightGBM. These models are particularly well suited for high-dimensional structured data with intricate relationships, as they offer robustness against multicollinearity, capture nonlinear patterns without the need for extensive feature transformation, and provide interpretable metrics such as variable importance for policy-relevant insights [29]. In parallel, a supplementary dataset was constructed to support visualization of prediction results and policy-oriented interpretation. This dataset incorporated spatial information on hospital capacity, emergency medical facility distribution, and regional accessibility. It was designed to help policymakers intuitively assess local resource allocation needs. Figure 4: Temporal patterns of route-specific traffic volume (2018–2023). The jurisdiction of each 119 emergency center was standardized under a unified naming convention, and hospital information within a 10-kilometer radius of each center was collected. This process included the deduplication of medical facilities and geocoding of hospital locations. Additional filtering criteria--such as number of available beds, operating hours, and emergency service capability--were applied to refine the hospital dataset. Measures of distance and accessibility between centers and hospitals were then computed and merged into the final dataset. Using the results from the feature importance analysis, the top-ranked variables were employed to generate spatial weight maps and predicted response times, visualized at the administrative district level. This dual-dataset structure supports both predictive modeling and policy simulation on an empirical basis, moving beyond conventional experience-based decision-making toward data-driven ambulance deployment strategies. Missing values were addressed through tailored strategies based on the characteristics and distribution patterns of each variable. When the missingness was determined to be completely at random or statistically predictable, appropriate imputation techniques such as mean substitution, median replacement, or linear interpolation were applied. For critical variables where missing values were logically implausible, the corresponding records were excluded entirely to ensure data integrity.