A driving risk identification method based on an automatic timing hyperparameter optimization model
By constructing an automatic machine learning framework based on spatiotemporal trajectory data, employing DTW, DFS, and t-SNE algorithms for feature synchronization and dimensionality reduction, and combining Bayesian optimization for model selection, the problem of inappropriate sliding window parameter selection was solved, achieving high-precision driving risk identification, reducing costs, and improving model robustness.
Patent Information
- Application Number
- CN202211511827.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-29
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2042-11-29
AI Technical Summary
Existing technologies suffer from reduced model accuracy in driving risk identification due to improper selection of sliding window parameters. Furthermore, feature engineering and hyperparameter tuning of machine learning models require extensive manual intervention, making it difficult to achieve high-precision driving risk identification.
An automatic machine learning framework based on spatiotemporal trajectory data is constructed. The DTW algorithm is used to synchronize trajectory data, the DFS algorithm is combined to automatically generate features and the t-SNE algorithm is used to reduce dimensionality. Bayesian optimization is used to automatically select models and adjust hyperparameters, thereby realizing automatic feature extraction and model integration.
It achieves low-cost and high-precision identification of driving risk behaviors, reduces the need for manual intervention, and improves the robustness and accuracy of the model.
Smart Images

Figure CN115909244B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of traffic safety technology. More specifically, this invention relates to a method for identifying driving risks by constructing an automatic machine learning framework based on spatiotemporal trajectory data and considering the phase coupling of multiple feature data and the sliding window selection problem. Background Technology
[0002] Drivers’ risky behavior is a major cause of road traffic accidents. Identifying risky behavior helps to detect potential operational errors in advance and is of great significance in driving behavior intervention and road traffic accident prevention.
[0003] Rule-based driving risk identification is the most common approach, its core being the identification of risky driving behaviors by setting safety thresholds such as speed, acceleration, and distance. However, pre-defined identification rules cannot meet the complex and diverse needs of real-world traffic environments. With technological advancements and hardware development, an increasing number of feature indicators can be collected. Vehicle kinematics, driver identity information, facial features, driving action data, and physiological and psychological signals constitute big data for driving risk behavior identification. Machine learning algorithms can achieve high-precision risk behavior identification, but there is still room for optimization. In terms of data processing, the alignment of multi-feature time series data is a problem that existing research has rarely considered. Furthermore, most studies use sliding windows to calculate the statistical features of the data, but rarely discuss the selection of sliding window parameters. An excessively long sliding window reduces the difference between risky driving behavior sequences and normal driving behavior sequences, increasing the model's false negative rate; an excessively short sliding window results in insufficient effective driving behavior feature information, reducing model accuracy. In terms of model construction, machine learning methods require specialized knowledge and extensive experimentation for high-quality feature engineering, model structure searching, and hyperparameter tuning. Even small changes in these processes can have a crucial impact on model accuracy, leading to decreased model accuracy and inaccurate driving risk behavior identification. Summary of the Invention
[0004] The technical problem this invention aims to solve is to achieve low-cost, high-precision identification of driving risk behaviors based on automated machine learning methods, considering the temporal characteristics of trajectory data. This method constructs an automated machine learning framework for identifying driving risk behaviors based on spatiotemporal trajectory data: First, a Dynamic Time Warping (DTW) algorithm is added to the data preprocessor to synchronize the phase coupling relationship between trajectory data; second, automatic feature extraction and feature dimensionality reduction are performed based on a Deep Feature Synthesis (DFS) algorithm with set sliding window parameters and a t-Distribution Stochastic Neighbor Embedding (t-SNE) algorithm; finally, automatic model selection and hyperparameter adjustment are achieved through Bayesian optimization, and model ensemble is performed, ultimately achieving high-precision identification of driving risk behaviors automatically at a low cost.
[0005] The automatic driving risk identification method considering data temporal characteristics proposed in this invention has the following specific steps:
[0006] Step S1: Establish a comprehensive spatiotemporal trajectory dataset
[0007] By acquiring spatiotemporal trajectory data of vehicle driving and using the DTW algorithm to synchronize the phase coupling relationship between time series data, the characteristics and structure of driving trajectory data are revealed.
[0008] Step S2: Automatically generate features based on multiple sliding windows
[0009] In the DFS algorithm, sliding window parameters are considered to automatically extract fused features from the spatiotemporal trajectory dataset, obtaining a high-dimensional feature set containing multiple sliding windows. Then, dimensionality reduction is performed based on the t-SNE algorithm to achieve more efficient feature generation and selection.
[0010] Step S3, Build an automatic classification model
[0011] The feature set obtained in step S2 is used as input, and the Bayesian optimization method is used to automatically select models and adjust hyperparameters. The best-performing models are integrated to avoid overfitting while improving model robustness.
[0012] In step S1, the implementation process is as follows:
[0013] Step S11 involves collecting spatiotemporal trajectory data of the vehicle from the Global Navigation Satellite System, the Internet of Vehicles (IoV), and onboard sensors. Alternatively, vehicle trajectory data can be directly obtained from open datasets. The spatiotemporal trajectory dataset is then preprocessed, including verifying data accuracy and completeness; cleaning ignorable, outlier, and duplicate data; correcting outlier data; and filling in missing data. The spatiotemporal trajectory dataset includes time-series data such as vehicle position, speed, acceleration, and heading angle, preparing for subsequent data analysis.
[0014] Step S12: Align time series based on the DTW algorithm. This invention uses the DTW algorithm to match multi-feature trajectory data and synchronize the phase coupling relationship between time series data. For two trajectory time series Q = q1, q2, ..., q... with lengths N and M respectively... N C = c1, c2, ..., c M q N and c M Represent the feature data of the corresponding trajectory, construct an N×M distance matrix, and the distance matrix elements (q) i ,c j ) represents the distance d(q) between two points. i ,c j )=(q i -c j ) 2 The DTW algorithm aims to find the regular path W(k) = w1, w2, ..., w that minimizes the overall matching distance. K To ensure that a regular path continues to move in a certain direction, it must satisfy the constraints of boundary conditions, continuity, and monotonicity:
[0015]
[0016] Where D(Q,C) is the overall matching distance, d(w(k)) is the local matching distance, and f(k)=[i(k)-i(k-1)]+[j(k)-j(k-1)] is the weighting coefficient. Therefore, the above equation can be simplified to:
[0017] Since the regularized path before any point is independent of the regularized path after that point, we can obtain the transfer formula from step k-1 to step k: g(w(k))=d(w(k))f(k)+ming(w(k-1)), where g(w(k)) is the minimum cumulative distance at step k. Combining this with the search method, we can obtain the regularized path and complete the alignment of the time series data.
[0018] In step S2, the implementation process is as follows:
[0019] Step S21: Construct an entity set containing association rules. 1,2,…,kThis represents an entity composed of various trajectories in the spatiotemporal trajectory integrated dataset. Each trajectory entity has a unique index and J features. This represents the value of feature j of the i-th instance of the k-th trajectory; the association rules between entities are represented by index variables and added to the entity set, such as trajectory entity E. 1 The time variable is associated with kinematic information such as vehicle position and speed.
[0020] Step S22: Automatically generate features based on the entity set. There are three ways to generate features using the DFS algorithm:
[0021] (1) efeat: x i,j′ =efeat(x :,j ,i), through x i,j′ The values of each attribute are obtained by applying the calculation function in sequence to synthesize the features, such as the logarithm of the trajectory velocity.
[0022] (2)dfeat: Based on the forward relation (many-to-one) transition feature of the relation table, the related entity e∈E k The features in are directly transferred to m∈E k Features such as long trajectory features can be transferred to short trajectories within any time period.
[0023] (3)rfeat: In e k When =i, extract all combinations of values E of entity feature j. k Through the Apply the calculation function to derive entity E k For instance i, the statistics of the features can be obtained based on the backward relationship (one-to-many) of the relation table. In particular, this invention adds the sliding window length l and the sliding step size s to the application conditions of the rfeat function, which can obtain the average value, standard deviation and other statistics of the features in different sliding windows, effectively avoiding inaccurate identification caused by improper selection of the sliding window.
[0024] The DFS algorithm determines the number of features z to be synthesized for a given entity set, which is related to the association rules in the entity set and the number of recursions i. Where j represents the initial number of features, n and m are the number of forward and backward relations respectively, r is the number of rfeat functions, and e is the number of efeat functions.
[0025] Step S23, Feature Dimensionality Reduction and Selection. Based on the t-SNE algorithm, a low-dimensional manifold structure is mapped from the high-dimensional feature set, achieving feature dimensionality reduction and selection while preserving the high-dimensional spatial distribution characteristics. Input automatically generated high-dimensional feature data X = x1, x2, ..., x n , where x nLet p represent the value at the nth feature dimension of X; calculate the probability distribution matrix of X, p j|i σ represents the probability that sample i is distributed around sample j. i Based on data x i The variance of the normal distribution centered at p ij It is p j|i and p i|j Symmetric representation:
[0026]
[0027]
[0028] Calculate the target low-dimensional data Y = y1, y2, ..., y n probability distribution q j|i y n x represents n Data values after dimensionality reduction:
[0029]
[0030] The objective function is the distance between two probability distributions, i.e., the KL divergence. Then the gradient function Finally, the dimensionality-reduced feature set is obtained by training using the gradient descent algorithm.
[0031] In step S3, the implementation process is as follows:
[0032] Step S31, Automatic Model Selection and Hyperparameter Tuning. The combined problem of model selection and hyperparameter optimization is defined as a combinatorial hierarchical hyperparameter optimization problem, that is, the model selection parameters are root-level hyperparameters selected in their corresponding hyperparameter space. Automatic selection is performed on the classification algorithm set based on Bayesian optimization methods. A tree-structured Parzen Estimator (TPE) is used as the probabilistic surrogate model. The point corresponding to the maximum sampling function value is calculated through the expected incremental sampling function EI, where y * Here, x is the initial model threshold, y is the preset parameter set, and y is the initial model actual value.
[0033]
[0034] Determine if the data collection points have reached the target set value. If they have, output the model and corresponding hyperparameters; otherwise, enter the iteration loop.
[0035] Step S32, Automatic Model Integration. Automatic integration of superior models avoids overfitting while improving model robustness. A greedy algorithm is used, starting with an empty set and iteratively adding models that minimize the integration validation loss to form the optimal model. This optimal model can be used for retraining data sources and automatically generating prediction results.
[0036] Compared with the prior art, the technical solution of the present invention has the following beneficial effects:
[0037] 1. The driving risk behavior recognition method proposed in this invention takes into account the temporal characteristics of the data, aligns the trajectory time series based on the DTW algorithm, and comprehensively evaluates the influence of the sliding window parameters when extracting features, thereby extracting features more effectively and improving the driving risk behavior recognition effect.
[0038] 2. The driving risk behavior recognition method proposed in this invention automatically generates features based on DFS and combines feature dimensionality reduction selection to achieve automatic extraction and fusion of a large number of features, and obtains effective feature input for model training without manual intervention.
[0039] 3. The driving risk behavior recognition method proposed in this invention applies an automatic machine learning framework to train the model, and integrates the data processing, feature engineering, algorithm selection, hyperparameter optimization and model integration processes through pipeline integration, thereby reducing training costs and optimizing the accuracy of the driving risk recognition model. Attached Figure Description
[0040] Figure 1 This is a schematic diagram of the execution flow of the driving risk identification model proposed in this invention.
[0041] Figure 2 A schematic diagram of synchronizing multi-feature time series using the DTW algorithm.
[0042] Figure 3 A schematic diagram of a sliding window. Detailed Implementation
[0043] To better understand the technical solutions in this specification, the embodiments are described in detail below with reference to the accompanying drawings. It should be understood that the described embodiments are only a part of the embodiments in this specification, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments in this specification without creative effort are within the scope of protection of this specification.
[0044] This invention discloses a driving risk identification method based on an automatic temporal hyperparameter optimization model, which mainly includes three steps:
[0045] Step S1: Establish a comprehensive spatiotemporal trajectory dataset. Acquire spatiotemporal trajectory data of vehicle movement, and based on the Dynamic Time Warping (DTW) algorithm, synchronize the phase coupling relationship between time series data to reveal the characteristics and structure of driving trajectory data.
[0046] Step S11: The dataset in this example is a natural driving trajectory dataset. The dataset information includes time, vehicle position, speed, acceleration, yaw angle, etc. Preprocessing is performed on the spatiotemporal trajectory dataset, including verifying data accuracy and completeness; cleaning ignorable, outlier, and duplicate data; correcting outlier data; and using Lagrange interpolation to fill in missing data.
[0047] Step S12: Align the time series based on the DTW algorithm. The DTW algorithm is used to match multi-feature trajectory data and synchronize the phase coupling relationship between time series data. In this embodiment, a velocity feature time series of length N, V = v1, v2, ..., v... N And an acceleration sequence A = a1, a2, ..., a of length M. M v N and a M Represent the feature data of the corresponding trajectory, construct an N×M distance matrix, and the distance matrix elements (v i ,a j ) represents the distance d(v) between two points. i ,a j )=(v i -a j ) 2 ,like Figure 2 As shown, the regularized path W(k) = w1, w2, ..., w1 that minimizes the overall matching distance is obtained. K .
[0048] Step S2: Automatic feature generation based on multiple sliding windows. The sliding window parameters are considered in the DFS algorithm to automatically extract fused features from the spatiotemporal trajectory dataset, obtaining a high-dimensional feature set containing multiple sliding windows. Then, dimensionality reduction is performed based on the t-SNE algorithm to achieve more efficient feature generation and selection.
[0049] Step S21: Construct an entity set containing association rules. Write the trajectory data into the corresponding data table in the database to obtain entity E composed of each trajectory. 1,2,…,k Each trajectory entity has a unique index (automatic ID) and J features. This represents the value of feature j of the i-th instance of the k-th trajectory, and association rules are established based on one-to-many and many-to-one relationship data tables.
[0050] Step S22: Automatically generate features based on the entity set. This includes features such as the distance between the vehicle and the lane centerline (LP). C ), distance from the left edge of the lane (LP)L ), distance from the right edge of the lane (LP) R The system uses seven basic features, including vehicle speed (v), acceleration (a), yaw rate (YAWv), and yaw acceleration (YAWa), to generate a feature set of 840 features using the DFS-sliding window algorithm in the following three ways:
[0051] (1) efeat: x i,j′ =efeat(x :,j ,i), through x i,j′ Logarithmic transformation functions are applied sequentially to obtain the logarithmic characteristics of each attribute;
[0052] (2)dfeat: Based on the forward relation (many-to-one) transfer feature of the relation table, the feature corresponding to the long trajectory can be transferred to the short trajectory within any time period contained therein;
[0053] (3)rfeat: In e k When =i, extract all combinations of values E of entity feature j. k Through the Apply the calculation function to derive entity E k Instance i can obtain feature statistics based on the backward relationship (one-to-many) of the relation table. Specifically, this invention incorporates the sliding window length *l* and sliding step size *s* into the application conditions of the *rfeat* function. In this embodiment, the reference selects sliding window lengths *l* = 5s, 10s, 15s, 20s, 25s, 30s, and sliding step size *s* as a percentage of sliding window length *l* of 20%, 40%, 60%, and 80%. Figure 3 For illustration purposes; statistical features of basic characteristics such as mean, standard deviation, range, coefficient of variation, and quartile coefficient of variation are constructed based on multiple sliding windows.
[0054] Step S23, Feature Dimensionality Reduction and Selection. Based on the t-SNE algorithm, a low-dimensional manifold structure is mapped from the high-dimensional feature set, achieving feature dimensionality reduction and selection while preserving the high-dimensional spatial distribution characteristics. Input automatically generated high-dimensional feature data X = x1, x2, ..., x n , where x n Let X represent the value at the nth feature dimension; calculate the probability distribution matrix of X, and compare it with the target low-dimensional data Y = y1, y2, ..., y n The probability distribution of y n x represents n The data values after dimensionality reduction. To ensure that the distribution of the features after dimensionality reduction is consistent with that of the original feature set, the distance between the two probability distributions is used as the objective optimization function, and the dimensionality-reduced feature set is obtained through gradient descent training.
[0055] Step S3: Construct an automatic classification model. Using the feature set obtained in Step S2 as input, the model is automatically selected and hyperparameters are adjusted using Bayesian optimization. The best-performing model is integrated to avoid overfitting while improving model robustness.
[0056] Step S31: Automatic Model Selection and Hyperparameter Tuning. The combined problem of model selection and hyperparameter optimization is defined as a combinatorial hierarchical hyperparameter optimization problem, where the selected parameters are root-level hyperparameters chosen within their corresponding hyperparameter space. Automatic selection is performed using a Bayesian optimization method within a set of classification algorithms (in this example, the algorithm set includes four ensemble algorithms: Random Forest (RF), Adaptive Boosting (AdaBoost), Extreme Gradient Boosting (XGBoost), and Lightweight Gradient Boosting (LightGBM), as well as the Nearest Neighbor (KNN) algorithm and the Support Vector Machine (SVM) algorithm). A Bayesian optimization model based on TPE is used, with the acquisition function being the expected increment. Where y * y is the initial model threshold, x is the preset parameter set, and y is the initial model actual value. The model is set to stop iterating and output the corresponding model parameters when the accuracy of identifying driving risk behaviors reaches 98% or the number of iterations reaches 300.
[0057] Step S32, Automatic Model Integration. Automatic integration of superior models avoids overfitting while improving model robustness. A greedy algorithm is used, starting with an empty set and iteratively adding models that minimize the integration validation loss to form the optimal model. This optimal model can be used for retraining data sources and automatically generating prediction results.
Claims
1. A driving risk identification method based on an automatic temporal hyperparameter optimization model, characterized in that, include: Step S1: Establish a comprehensive spatiotemporal trajectory dataset Acquire spatiotemporal trajectory data of vehicle driving, and based on the DTW algorithm, synchronize the phase coupling relationship between time series data to reveal the characteristics and structure of driving trajectory data; Step S2: Automatically generate features based on multiple sliding windows In the DFS algorithm, the sliding window parameter is considered to automatically extract fused features from the spatiotemporal trajectory dataset, obtain a high-dimensional feature set containing multiple sliding windows, and then the dimensionality is reduced based on the t-SNE algorithm to achieve more efficient feature generation and selection. Step S3: Construct an automatic classification model The feature set obtained in step S2 is used as input, and the Bayesian optimization method is used to automatically select models and adjust hyperparameters. The better-performing models are integrated to avoid overfitting while improving the robustness of the models. In step S2, the implementation process is as follows: Step S21, construct an entity set containing association rules; E 1,2,…,k This represents an entity composed of various trajectories in the spatiotemporal trajectory integrated dataset. Each trajectory entity has a unique index and J features. The value of feature j of the i-th instance of the k-th trajectory is represented; the association rules between entities are represented by index variables and added to the entity set, trajectory entity E. 1 Associate time variables, which are related to kinematic information such as vehicle position and speed; Step S22: Automatically generate features based on the entity set; there are three ways to generate features using the DFS algorithm: (1) efeat: Through the The values of each attribute are obtained by applying the calculation function in sequence to synthesize the feature, which is the logarithmic value of the trajectory velocity; (2)dfeat: Based on the forward relational transfer feature of the relation table, the relevant entity e∈E k The features in are directly transferred to m∈E k Features; (3)rfeat: , in e k When =i, extract all combinations of values E of entity feature j. k Through the Apply the calculation function to derive entity E k Examples i Statistics of features are obtained based on the backward relations of the relation table; The DFS algorithm states that the number of features z synthesized from a given entity is related to the association rules in the entity set and the number of recursions i. in j Indicates the initial number of features. n and m These represent the number of forward and backward relations, respectively; r is the number of rfeat functions; and e is the number of efeat functions. Step S23, Feature dimensionality reduction selection.
2. The driving risk identification method based on an automatic temporal hyperparameter optimization model as described in claim 1, characterized in that, In step S1, the implementation process is as follows: Step S11: Collect the spatiotemporal trajectory data of the vehicle, or obtain the vehicle trajectory data from an open dataset; then preprocess the spatiotemporal trajectory integrated dataset; the spatiotemporal trajectory integrated dataset includes time series data such as the vehicle's position, speed, acceleration, and heading angle; Step S12: Align the time series based on the DTW algorithm.
3. The driving risk identification method based on an automatic temporal hyperparameter optimization model as described in claim 2, characterized in that the steps are as follows: S12, Time series alignment based on DTW algorithm: The DTW algorithm is used to match multi-feature trajectory data and synchronize the phase coupling relationship between time series data; for two trajectory time series with lengths of N and M respectively... Q = q 1 ,q 2 ,…,q N , C = c 1 ,c 2 ,…,c M ,q N and c M Representing the feature data of the corresponding trajectory, constructing Distance matrix, distance matrix elements Indicates the distance between two points The DTW algorithm finds the normalized path that minimizes the overall matching distance. To ensure that a regular path continues to move in a certain direction, the following constraints must be met: boundary conditions, continuity, and monotonicity. (1) in, It is the overall matching distance. It is the local matching distance. These are weighting coefficients. The above equation can be simplified to: ; Since the normalized path before any point is independent of the normalized path after that point, we obtain the transitive formula from k-1 steps to k steps. , It is the minimum cumulative distance at step k. Combining it with the search method, we can obtain the regular path and complete the alignment of the time series data.
4. The driving risk identification method based on an automatic temporal hyperparameter optimization model as described in claim 1, characterized in that, In step S22: Add the sliding window length to the application conditions of the rfeat function l With sliding step size s This allows us to obtain statistical measures such as the mean and standard deviation of features within different sliding windows, thus avoiding inaccurate identification due to improper selection of the sliding window.
5. The driving risk identification method based on an automatic temporal hyperparameter optimization model as described in claim 1, characterized in that, Step S23: Based on the t-SNE algorithm, a low-dimensional manifold structure is mapped from a high-dimensional feature set, achieving feature dimensionality reduction and selection while preserving the high-dimensional spatial distribution characteristics; the input is automatically generated high-dimensional feature data. ,in Let X represent the value in the nth feature dimension; calculate the probability distribution matrix of X. This represents the probability that sample i is distributed around sample j. It is based on data The variance of the normal distribution centered at , yes and Symmetric representation: (2) (3) Calculate target low-dimensional data probability distribution , express Data values after dimensionality reduction: (4) The objective function is the distance between two probability distributions, i.e., the KL divergence. Then the gradient function Finally, the dimensionality-reduced feature set is obtained through training using the gradient descent algorithm.
6. The driving risk identification method based on an automatic temporal hyperparameter optimization model as described in claim 1, characterized in that, In step S3, the implementation process is as follows: Step S31, Automatic Model Selection and Hyperparameter Tuning; The combined problem of model selection and hyperparameter optimization is defined as a combinatorial hierarchical hyperparameter optimization problem, that is, the model selection parameters are root-level hyperparameters selected in their corresponding hyperparameter space; Automatic selection is performed in the classification algorithm set based on Bayesian optimization method, using a tree-structured Parzen Estimator (TPE) as a probabilistic surrogate model, and the point corresponding to the maximum sampling function value is calculated through the expected incremental sampling function EI, where, It is the initial model threshold. It is a set of preset parameters. These are the actual values of the initial model: (5) Determine if the data collection points have reached the target set value. If they have, output the model and corresponding hyperparameters; otherwise, enter the iteration loop. Step S32, Automatic Model Integration: Automatically integrates better-performing models to avoid overfitting while improving model robustness. A greedy algorithm is used, which starts from an empty set and adds models that minimize the integration validation loss during the iteration process to form the best model, which can be used for retraining of data sources and automatically generate prediction results.
Citation Information
Patent Citations
Face-based driving risk prediction method and device, equipment and storage medium
CN111414874A
Electronic system for dynamic, quasi-realtime measuring and identifying driver maneuvers solely based on mobile phone telemetry, and a corresponding method thereof
CN111512345A