## 2 Materials and Methods  
To improve the ability to predict the disposition of patients at emergency department triage, we utilized a machine learning-based approach. We utilized the Gradient Boosting Machine (GBM) algorithm, a powerful ensemble method that builds an additive model in a forward stage-wise manner [29]. The GBM optimizes arbitrary differentiable loss functions and can handle a mix of categorical and numerical input features, which suits our data. The implementation of our predictive model using the Gradient Boosting Machine (GBM) was performed in Python, leveraging several libraries for data preprocessing, model training, and interpretability analysis. The main libraries used include Pandas for data manipulation, NumPy for numerical operations, scikit-learn for model training and evaluation, SHAP (Shapley Additive Explanations) for enhancing model interpretability, and Matplotlib and Seaborn for visualization. Our approach, which integrates a Gradient Boosting Machine (GBM) with Shapley Additive Explanations (SHAP), is systematically outlined in Algorithm 1. The algorithm delineates the sequence of operations, from data preprocessing to model training and interpretation using SHAP values. It provides the pseudo-code necessary for replicating our model, specifying the parameters used, the iteration process, and the calculation of SHAP values for feature importance analysis. ```
Input: Dataset D from the MIMIC-IV-ED, features F, target outcome T (admission status)
1: Data Preparation: 1. Retrieve dataset D from the MIMIC-IV-ED database. 2. Clean D by handling missing values and outliers. 3. Encode categorical features in F using one-hot encoding. 4. Normalize or standardize numerical features in F. 5. Split D into training set D_train (80%) and testing set D_test (20%) using stratified sampling. 2: Model Training with GBM: 1. Define GBM parameters (learning rate, number of trees, depth of trees, etc.). 2. Train the GBM model on D_train predicting target T. 3. Validate the model on D_test with performance metrics (Accuracy, Precision, Recall, F1 Score, AUC). 3: SHAP Value Calculation for Feature Importance: 1. Apply SHAP to the trained GBM model to compute the contribution of each feature in F. 2. Rank features by the magnitude of their SHAP values. 4. Model Interpretation: 1. Generate SHAP summary plot for global feature importance from D_test. 2. Produce SHAP dependence plots to examine interactions among top features (\"Acuity\", \"Hours\", \"Age\"). 3. Create SHAP force plots for individual prediction interpretation. 5. Results Analysis and Validation: 1. aAnalyze the GBM model's performance on D_test. 2. Interpret the SHAP plots for actionable clinical insights. 3. Assess the model's generalization capability through its performance metrics. ```  
**Output:** Trained GBM model, SHAP values for feature importance, interpretative plots for clinical decision support. Furthermore, to facilitate a clearer understanding, we introduce a flowchart explaining the step-by-step process (Figure 1). This visual representation maps the entire process of our method, beginning with data collection from the MIMIC-IV-ED database, data preprocessing, training the GBM model, and finally applying SHAP for interpretability. Our data were retrieved from the MIMIC IV database, which provides a rich and reliable source for healthcare-related studies [15]. In our research, we utilized a comprehensive set of features from the MIMIC-IV-ED dataset to develop our predictive model. These features include age, means of arrival/transport, vital signs collected at triage (patient temperature, heart rate, respiratory rate, oxygen saturation, systolic blood pressure, and diastolic blood pressure), pain intensity, acuity (based on the triage assessment, where the care provider assigns an integer level of severity ranging from 1 for the highest severity to 5 for the lowest severity), final disposition (admission/discharge), and total waiting time in hours.