Learning Car-Following Behaviors Using Bayesian Matrix Normal Mixture Regression
Chengyuan Zhang Kehua Chen Meixin Zhu Hai Yang Lijun Sun













Learning Car-Following Behaviors Using Bayesian 
Matrix Normal Mixture Regression
    Chengyuan Zhang^1, Graduate Student Member, IEEE,
 Kehua Chen^2,3, Graduate Student Member, IEEE,

 Meixin Zhu^4,5, Member, IEEE,
 Hai Yang^3,
 and Lijun Sun^1, Senior Member, IEEE,
(Corresponding author: Meixin Zhu)
^† Chengyuan Zhang and Kehua Chen contributed equally to this work.
^1C. Zhang and L. Sun are with the Department of Civil Engineering, McGill University, Montreal, QC H3A 0C3, Canada. E-mail addresses:
enzozcy@gmail.com (C. Zhang), lijun.sun@mcgill.ca (L.
Sun).
^2K. Chen is with Division of Emerging Interdisciplinary Areas (EMIA), Academy of Interdisciplinary Studies, The Hong Kong University of Science and Technology, Hong Kong, China.
^3K. Chen and H. Yang are also with Department of Civil and Environmental Engineering, The Hong Kong University of Science and Technology, Hong Kong, China.
^4M. Zhu is with Intelligent Transportation Thrust, Systems Hub, The Hong Kong University of Science and Technology (Guangzhou), Guangzhou, China.
^5M. Zhu is also with Guangdong Provincial Key Lab of Integrated Communication, Sensing and Computation for Ubiquitous Internet of Things, Guangzhou, China.

    April 29, 2024
====================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================






Learning and understanding car-following (CF) behaviors are crucial for microscopic traffic simulation. Traditional CF models, though simple, often lack generalization capabilities, while many data-driven methods, despite their robustness, operate as “black boxes" with limited interpretability. To bridge this gap, this work introduces a Bayesian Matrix Normal Mixture Regression (MNMR) model that simultaneously captures feature correlations and temporal dynamics inherent in CF behaviors. This approach is distinguished by its separate learning of row and column covariance matrices within the model framework, offering an insightful perspective into the human driver decision-making processes. Through extensive experiments, we assess the model's performance across various historical steps of inputs, predictive steps of outputs, and model complexities. The results consistently demonstrate our model's adeptness in effectively capturing the intricate correlations and temporal dynamics present during CF. A focused case study further illustrates the model's outperforming interpretability of identifying distinct operational conditions through the learned mean and covariance matrices. This not only underlines our model's effectiveness in understanding complex human driving behaviors in CF scenarios but also highlights its potential as a tool for enhancing the interpretability of CF behaviors in traffic simulations and autonomous driving systems.















§ INTRODUCTION

Car-following (CF) maneuver involves the interactive response of the following vehicles (FV) dictated by the states of the leading vehicles (LV) in the longitudinal direction <cit.>. 
As a vital component in microscopic traffic analysis, accurately modeling CF behaviors benefits traffic management and the development of autonomous driving. Therefore, researchers have dedicated efforts to CF models over the past several decades <cit.>.

Early studies developed models based on traffic theory and human behaviors, such as Gipps' model <cit.>, Newell model <cit.>, and Intelligent Driver Model (IDM) <cit.>. Although traditional models have clearly defined formulas with high interpretability, these models have low complexity and cannot capture complex temporal dynamics. With the thriving of data-driven methods, a number of studies utilized advanced deep learning techniques to model CF behaviors, such as deep reinforcement learning <cit.> and Recurrent Neural Networks (RNNs) <cit.>. While the aforementioned data-driven approaches attain satisfactory accuracy, it is important to note that they function as black-box models with limited interpretability, and lack the capability to quantify uncertainties.

To capture the stochasticity of human behaviors while maintaining reasonable interpretability, some studies modeled CF behaviors from Bayesian perspectives, such as using the Gaussian Mixture Model (GMM) <cit.>. GMM is widely adopted since it explicitly models the uncertainty in the parameters, providing a better understanding of the model's confidence in its predictions. This is crucial in applications with safety-critical driving tasks, where understanding the uncertainty of the model can help human drivers make better decisions. Besides, apart from GMM capturing stochasticity, it is also good at depicting nonlinear human behaviors with explainable modalities. For instance, Angkititrakul et al. <cit.> employed GMM and piecewise auto-regressive exogenous algorithms to model CF behaviors. 
Afterward, the authors enhance the model structure, enabling non-parametric Bayesian modeling of CF behaviors <cit.>.
Lefevre et al. <cit.> conducted a comparison between parametric and non-parametric methods for CF modeling. They observed that the relative performance of the various models exhibited significant variations depending on the prediction horizon. Recently, Chen et al. <cit.> used a Bayesian GMM to achieve probabilistic modeling of CF. In their study, they developed an inference algorithm using Gibbs sampling and provided an analysis of model interpretability. Based on GMM, Zhang et al. <cit.> proposed a framework to quantify the interactions between the FV and LV.

Nonetheless, vanilla GMM learns the full covariance matrices given historical information, while there often exist explicit correlations among the variables or in the temporal space. This provides us an insight that a separable covariance structure of the proposed model can effectively reduce the model parameters, speed up computations, and improve practical interpretability. With these motivations, we develop a probabilistic CF model with good interpretability using Bayesian Matrix Normal Mixture Regression (MNMR). Specifically, we first learn a joint distribution in terms of the Bayesian Matrix Normal Mixture Model (MNMM) <cit.>, then make predictions based on conditional distributions. The learned row and column covariance matrices indicate the correlations among features and temporal dynamics, respectively. Compared with the previous data-driven models, our proposed MNMR provides an intuitive understanding of complex CF dynamics. We conduct extensive experiments using the HighD dataset and present a case study to illustrate the interpretability of our model. 

To sum up, the contributions of this work are as follows:

    
  * We present a novel model named Bayesian Matrix Normal Mixture Regression (MNMR) to authentically capture car-following dynamics while appropriately accounting for stochasticity.
    
  * We perform extensive experiments using the HighD dataset to demonstrate and analyze the impact of different historical steps, prediction steps, and model complexity in the regression task.
    
  * We present a case study to demonstrate the outperforming interpretability of our model, showcasing that the learned mean and covariance matrices of different components represent distinct human driving behaviors.


















§ PRELIMINARIES AND PROBLEM DEFINITION

The primary objective of this work is to develop a comprehensive statistical model based on Bayesian learning to accurately represent, interpret, and analyze CF behaviors. This model aims to capture the complex, dynamic interactions between a follower-leader pair in a traffic stream, with a particular focus on the following aspects: (1) The variability in car-following patterns under different traffic situations; and (2) The temporal dynamics of car-following, considering factors like speed, distance, and relative acceleration. 


In a typical CF task, an FV adjusts its driving speed based on the actions of the leading vehicle (LV). Given a continuous period (e.g., the past T time steps) of observations, this work aims to predict the FV's actions in the next Δ T time steps. Here we denote s_(·)(t), v_(·)(t), and a_(·)(t) as the position, speed, and acceleration of vehicles at a specific time t, where (·) can be either the FV or LV. In the setting of a regression task, we consider the following regressors for CF modeling at each time step t: the speed of FV (i.e., v_FV(t)), the speed difference between FV and LV (i.e., Δ v =v_FV(t)-v_LV(t)), and the longitudinal spacing between FV and LV (i.e., Δ s = s_FV(t)-s_LV(t)-vehicle length), denoted as x(t)∈ℝ^D_x=3. We select the action of FV (i.e., a_FV(t)) as the response variable y(t)∈ℝ^D_y=1. In general, the CF regression task is to learn a mapping f: x(t)∈ℝ^D_x↦y(t)∈ℝ^D_y, but note that in our setting D_y=1, indicating that y is a scalar.

In literature, Gaussian mixture regression (GMR) provides an elegant method to estimate the distribution of output data given input data <cit.>. The elemental assumption of GMR is that all the data points are generated from a GMM with unknown parameters. Therefore, it encodes the joint distribution of input and output using a GMM

    [[ x(t); y(t) ]]∼∑_k=1^Kπ_k𝒩(μ^(t)_k,Σ^(t)_k),

where μ^(t)_k∈ℝ^(D_x+D_y) and Σ^(t)_k∈ℝ^(D_x+D_y)×(D_x+D_y). Then it exploits the Gaussian conditioning theorem to build the mapping from input to output (i.e., p(y(t)|x(t))). In practice, although it is efficient to implement GMR at each time step, the need to estimate the full covariance matrices Σ^(t)_k would become complicated when dealing with time series. For instance, once we have observed x∈ℝ^(D_x× T) from the past T time steps, we then want to predict the future driving behaviors y'∈ℝ^(D_y×Δ T). Correspondingly, the parameters of GMM are adapted to μ^(t)_k∈ℝ^(D_x× T+D_y×Δ T) and Σ^(t)_k∈ℝ^(D_x× T+D_y×Δ T)×(D_x× T+D_y×Δ T). As aforementioned, learning the full covariance matrices requires more computational resources with longer time series.

To relieve the computational burdens from learning the full covariance matrices, in this work, we model the observations as a matrix variable instead of a vector-form and leverage the trick of the Kronecker product to decompose a full covariance matrix into two smaller covariance matrices. 



§ METHOD

Accurately model and analyze human driving data is inherently complex due to the high dimensionality and intricate temporal dynamics. Traditional models often struggle to capture the full scope of the correlations and nonlinear dynamics. In this section, we introduce a Bayesian Matrix Normal Mixture Regression (MNMM) and a Matrix Normal Mixture Regression (MNMR) to effectively model such data.



 §.§ Matrix Normal Mixture Model (MNMM)

First, as aforementioned, we model the observations as a matrix-variable instead of a vector one. Here, we assume that spatiotemporal driving data 𝒳∈ℝ^N× D×τ can be modeled by the matrix normal distribution. For the notation conciseness, we have denoted D=D_x+D_y and τ = T+Δ T. Let the matrix-variate symbol X be a D ×τ random matrix following a matrix normal distribution with mean matrix M∈ℝ^D×τ to represent the data trends, row covariance matrix U∈ℝ^D× D to capture the correlations among variables, and column covariance matrix V∈ℝ^τ×τ to depict the temporal dynamics, whose dual structure allows for a more explicit understanding of the driving behavior trends. Then we have,

    X∼     ℳ𝒩_(M,U,V),
    ⇒vec(X) ∼     𝒩(vec(M), V⊗U),

where vec(·) is the vectorization operator that stacks all the columns in a matrix into a tall column vector. To distinguish the matrix normal distribution and multivariate normal distribution, we represent them using ℳ𝒩 and 𝒩, respectively. In addition, the symbol ⊗ denotes the Kronecker product, defined as

    V⊗U =[ v_11U     ⋯ v_1τU;     ⋮     ⋱     ⋮; v_τ1U     ⋯ v_ττU ]∈ℝ^(D×τ)×(D×τ).

Note that ∀ξ≠0, a property that Kronecker product holds is V⊗U = (V/ξ)⊗(ξU). Therefore, to avoid the non-identifiable inference issue, we put a strong prior on one covariance matrix and an uninformative prior on another.







Here we define a mixture model of matrix normal distributions with K components <cit.>:

    X ∼ ∑_k=1^K π_k ℳ𝒩(M_k,U_k,V_k),

where 0≤π_k≤1 denote the mixing weight of the k-th matrix normal distribution, and ∑_k=1^K π_k=1.



In a Bayesian framework, we develop a MNMM as follows

    𝐅𝐨𝐫  𝐜𝐨𝐦𝐩𝐨𝐧𝐞𝐧𝐭 k = 1,…,K:
           M_k ∼ℳ𝒩(M_0,U_0,V_0),
           V_k ∼LKJCholeskyCov(η, σ_v),
           U_k ∼LKJCholeskyCov(η, σ_u),
       𝐅𝐨𝐫  𝐬𝐚𝐦𝐩𝐥𝐞 i = 1,…,N:
           z_i ∼Cat(π),
           X_i ∼ ℳ𝒩(M_z_i,U_z_i,V_z_i),

where `LKJ' represents the LKJ distribution <cit.>, and the priors are defined as π∼Dirichlet(α), σ_v ∼Exp(λ_v) and σ_u ∼Exp(λ_u), in which α, M_0, U_0, V_0, η, λ_v, λ_u, are all hyperparameters to tune. The corresponding model structure is illustrated as a probabilistic graphical model, see Fig. <ref>.



 §.§ Matrix Normal Mixture Regression (MNMR)

In an interactive driving scenario, human drivers make decisions and perform driving maneuvers based on observed information from several past seconds <cit.>. This insight reveals that it is significant to incorporate the past observations into the future predictions. Therefore, based on this insight, we develop a Matrix Normal Mixture Regression (MNMR) based on MNMM in the following.

In a sequence-to-sequence case, we are interested in learning a mapping f: X̃ = [X, X']∈ℝ^D_x× (T+Δ T)↦Ỹ = [Y,Y']∈ℝ^D_y× (T+Δ T), where X∈ℝ^D_x× T , X' ∈ℝ^D_x×Δ T, Y∈ℝ^D_y× T, and Y' ∈ℝ^D_y×Δ T. Then the MNMM can be rewritten as:

    [[ X̃;  Ỹ ]] = [[  X X';  Y Y' ]] ∼ ∑_k=1^K π_k ℳ𝒩(M_k, U_k, V_k),

where


    M_k   =[[ M_X̃, k;  M_Ỹ, k ]]=[[  M_X, k M_X', k;  M_Y, k M_Y', k ]],
    V_k   =[[    V_11, k∈ℝ^T× T   V_12, k∈ℝ^T×Δ T;  V_21, k∈ℝ^Δ T× T V_22, k∈ℝ^Δ T×Δ T ]],
    U_k   =[[ U_11, k∈ℝ^D_x× D_x U_12, k∈ℝ^D_x× D_y; U_21, k∈ℝ^D_y× D_x U_22, k∈ℝ^D_y× D_y ]].




This form is equivalent to the vectorized form

    [[ vec(X̃);  vec(Ỹ) ]] ∼ ∑_k=1^K π_k 𝒩([[ vec(M_X̃, k);  vec(M_Ỹ, k) ]], V_k⊗U_k ),

and for V_k⊗U_k we have

    V_k⊗U_k = [[ V_11, k⊗U_k V_12, k⊗U_k; V_21, k⊗U_k V_22, k⊗U_k ]].



The target of the matrix normal mixture regression (MNMR) model is deriving p(Ỹ|X̃), therefore, the joint distribution can be decomposed into two parts

    vec(X̃) ∼    ∑_k=1^K π_k 𝒩(vec(M_X̃, k), V_11, k⊗U_k ),
    vec(Ỹ) | vec(X̃) ∼    ∑_k=1^K w_k 𝒩( vec(M_Ỹ|X̃, k), Σ_Ỹ|X̃, k),

where we have:
  

    w_k = π_k 𝒩(vec(X̃)|vec(M_X̃, k), V_k⊗U_11, k)/∑_k=1^K π_k 𝒩(vec(X̃)|vec(M_X̃, k), V_k⊗U_11, k),
       vec(M_Ỹ|X̃, k) = vec(M_Ỹ, k) + 
               (V_21, k⊗U_k)(V_11, k^-1⊗U_k^-1)(vec(X̃)-vec(M_X̃, k)),
       Σ_Ỹ|X̃, k =  V_22, k⊗U_k - 
               (V_21, k⊗U_k)(V_11, k^-1⊗U_k^-1)(V_12, k⊗U_k).




Similar to the above procedures, it is easy to derive p(vec(Y') | vec(Y), vec(X̃)) based on p(vec(Ỹ) | vec(X̃)). Furthermore, given that we cannot observe the future information X' at a specific time step, and we still want to predict the future Y' given the previous observations, we can therefore marginalize X' to obtain 

    p(vec(Y') | vec(Y), vec(X))
    
        =   ∫_X'p(vec(Y') | vec(Y), vec(X̃))dX',

which is still a Gaussian mixture model

    vec(Y') | vec(Y), vec(X)∼∑_k=1^K β_k𝒩(μ_y,k, Σ_y,k),

where the mean vector μ_y,k∈ℝ^(D_y×Δ T) and the covariance matrix Σ_y,k∈ℝ^(D_y×Δ T)× (D_y×Δ T).



§ EXPERIMENTS







 §.§ Dataset and Preprocessing

Experiments are performed on the HighD dataset that contains high-resolution naturalistic vehicle trajectories extracted from drone videos of German highways. Compared to the commonly used NGSIM dataset <cit.>, the HighD dataset benefits from more reliable data capture methods and advanced computer vision techniques. It features 60 recordings captured at different times of the day, ranging from 8:00 to 17:00, and has a resolution of 25 Hz. In our experiment, the original dataset is downsampled to a smaller set with a sampling frequency of 5 Hz, achieved by uniformly selecting every 5-th sample. HighD dataset provides detailed information on the trajectories, velocities, and accelerations of vehicles, which is essential for developing and evaluating car-following models that accurately capture real-world driving scenarios. In this study, we follow the same data processing procedures as in <cit.> to transform the data into a new coordinate system. We selected 123 leader-follower pairs where the car-following duration lasted for more than 50 sec. Of these pairs, 93 pairs (∼75%) were used to train our model, while the remaining 30 pairs (∼25%) were stored as the test set to evaluate the forecasting performance. By using pairs with longer car-following durations, we aim to capture more realistic driving behaviors and enable our model to better handle complex and dynamic traffic situations.



 §.§ Regression Performance Evaluation

Based on the proposed Bayesian structure, we employ Stochastic Variational Inference (SVI) based on Pyro to infer the posterior distributions <cit.>. The model is trained using the Adam optimizer with a learning rate of 0.01. The experiments were conducted on a Linux server with one NVIDIA RTX A4000 GPU.

In general, a trade-off in selecting the number of components K arises: with too many components, the learned model may over-fit the data, while a model with too few components may not be flexible enough to represent an underlying distribution of observations. To evaluate the performance impact of factors from different aspects, we conduct extensive experiments using combinations of the predicted steps Δ T, the past steps T, and the number of components K. Specifically, we set Δ T={1, 3, 5, 7, 9} steps, T={1, 3, 5, 7, 9} steps, and K={5, 10, 20, 40, 60}. For each combination of {T,Δ T, K}, the regression performance is evaluated using the root mean square error (RMSE) and the mean absolute error (MAE) on the test set, and the negative log-likelihood (NLL) on the training data. These metrics are recognized as effective in diagnosing the variation in the errors in a set of forecasts <cit.>. 

Table <ref> presents the evaluation results, in which we mark the relatively good performances with bold text. Note that in this table, the lower the value, the better the results. Generally, the prediction errors decrease with longer historical steps while increasing with longer prediction steps. As for the model complexity, the errors would decrease initially but followed by an increase with the increase of K, which is consistent with the aforementioned patterns: A small value of K is inadequate for capturing the complex dynamics of CF, while a large K tends to overfit the training samples, thereby reducing the model's generalization ability and has worse performance when evaluating on the test data. This point is especially obvious when dealing with longer prediction steps and large K — the performance on the training set seem perfect but bad on the test set.













 §.§ Mixture Components Interpreting

Here we highlight that MNMR, as a mixture model, can provide an intuitive understanding of CF behaviors. Based on the model performance and following the settings in <cit.>, we choose a case with {T=5, Δ T=3, K=60} as a light demonstration. Fig. <ref> shows two cases with the variation of five dominant components, in which the LV speed, FV speed, and spacing gap are shown in solid lines; also, the percentage of β_k in Eq. (<ref>) are shown as the shaded area. Fig. <ref> illustrates the mean matrix M_k of dominant components.
We can see that component #6 exerts dominance in the beginning 110 steps and 80 steps for Case 1 (the upper part) and Case 2 (the lower part), respectively. In these instances, FVs exhibit large speeds, gaps, and relative speeds, which are also shown in the trends in the mean matrix illustrated in Fig. <ref>. During these stages, the FV slightly accelerates to keep a closer distance to the LV, which leads to the increasing relative speed. Besides, component #14 emerges as a significant component during time steps 110-120 and 160-200 in Case 1. During these periods, the FV's action indicates a typical accelerating stage — the LV rapidly increases its speed (especially when from a congestion stage to a free-flow stage) and the FV also accelerates to follow up the FV. But due to the action delay, although the FV accelerates hard, it still has a negative relative speed, i.e., Δ v =v_FV(t)-v_LV(t)<0, to the LV. 
Regarding component #7, it dominates during time steps 90-180 and 260-300 in Case 2. Such scenarios reveal the slow-moving stage when the FV and LV are close to each other at a very low speed, and the FV decelerates to keep a safe distance from the LV.

Fig. <ref> visualize the learned correlation matrices of the dominant components. Recall that in MNMR, we independently learn the row and column covariance matrices. Here, the left column denotes the full correlation matrix of V⊗U, and the plots in the second and third columns depict the feature and temporal correlation matrices, respectively.
For components #6 and #7, we observe that the speed and relative speed are negatively correlated with acceleration, aligning with our common sense that when speeds and relative speeds are large, FVs are more likely to decelerate. Additionally, gaps are positively correlated to both speed and relative speed since large gaps provide room for FVs to speed up.
Conversely, components #14, #41, and #59 suggest that speed and relative speed are negatively correlated with both gaps and acceleration. This observation shows that these two components correspond to operational conditions where FVs are approaching LVs, and FVs tend to decelerate to maintain a safe distance. Concerning the temporal correlation matrix, it is noteworthy that considering neighboring time steps is significant in modeling human driving behaviors, given that the correlations consistently remain positive. Nevertheless, the correlations diminish as the temporal distances increase — according to the results, the most correlated elements are those located within 1 second before and after the diagonal, which is consistent with the results discovered before <cit.>.




§ CONCLUSION

In the realm of understanding complex human decision-making processes, particularly in car-following (CF) scenarios, the role of generative models is indispensable. These models, e.g., GMM, adept at capturing the joint probability distribution of various inputs and outputs, offer a window into the intricate interplay of causes and effects that define human behavior. This paper introduces a novel approach to modeling human driving behaviors in CF situations through the development of a Bayesian Matrix Normal Mixture Model (MNMM). Our model stands out by employing a Kronecker structure within the covariance matrix, a technique that effectively decouples feature correlations from temporal dynamics. This unique attribute allows for a nuanced representation of the interdependencies inherent in the driving process.

Building on the foundational principles of MNMM, we extend our methodology to encompass Matrix Normal Mixture Regression (MNMR). This progression enables the prediction of future driving actions based on past observations, mirroring the decision-making patterns of human drivers who rely on recently acquired information. Our comprehensive evaluation, conducted using the HighD dataset, demonstrates the model's exceptional capability to encapsulate complex driving dynamics. A case study is presented to further illustrate the superior interpretability of our approach.



Our work has broad implications for advancing planning and decision-making algorithms of autonomous driving by modeling and understanding human behaviors, offering insights to enhance safety and efficiency. It not only contributes a novel theoretical model but also paves the way for practical applications in the field of automotive engineering. 




















IEEEtran












