## 3 Proposed Methodology
### Model Interpretability  
Upon completing the training and construction of the model, the necessity for interpretability becomes paramount to understand the influence of variables on the predicted outcomes, particularly how road geometry factors affect crash frequency. Traditional statistical models offer insights into variable weights directly, enabling straightforward sensitivity analysis. However, machine learning models are often perceived as \"black boxes\" due to their complex internal mechanisms, making the task of interpreting these models more challenging. In recent years, efforts have been made to develop methodologies to allow for the interpretability of machine learning models to reveal their inner workings. Among these methodologies, SHAP (SHapley Additive exPlanations) stands out as a powerful tool for model interpretability. SHAP leverages the concept of Shapley values from cooperative game theory, providing a robust framework to attribute the prediction of a model to its input features. The Shapley value is a method to fairly distribute the \"payout\" (prediction) among the \"players\" (features), based on their contribution to the outcome.  
Mathematically, the contribution of a feature value to a prediction is determined by comparing what a model predicts with and without the feature, averaged over all possible combinations of other features. For a given prediction, the SHAP value of a feature is the average marginal contribution of that feature across all possible coalitions. Formally, for a prediction model f and a feature set S excluding the feature \(i\), the Shapley value \(\phi_{i}\) is calculated as follows:  
\[\phi_{i}=\sum_{S\subseteq N\setminus\{i\}}\frac{|S|!(|N|-|S|-1)!}{|N|!}[f(S \cup\{i\})-f(S)] \tag{12}\]  
where \(N\) is the set of all features, \(S\) is a subset of features excluding \(i\), \(|S|\) is the cardinality of \(S\), and \(f(S)\) represents the model prediction with features in \(S\).  
The term \(f(S\cup\{i\})-f(S)\) represents the marginal contribution of feature \(i\) to the prediction. This measures how much the feature \(i\) changes the model's prediction when added to the subset \(S\) of other features. The summation involves averaging this marginal contribution over all possible subsets of features \(S\) that do not include \(i\). This ensures that the contribution of \(i\) is fairly evaluated in the context of all possible interactions with other features. The weighting factor \(\frac{|S|!(|N|-|S|-1)!}{|N|!}\) ensures that each subset combination is given an appropriate weight. This factor is derived from combinatorial principles, ensuring that contributions from features are fairly balanced regardless of their position or the number of other features. SHAP values fairly distribute the total difference between the model's actual prediction and a baseline value (e.g., the mean prediction) among all features. This ensures that each feature's contribution is assessed in the context of its interactions with all other features. In summary, the SHAP value calculation takes into account all possible scenarios in which a feature interacts with other features, making it a powerful tool for capturing both the main effects and the interaction effects of the feature on the prediction. By aggregating these values, SHAP offers a comprehensive view of how each feature contributes to the model's predictions, whether by increasing or decreasing the predicted outcome.  
In the context of the proposed two-component framework (classification and regression), interpretability is applied separately to each component. For the classification stage, SHAP analysis identifies factors contributing to crash occurrence, while for the regression stage it determines factors influencing crash counts. This dual approach to interpretability mirrors the structure of traditional two-part models, such as hurdle models and zero-inflated models, which also produce separate sets of coefficients for each component of the analysis.