## 3 Proposed Methodology  
### Generalized Machine Learning Hurdle Model  
The hurdle model is a statistical approach designed to handle count datasets characterized by an excess of zero outcomes. This is particularly relevant in the crash frequency analysis, where the number of crashes recorded for different segments of a road network can exhibit a large number of zero counts due to the absence of crashes in many segments during a specified observation period. Given a set of covariates X, the hurdle model for crash frequency can be formally specified as follows [29]:  
\[\mathrm{P}(\mathrm{Y}=\mathrm{C}\mid\mathrm{X})=\left\{ \begin{matrix}\pi(x),& \quad if\;C=0\\ (1-\pi(x))\!\cdot\!f(C;\lambda(X)),&\quad if\;C>0\end{matrix} \right. \tag{1}\]  
where the probability of observing a crash count \(C\), given a set of explanatory variables \(X\), is modeled by a piecewise function. If \(C\) equals zero, the probability is denoted by \(\pi(x)\), representing the likelihood of observing no crashes. On the other hand, if \(C\) is greater than zero, the probability is a product of two terms: \((1-\pi(x))\), and a probability mass function \(f(C;\lambda(X))\). This probability mass function characterizes the distribution of positive crash counts and is typically modeled by a distribution suitable for count data, like the Poisson or negative binomial distribution, with \(\lambda(X)\) symbolizing the parameter of the distribution--generally the mean rate of crashes, which is formulated as a function of the covariates \(X\). The binary component \(\pi(x)\) serves as a \"hurdle\" that the model must overcome to observe positive counts. Subsequently, the count component \(f(C;\lambda(X))\) elucidates the distribution of crash counts conditional upon surpassing the hurdle, signifying that at least one crash has occurred. The expected value of the crash count, conditional on \(X\), especially for non-zero outcomes, is then given as follows:  
\[E[Y\mid X]=P(Y>0\mid X)\cdot E[Y\mid Y>0,X]+P(Y=0\mid X)\cdot E[Y\mid Y=0,X] \tag{2}\]  
\[E[Y\mid X]=P(Y>0\mid X)\cdot E[Y\mid Y>0,X] \tag{3}\]  
where \(E[Y\mid Y>0,X]\) is the expected value of the count variable Y given that at least one event (crash) has occurred, derived from the positive part of the hurdle model. The overall expectation effectively adjusts the expected count to account for the hurdle at zero. The absence of the term \(P(Y=0\mid X)\cdot E[Y\mid Y=0,X]\) is justified by the fact that this term equals zero, since \(E[Y\mid Y=0,X]\) is inherently zero. Hence, it does not contribute to the expectation and is excluded from the equation. The traditional model employs a binary choice model, usually as logistic regression, to estimate the probability of a non-zero count, \(P(Y>0\mid X)\), followed by a truncated count data model, such as the Poisson or negative binomial model, to estimate \(E[Y\mid Y>0,X]\). However, this conventional methodology may fall short when faced with the high-dimensional and complex nature of transportation data, necessitating a more nuanced approach. For improved crash frequency analysis, a two-stage machine learning-based framework is proposed. It is built upon the foundation laid by the hurdle model. This proposed framework adapts the traditional hurdle model to accommodate a broader set of predictive factors and potential non-linearity in the data, enhancing its applicability to real-world scenarios, where the crash frequency is influenced by complex and often interrelated factors. The first stage harnesses machine learning to ascertain the binary likelihood of crash occurrence, effectively segmenting road sections into those without incidents and those with potential incidents. Subsequently, the second stage applies machine learning to estimate the frequency of crashes given their occurrence, thereby addressing the conditional aspect of the distribution.