# Short-Term Traffic Flow Forecasting via Multi-Regime Modeling and Ensemble Learning
## 3 Methodology
### Regime Identification Based on Probabilistic Modeling
#### 3.2.1 Regime Identification  
In the study, the regime identification model based on HMM is defined and characterized with the following elements. 1. A set of hidden states \(S=\{s_{1},s_{2},\ldots,s_{N}\}\), where each hidden state \(s_{j}(1\leq j\leq N)\) describes the \(j\)th regime of traffic flow. \(N\) is the number of hidden states. Specifically, the state at time \(t\) is denoted as \(q_{t}\). Figure 1: Overall framework of the proposed approach. A set of observation symbols \(V=\{v_{1},v_{2},\ldots,v_{M}\}\), where each observation symbol \(v_{k}(1\leq k\leq M)\) describes the \(k\)th observation of a traffic flow measure. \(M\) is the number of observation symbols. 3. A state transition probability distribution \(A=\left\{a_{ij}\right\}_{i=1|j=1}^{i=N|j=N}\), where \[a_{ij}=p\Big{[}q_{t+1}=s_{j}\Big{|}q_{t}=s_{i}\Big{]},\qquad\qquad a_{ij} \geq 0.\] (1) \(A\) describes the evolving probability distribution of the analyzed traffic flow from one of the defined regimes to another. Specifically, \(a_{ij}\) describes the probability of the analyzed traffic flow evolving from regime \(s_{i}\) to regime \(s_{j}\). 4. The observation symbol probability distribution \(B=\left\{b_{j}(k)\right\}\) in state \(s_{j}\), where \[b_{j}(k)=p\Big{[}v_{k}\text{ at }t\Big{]}q_{t}=s_{j}\Big{]},\] (2) \(B\) describes the generation probability of the observations of the analyzed traffic flow in each regime. Specifically, \(b_{j}(k)\) describes the generation probability of the \(k\)th observation of the analyzed traffic flow in regime \(s_{j}\). 5. The initial state distribution \(\pi=\{\pi_{i}\}\), where \[\pi_{i}=p[q_{1}=s_{i}],\qquad\qquad 1\leq i\leq N.\] (3) \(\pi\) describes the probability of the initial regime of the analyzed traffic flow. Specifically, \(\pi_{i}\) is the probability of the initial regime equaling to \(s_{i}\). Given an observation sequence of a traffic flow measure \(O=O_{1},O_{2},\ldots,O_{T}\), the regime identification model aims to identify the corresponding regime sequence \(Q=q_{1},q_{2},\ldots,q_{T}\), based on the determined values of \(N\), \(M\), \(A\), \(B\), and \(\pi\). As mentioned above, the hidden state set \(S\) defines the regimes of traffic flow. Each regime describes a homogeneous traffic condition. According to the fundamental diagram in traffic flow theory and a series of relevant studies [37; 38; 39; 40; 41], five distinct regimes could be defined in practice, as shown in Figure 2. The first two regimes, Regime 1 and Regime 2, describe two kinds of free-flow traffic conditions, while the last two regimes, Regime 4 and Regime 5, represent two categories of congested traffic conditions. The third regime, Regime 3, defines a transition condition from the free-flow stage to the congested stage. Therefore, the number of hidden states in the study, \(N\), is set as five. Figure 2: Regimes defined in the traffic fundamental diagram. The observation symbols in the identification model are associated with the values of the traffic flow measures. For example, the speed measure in short-term traffic flow forecasting is usually recorded every 5 min, and its value range determines the representation space of the observation symbols. However, in practice, the value range is usually large, resulting in many observation symbols and hence in a high computational complexity of the model. To effectively tackle the problem, a simple discretization strategy is employed, in which the measure values are discretized into multiple relatively large and equal numerical intervals (e.g., \(0\sim 5,\ 5\sim 10,\ 10\sim 15\)). For the other two measures, a similar strategy can be adopted. Based on the strategy, \(M=\lceil\frac{\alpha_{max}-\alpha_{min}}{\alpha_{int}}\rceil\), where \(o_{max}\) and \(o_{min}\) are the maximum and minimum of the measure values, respectively, and \(o_{int}\) is the size of the divided numerical interval. The remaining three parameters, \(A\), \(B\), and \(\pi\), need to be determined by training the probabilistic model using the traffic flow observations.