Multi-scale traffic flow prediction method and system based on selective state space model
Patent Information
- Application Number
- CN202610945034.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-29
- Publication Date
- 2026-10-30
AI Technical Summary
为此,本发明的一个目的在于提出基于选择性状态空间模型的多尺度交通流预测方法及系统,以有效克服现有交通流预测技术中存在的时域建模尺度固定、自适应路径缺乏动态感知能力及全局上下文关联建模不足等技术缺陷
本发明的基于选择性状态空间模型的多尺度交通流预测方法及系统,基于变量解耦的线性令牌化表征与时域转置预处理,消除跨通道早期干扰并保留节点独立演化模式;执行多尺度时间补丁化特征分割与非重叠切片处理,生成具备异构时间分辨率的特征块集合;利用基于选择性状态空间算子的自适应路径路由与随机扰动评分注入,实现计算资源的动态感知与稀疏路径的自适应调度;采用双向感知的选择性状态空间编码结构进行变量维度建模,在维持线性复杂度的前提下建立全域上下文关联;实施多尺度特征加权聚合、稀疏调度算子协同及残差融合,生成集成多分辨率信息的统一综合表征;执行线性投影映射、维度还原与可逆反归一化处理,实现端到端优化及物理尺度预测。本发明通过构建基于选择性扫描机制的自适应多尺度建模架构,兼具线性计算复杂度的全域依赖捕捉能力、基于变量解耦的节点独立演化特征提取能力以及针对异构时域补丁的动态路径调度能力,能够有效弥补现有技术中建模尺度固定、自适应路径缺乏动态感知能力以及全局上下文关联建模开销过大的技术缺陷,显著提高了交通流预测的准确性与效率。
Smart Images

Figure CN123016672A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of traffic flow prediction and artificial intelligence, specifically to a multi-scale traffic flow prediction method and system based on a selective state-space model. Background Technology
[0002] Traffic flow prediction is one of the core tasks of intelligent transportation systems, playing a crucial role in alleviating urban traffic pressure and reducing traffic congestion. By analyzing and modeling historical traffic data, accurate predictions of future traffic conditions can provide effective decision support for urban traffic planning, traffic operation management, and related public services.
[0003] With the advancement of smart city construction, traffic data is exhibiting characteristics of high frequency, massive volume, and complex spatiotemporal relationships. High-precision prediction results can not only help traffic management departments optimize road network resource allocation and improve traffic operation efficiency, but also provide the public with accurate travel planning references, thereby reducing social travel costs. Therefore, how to efficiently extract spatiotemporal dependencies and capture multi-scale temporal patterns from complex traffic sequences using advanced deep learning technology has become a hot topic and challenge in the field of intelligent transportation.
[0004] Existing traffic flow prediction schemes primarily employ recurrent neural networks (RNNs), graph neural networks (Graph Neural Networks), and attention-based network architectures. RNNs and their variants, limited by their recursive structure, cannot achieve efficient parallel computation and are prone to gradient vanishing when dealing with long-distance time dependencies. While Graph Neural Networks introduce spatial modeling, they heavily rely on predefined adjacency matrices to characterize the road network structure and mostly represent the connections between nodes using only statistical correlation weights, lacking consideration of physical constraints such as traffic flow directionality and conservation. This often leads to false traffic convergence or diffusion phenomena in the prediction results, which do not conform to actual physical laws. While attention-based network architectures possess strong global correlation modeling capabilities, the computational complexity of their core mechanism increases quadratically with sequence length, consuming enormous computational resources when processing extremely long historical observation sequences. Furthermore, they easily introduce redundant noise information during modeling, interfering with the identification of key time patterns. Additionally, they typically use a single time scale for modeling, making it difficult to account for the dynamic changes in traffic flow at different resolutions.
[0005] In recent years, selective state-space models have emerged as a new paradigm for time series modeling due to their near-linear computational complexity and efficient content selection mechanism. These models overcome the contradiction between computational resource consumption and long-range dependency capture in traditional sequence modeling methods by introducing hardware-aware discretization strategies and dynamic parameterization mechanisms. They can efficiently filter redundant noise and extract key temporal features from large-scale historical observation data.
[0006] Existing traffic flow prediction technologies still suffer from a lack of modeling flexibility when dealing with complex and ever-changing prediction tasks. They typically employ a single temporal resolution or a pre-defined fixed modeling path, making it difficult to adaptively adjust the perception range based on the temporal characteristics of the input data. This hinders the accurate capture of the interwoven instantaneous random fluctuations and long-term periodic patterns in traffic sequences. Furthermore, the lack of an effective two-way perception structure and the over-reliance on local input at the current moment in existing models make it difficult to deeply integrate historical global context information and fully exploit the two-way contextual relationships between different variable nodes. This limits the modeling depth of long-term temporal dependencies in complex scenarios, directly impacting prediction accuracy and generalization stability. Therefore, enabling models to possess adaptive multi-scale path selection capabilities and two-way variable correlation perception capabilities while effectively modeling global contextual relationships has become a critical technical challenge that urgently needs to be addressed in the field of traffic prediction. Summary of the Invention
[0007] This invention aims to address at least one of the technical problems existing in the prior art. Therefore, one objective of this invention is to propose a multi-scale traffic flow prediction method and system based on a selective state-space model, effectively overcoming the technical shortcomings of existing traffic flow prediction technologies, such as fixed temporal modeling scales, lack of dynamic perception capabilities in adaptive paths, and insufficient global contextual modeling.
[0008] To achieve the above objectives, this invention provides a multi-scale traffic flow prediction method based on a selective state-space model, comprising: performing variable decoupling and linear tokenization on the original multivariate traffic flow sequence to construct independent feature representations expanded along the time dimension; constructing a multi-scale time patch set and forming candidate modeling paths at different time resolutions; performing linear projection on time feature blocks of different scales to obtain multi-scale feature embeddings in a high-dimensional latent space; constructing a path routing mechanism based on selective state-space operators, dynamically scoring and sparsely filtering paths at each scale to generate adaptive path weights; performing bidirectional selective state-space encoding on the multi-scale feature embeddings in the activated paths to extract global dependencies between variable nodes; performing weighted aggregation and hierarchical stacking fusion on the output features of multiple paths to obtain a unified comprehensive representation; and generating future traffic flow prediction results based on the comprehensive representation.
[0009] Preferably, the variable decoupling and linear tokenization process includes: performing reversible normalization on the input traffic flow tensor, and rearranging the time dimension and variable dimension through dimensional transformation, so that each variable forms an independent sequence representation on the time axis, thereby realizing decoupling modeling between channels.
[0010] Preferably, the multi-scale time patch set is obtained by non-overlapping segmentation of the input sequence through multiple preset time windows of different scales, with each scale corresponding to a different time resolution, to characterize the multi-scale evolution features of traffic flow.
[0011] Preferably, the path routing mechanism generates path responses by dynamically modeling features at each scale and introduces random perturbations during the scoring process to improve the flexibility of path selection; on this basis, it adaptively filters and schedules paths at different scales, suppresses redundant paths from participating in the calculation, and generates corresponding dynamic path weights. Preferably, the bidirectional selective state space encoding includes: performing forward and reverse state space modeling on the input features along the variable dimension respectively, and fusing the outputs in the two directions to construct a bidirectional contextual dependency relationship between variable nodes.
[0012] Preferably, the multi-path feature fusion includes: aligning and concatenating the features output by each activated path in the time dimension, and performing weighted aggregation in combination with dynamic path weights; inputting the fusion result into a multi-layer adaptive modeling structure for layer-by-layer stacking processing, and retaining the original input information through residual connections to obtain a high-order feature representation.
[0013] A multi-scale traffic flow prediction system based on a selective state-space model includes: a tokenization module for variable decoupling and linear representation of time series; a gated routing module for generating multi-scale path weights and performing sparse selection; a feature encoding module for extracting global dependencies between variable nodes through a stacked bidirectional state-space structure; a fusion modeling module for multi-path feature weighting and hierarchical stacking; and a prediction output module for generating traffic flow prediction results.
[0014] The advantages of this invention compared to the prior art are: The present invention relates to a multi-scale traffic flow prediction method and system based on a selective state-space model. This method utilizes variable decoupling, linear tokenization representation, and temporal transpose preprocessing to eliminate early cross-channel interference while preserving independent node evolution patterns. It performs multi-scale temporal patching feature segmentation and non-overlapping slicing to generate a feature block set with heterogeneous temporal resolution. It leverages adaptive path routing and random disturbance scoring injection based on selective state-space operators to achieve dynamic perception of computing resources and adaptive scheduling of sparse paths. It employs a bidirectional sensing selective state-space encoding structure for variable dimensionality modeling, establishing global contextual association while maintaining linear complexity. It implements multi-scale feature weighted aggregation, sparse scheduling operator collaboration, and residual fusion to generate a unified comprehensive representation integrating multi-resolution information. Finally, it performs linear projection mapping, dimensionality reduction, and reversible inverse normalization processing to achieve end-to-end optimization and physical scale prediction. This invention constructs an adaptive multi-scale modeling architecture based on a selective scanning mechanism, which combines the ability to capture global dependencies with linear computational complexity, the ability to extract node independent evolution features based on variable decoupling, and the ability to schedule dynamic paths for heterogeneous time-domain patches. It can effectively make up for the technical defects of existing technologies, such as fixed modeling scale, lack of dynamic perception capability of adaptive paths, and excessive global context association modeling overhead, and significantly improve the accuracy and efficiency of traffic flow prediction. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This is a flowchart illustrating the multi-scale traffic flow prediction method based on a selective state-space model in an embodiment of the present invention. Figure 2 This is a model structure diagram of the multi-scale traffic flow prediction method based on a selective state-space model in an embodiment of the present invention; Figure 3 This is a diagram of the selective state-space operator structure in an embodiment of the present invention; Figure 4 This is the result of a comparative experiment between the present invention and other common models. Detailed Implementation
[0017] The embodiments of this application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.
[0018] In the description of this application, it should be noted that, unless otherwise expressly specified and limited, the terms "installation," "connection," and "joining" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.
[0019] The present invention will now be described in further detail with reference to the accompanying drawings.
[0020] The multi-scale traffic flow prediction method based on a selective state-space model of the present invention includes the following steps: S1. Perform reversible normalization on the original multivariate traffic flow sequence and decouple the variables through dimension transpose to construct a linear tokenized representation sequence that expands along the time dimension. S2. Preset multiple time patches of different sizes, perform non-overlapping slicing in the time dimension based on the linear tokenized representation sequence, generate a set of multi-scale feature blocks with different time resolutions, and map each scale feature block to a high-dimensional latent space through linear projection to obtain the corresponding multi-scale feature embedding. S3. Multi-scale features are embedded into the gated routing module constructed by selective state space operators. Recursive state updates are performed on the variable dimension to extract temporal evolution features. Initial scores of paths at each scale are dynamically generated through mean pooling compression. Traffic flow uncertainty modeling based on the multi-scale feature embedding is introduced to enhance path exploration capabilities. After sparse filtering and probability mapping based on path score sorting, adaptive activation paths and corresponding scale-aware weights are output. S4. For the multi-scale feature embedding corresponding to the adaptive activation path, a bidirectional selective state space coding structure with forward and sequence reversal operations along the variable dimension is adopted to extract the global dependency relationship between variable nodes in the multi-scale feature embedding and generate path coding features. S5. Based on scale-aware weights, the encoded features of each path are aligned and stacked in the time patch dimension and then weighted aggregation is performed. The weighted aggregation result is then input into the multi-layer adaptive multi-scale module for layer-by-layer stacking modeling. Deep features are extracted through inter-layer feature transfer and residual connection to form a unified comprehensive representation integrating multi-resolution information. S6. Map the unified comprehensive representation to the target prediction time step, and after dimensional transformation and inverse normalization, obtain the final traffic flow prediction result. Based on the completeness constraint of the multi-scale feature spectrum and the prediction loss, construct a joint optimization objective, and update the model parameters through gradient backpropagation.
[0021] Preferably, in step S1, variable decoupling and channel-independent modeling are achieved through time-domain transposition, avoiding interference caused by prioritizing the time dimension. This ensures that subsequent linear projection and patching are performed independently on the time axis of a single node, effectively preserving the unique evolutionary characteristics of each node and reducing the impact of spatial interference on the accuracy of time-domain modeling. The steps are as follows: S1.1, Regarding the original tensor Perform reversible normalization to obtain the variables. As shown in formula (1): In equation (1), Represents an invertible normalized function. Indicates batch size, Indicates the length of a historical time step. Indicates the number of variable nodes; S1.2. By remapping the axial indices of the tensor through dimensional transformation, and swapping the positions of the time axis and the node axis while keeping the batch axis unchanged, a linear tokenized representation based on variable decoupling is obtained. As shown in formula (2): Preferably, step S2 includes: S2.1, Preset Patch Size Set ,in The total number of preset scales; S2.2, For any patch size and its corresponding linear tokenization representation The input sequence is divided along the time dimension into A length of Continuous non-overlapping segments are used to generate a multi-scale feature block set. .
[0022] S2.3 Perform high-dimensional feature embedding: Apply a linear projection layer to the multi-scale time patch tensor Feature mapping is performed to map low-dimensional temporal features to a high-dimensional latent space, resulting in high-dimensional feature embeddings. The process is shown in equation (3): Preferably, step S3 includes: S3.1, Initial Scoring of Multi-Scale Evolution: For multi-scale feature embeddings corresponding to any scale, in terms of the number of patches... Top Performing mean pooling operation yields, To extract a stable representation at this scale; the pooled features Mapping to a unified gated hiding space; obtaining the gated hiding representation through linear projection. ;in, The gated hidden dimension is defined; by inputting the gated hidden representation into a selective state-space operator to model the dynamic dependencies in the variable dimension, a temporal evolution feature tensor is obtained. As shown in formula (4): In equation (4), the selective state-space operator As a state-space modeling unit based on input adaptive modulation, this selective state-space operator performs recursive state updates on the input sequence in the variable dimension, and its state evolution process is shown in equation (5): In equation (5), Indicates the first The hidden state at each position, Indicates the first The hidden state at each position, This represents the corresponding output feature. Indicates input Dynamically generated parameter mapping function This represents the first position of the input sequence in the variable dimension. One element; The selective state-space operator employs a parallel scanning mechanism to accelerate the aforementioned recursive computation process, performs linear mapping on the modeled features, and operates within the variable dimension. The average pooling compression is performed to obtain the initial evolution score at the current scale. As shown in formula (6): In equation (6), Indicates the first The initial evolution score corresponding to each scale Indicated in the variable dimension Perform mean pooling compression operation on top. This represents a linear mapping compression function. Indicates the first The temporal evolution feature tensor corresponding to each scale Indicates batch size; S3.2, Score Convergence and Traffic Flow Uncertainty Modeling: The scores at all scales are concatenated to obtain the initial multi-scale evolution score, as shown in formula (7): In equation (7), This represents the initial score vector for multi-scale evolution. Indicates different scale indices; A Gaussian random perturbation matrix, representing the intertwined characteristics of microscopic short-term abrupt changes and macroscopic periodic stability of traffic flow, is injected into the initial evolution score. The path score generated by the time-domain evolution features is probabilistically adaptively calibrated to dynamically match the random fluctuation mode of the target road network node at the current time step and calculate the scale weight distribution through the routing function. The process is shown in Equation (8). In equation (8), For a random perturbation matrix that follows a standard normal distribution, Softplus(·) denotes a smoothing nonlinear activation function used to map the input parameters to a positive range. This indicates that the mean pooling operator is performed at the node level. Represents high-dimensional feature embedding, Let d be the learnable weight matrix, and d represent the feature dimension. S3.3, Scale-Aware Weight Generation A sparse filtering mechanism based on local competition is implemented to perform a significance evaluation on the enhanced routing weights. By filtering out responses below a threshold, long-tail paths are suppressed, allowing the model to focus on core feature paths. Subsequently, the paths are sorted according to their response values, and a preset number of high-response paths are retained to obtain the set of activated paths. The process is shown in Equation (9). In equation (9), Select(·) represents a path filtering function based on response value sorting, used to select from the path rating matrix. A preset number of high-response paths are retained.
[0023] The sparse weight tensor after the above competitive masking process Within it, the set of preset sizes for each channel dimension and multi-scale time slicing operation. A one-to-one mapping relationship was established; furthermore, based on the non-zero element distribution generated by the aforementioned masking operation, a discretized state indicator vector was generated, which was specifically used to characterize the specific network activation topology of the multi-resolution time branch in the current computation step, as shown in Equation (10): In equation (10), Indicates the first Whether a scale is activated; This means that the scale path is activated when the corresponding feature score meets the preset response threshold. The scores of the selected enhanced paths are probabilistically mapped to generate normalized scale-aware weights. , is used to characterize the relative contribution of each activation path under the current input conditions, and its process is shown in equation (11): Preferably, in step S4, for each activated scale modeling path, bidirectional correlation modeling between variable nodes is achieved through a bidirectional selective state space structure. For the time patch block corresponding to each activated scale path, forward selective state space modeling and reverse selective state space modeling are performed along the variable dimension to establish global dependencies between variable nodes and achieve bidirectional perception of node features; the process is shown in equation (12): In equation (12), This represents a sequence reversal operation along the variable dimension; right and By fusing the features, a bidirectional encoded feature representation is obtained. The process is shown in equation (13): Preferably, step S5 includes: S5.1, Multi-scale path feature weighted aggregation: Encoded features output by each activation path. Alignment is performed along the time patch dimension; while preserving the scale index dimension, the path encoding features of each scale are stacked to form a multi-scale fusion feature. The process is shown in equation (14): Scale-aware weights The fusion features of paths at different scales are weighted and summed to obtain the encoded fusion representation. The process is shown in equation (15): S5.2, Multi-layer stacking and residual fusion: The encoded representation obtained in S5.1 is fused. The input multi-layer adaptive multi-scale module is used for layer-by-layer stacking modeling. Deep temporal dependencies are extracted step by step through inter-layer feature transfer, and a unified comprehensive representation is obtained through residual connection. S5.3, Feature Normalization and Nonlinear Enhancement: Layer normalization and feedforward network transformation are performed sequentially on the comprehensive representation of S5.2 to obtain the enhanced unified representation, as shown in Equation (16): In equation (16), This represents the enhanced unified comprehensive representation. Presentation layer normalization operation; This represents a feedforward neural network used to perform nonlinear mapping and enhancement on features.
[0024] Preferably, step S6 includes: S6.1 Linear Projection and Intermediate Result Generation: Unifying and Synthesizing the Representation By mapping to the target prediction time step through a linear projection layer, intermediate prediction results are obtained. The process is shown in equation (17): S6.2 Dimensional Transformation and Predicted Sequence Recovery: Perform dimensional transformation on the intermediate prediction results to restore the timeline order, obtaining the predicted sequence. The process is shown in equation (18): S6.3, Inverse Normalization Processing: For the predicted sequence Perform an inverse normalization operation to restore the scale to the original data, and obtain the final prediction result. The process is shown in equation (19): In equation (19), This represents the inverse normalization operation corresponding to reversible normalization.
[0025] S6.4 Feature Completeness Constraints and Parameter Updates: Combining path weight distribution and path activation states, construct a multi-scale feature spectrum completeness constraint term to measure the breadth of multi-resolution traffic flow evolution features extracted from each path. Among them, the multi-scale feature spectrum completeness constraint term includes discrete measures based on path weight distribution and path activation state, which are used to characterize the distribution characteristics of the path at the weight allocation level and the actual use level, respectively; the constraint term is shown in equation (20): In equation (20), This represents a metric function used to characterize the degree of dispersion of a distribution; δ for The path activation state matrix is composed of the path activation state matrix; by combining the continuous discrete measure of the normalized weight distribution and the discrete measure of the explicit activation state, a multi-scale feature spectrum completeness constraint term is constructed; by jointly constraining the discreteness of the above dual distribution, the model is prevented from falling into a single time resolution bias during the feature extraction process, and the model is forced to simultaneously capture transient fluctuations and long-term trends in the traffic flow sequence, ensuring the complete coverage and joint expression of multi-scale time domain information. Combining multi-scale feature spectrum completeness constraints A joint optimization objective function is constructed with the prediction loss, and the end-to-end update of the network parameters is achieved through gradient backpropagation, as shown in equation (21): In equation (21), To predict loss, it is used to quantify the difference between the model output and the true value; This is a completeness regularization factor used to constrain the breadth of feature extraction at different time resolutions while minimizing prediction error, preventing the model from over-relying on a single time resolution and improving the balance of multi-scale feature representation.
[0026] A multi-scale traffic flow prediction system based on a selective state-space model includes: The tokenization module is used to perform reversible normalization and dimension transpose on the original multivariate traffic flow sequence, thereby decoupling variables and generating a linear tokenized representation sequence. The gated routing module, connected to the tokenization processing module, is used to generate multi-scale feature blocks from the linear tokenized representation sequence. The multi-scale feature blocks are mapped to a high-dimensional latent space through linear projection to obtain multi-scale feature embeddings. Based on the selective state space operator, the initial scale score is dynamically generated for the multi-scale feature embeddings. After traffic flow uncertainty modeling, adaptive feature sparsity filtering and probability mapping, the adaptive activation path and scale-aware weights are output. The feature encoding module, connected to the gated routing module, is used to perform bidirectional selective state-space encoding on the multi-scale feature embedding corresponding to the activation path, extract the global dependency relationship between variable nodes and output the path encoding feature; The fusion modeling module, connected to the feature encoding module, is used to aggregate path encoded features based on scale-aware weights, and generate a unified comprehensive representation through multi-layer stacking and residual fusion. The prediction output module, connected to the fusion modeling module, is used to map the unified comprehensive representation to the target time step, and outputs the final traffic flow prediction result after dimensional transformation and inverse normalization.
[0027] The parameter optimization module, connected to the prediction output module, is used to construct a joint optimization objective by combining the prediction loss and the completeness constraint of the multi-scale feature spectrum, and to achieve end-to-end update of the model parameters through gradient backpropagation.
[0028] To more clearly illustrate the specific embodiments of the present invention, several examples are provided below: Example 1 Experimental Dataset This embodiment uses the California Public Traffic Flow Dataset, which includes timestamps, sensor numbers, and traffic flow information. During preprocessing, only the training set is used for standardized fitting to avoid information leakage. Missing values are handled using a combination of forward and backward imputation to ensure the continuity of the time series. Sample construction employs a time-step sliding window partitioning strategy, with a length of... historical sequence As input, the corresponding predicted future length is sequence The samples were then divided into training, validation, and test sets in a 6:2:2 ratio, which were used for model training, hyperparameter optimization, and final performance evaluation, respectively.
[0029] Evaluation indicators: To comprehensively evaluate the model's error performance and prediction accuracy, Mean Absolute Error (MAE) and Mean Squared Error (MSE) were used as evaluation metrics in all experiments. MAE measures the absolute magnitude of the deviation between predicted and actual values, directly reflecting the overall prediction error level; MSE, by accumulating the squared errors, imposes a higher penalty on larger deviations, thus more sensitively characterizing the model's performance under extreme error conditions. These metrics can comprehensively evaluate model performance from different perspectives. Assumptions Indicates the first The true value of each sample This represents the corresponding predicted value. This represents the total number of samples. The calculation formula is as follows: Experimental parameter settings: In this embodiment, all experiments were conducted using PyTorch 2.9.1 and mamba_ssm 2.2.6, and run in the same hardware environment, with an NVIDIA RTX 4080 16 GB GPU; the Adam optimizer was used, with the L1 loss function and an initial learning rate of [value missing]. The learning rate was dynamically adjusted using the OneCycleLR strategy, and a five-round early stopping mechanism was implemented to balance convergence speed and overfitting suppression. The batch size for model training was set to 32, with a total of 50 iterations. Each Mamba unit contained 512 hidden dimensions. A sliding window mechanism was used to extract data, with an input sequence length of 96 and prediction lengths of 12, 24, 48, and 96. Patch sizes were selected from 96, 48, 32, 24, 16, 8, 4, and 2. The bidirectional encoding module adopted a three-layer stacked structure.
[0030] Comparison Methods To objectively evaluate the performance of the method in this invention, several representative time series prediction methods were selected for comparative experiments. These included attention-based methods such as iTransformer, PatchTST, Crossformer, FEDformer, and Autoformer; linear methods such as TiDE and TimesNet; and state-space models such as Mamba, MambaAtt, and Mambaformer. All comparative methods used their publicly available implementations or recommended parameter settings, and experiments were conducted on a unified dataset and training environment to ensure the fairness and comparability of the results. The comparative experimental results are as follows: Figure 4 As shown.
[0031] From the overall experimental results, the method of the present invention (in...) Figure 4 The proposed method (referred to as "Proposed") achieves best-in-class or competitive prediction performance on most datasets and prediction step sizes, outperforming the selected comparison methods on overall evaluation metrics and demonstrating stable and leading prediction performance. Compared to the mainstream attention-based best-in-class baseline model iTransformer, MAE and MSE are reduced by an average of approximately 11.34% and 16.25%, respectively, achieving lower errors in medium- to long-term prediction tasks. Compared to the linear-structure-based best-in-class baseline model TimesNet, MAE and MSE are reduced by an average of approximately 20.39% and 29.87%, respectively. Compared to the selective state-space-based best-in-class baseline model MambaAtt, MAE and MSE are reduced by an average of approximately 13.21% and 32.09%, respectively. The proposed method maintains its advantage across most prediction ranges, especially in medium- to long-term prediction scenarios where error growth is more gradual, demonstrating superior long-term dependency modeling ability and prediction stability. The above results demonstrate that the proposed multi-scale traffic flow prediction method based on a selective state-space model can effectively improve the model's ability to characterize complex traffic flow dynamics, thereby achieving better overall performance at different prediction scales.
[0032] Finally, any aspects not fully described in this invention utilize existing mature products and technologies.
[0033] The present invention and its embodiments have been described above. This description is not restrictive, and the accompanying drawings are only one embodiment of the present invention; the actual structure is not limited thereto. In conclusion, if those skilled in the art are inspired by this description and design similar structures and embodiments without departing from the spirit of the present invention, such designs should fall within the protection scope of the present invention.
Claims
1. A multi-scale traffic flow prediction method based on a selective state-space model, characterized in that, Includes the following steps: S1. Perform reversible normalization on the original multivariate traffic flow sequence and decouple the variables through dimension transpose to construct a linear tokenized representation sequence that expands along the time dimension. S2. Preset multiple time patches of different sizes, and perform non-overlapping slicing on the time dimension based on the linear tokenized representation sequence of S1 to generate a set of multi-scale feature blocks with different time resolutions. Then, map each scale feature block to a high-dimensional latent space through linear projection to obtain the corresponding multi-scale feature embedding. S3. The multi-scale features of S2 are embedded into the gated routing module constructed by the selective state space operator. Recursive state update is performed on the variable dimension to extract temporal evolution features. The initial scores of each scale path are dynamically generated by mean pooling compression. Traffic flow uncertainty modeling based on the multi-scale feature embedding is introduced to enhance the path exploration capability. After sparse screening and probability mapping based on path score sorting, the adaptive activation path and the corresponding scale-aware weight are output. S4. For the multi-scale feature embedding corresponding to the adaptive activation path in S3, a bidirectional selective state space coding structure with forward and sequence reversal operations along the variable dimension is adopted to extract the global dependency between variable nodes in the feature embedding and generate path coding features. S5. Based on the scale-aware weights of S3, the path encoding features of S4 are aligned and stacked in the time patch dimension and then weighted aggregation is performed. The weighted aggregation result is then input into the multi-layer adaptive multi-scale module for layer-by-layer stacking modeling. Deep features are extracted through inter-layer feature transfer and residual connection to form a unified comprehensive representation integrating multi-resolution information. S6. Map the unified comprehensive representation of S5 to the target prediction time step, and obtain the final traffic flow prediction result through dimensional transformation and inverse normalization. Construct a joint optimization objective based on the completeness constraint of the multi-scale feature spectrum and the prediction loss, and update the model parameters through gradient backpropagation.
2. The method according to claim 1, characterized in that: In step S1, variable decoupling and channel-independent modeling are achieved through time-domain transposition, avoiding interference caused by prioritizing the time dimension. This ensures that subsequent patching and linear projection are performed independently on the time series of a single node, effectively preserving the unique evolutionary characteristics of each node and reducing the impact of spatial interference on the accuracy of time-domain modeling. The steps include: S1.1 Perform reversible normalization on the original multivariate traffic flow data to obtain the normalized intermediate representation; S1.
2. The intermediate representation structure is rearranged, and the positions of the time dimension and the variable node dimension are swapped, so that the original sequence structure arranged in chronological order is transformed into a variable-dominated organization, resulting in a serialized representation form based on variable decoupling.
3. The method according to claim 1, characterized in that: S2 includes: S2.1 A set of multiple time window lengths is pre-defined to represent different time resolution scales, where each window length corresponds to a scale level. The number of elements in this set is determined by the total number of pre-defined scales, which is used to support subsequent multi-granularity partitioning and modeling of time series. S2.2 For multiple pre-defined time window scales, the serialized representation of the variables after decoupling is independently divided once, so that each time window scale generates a corresponding set of feature blocks, thereby obtaining multi-scale feature representations under multiple different time resolutions. S2.
3. The feature dimension of the multi-scale feature representation is mapped by the linear projection layer corresponding to each time window scale, and the feature blocks of each scale are mapped from the original temporal feature space to the high-dimensional latent space to obtain the multi-scale feature embedding.
4. The method according to claim 1, characterized in that: S3 includes: S3.1 Temporal Evolution Feature Extraction and Initial Evolution Score Generation at Each Scale: For the multi-scale feature embeddings corresponding to each scale, mean pooling is performed on the patch number dimension to extract stable embedding representations for each scale; the stable embedding representations are mapped to the unified gated hidden space corresponding to the gated routing module, and gated hidden representations are obtained through linear projection; the gated hidden representations are input into a selective state space operator to model dynamic dependencies on the variable dimension to obtain the corresponding temporal evolution features; wherein, the selective state space operator is a state space modeling unit based on input adaptive modulation, which performs recursive state updates on the input sequence on the variable dimension, modulates the state evolution process through a parameter mapping function dynamically generated by the input, and outputs the corresponding feature representations; the modeled temporal evolution features are linearly mapped, and mean pooling compression is performed on the variable dimension to obtain the initial evolution scores corresponding to each scale; S3.2, Score Convergence and Traffic Flow Uncertainty Modeling: The initial evolution scores corresponding to each scale are concatenated to obtain multi-scale evolution initial scores; Gaussian random perturbation is introduced into the multi-scale evolution initial scores to perform probabilistic adaptive calibration on the path scores generated by the time-domain evolution features, so as to enhance the model's ability to model the random fluctuation features of traffic flow, and dynamically match the change pattern of the target road network nodes at the current time step to generate enhanced path scores corresponding to each scale; wherein, the Gaussian random perturbation is generated by the combined action of a random matrix following a standard normal distribution and learnable weights, and is modulated based on the embedded aggregated features obtained by aggregating the multi-scale features embedded in the variable node dimension; S3.3 Scale-aware weight generation: A sparse screening mechanism based on local competition is adopted to sort the enhanced path scores from high to low according to the response value, retain a preset number of high-response paths and mask the rest of the paths to obtain an active path set; after competitive masking, discretized state indication information is generated according to the masking result to represent the activation state of each time scale path in the current calculation process; the filtered path scores are probability mapped to generate normalized scale-aware weights to represent the relative contribution of each active path under the current input.
5. The method according to claim 1, characterized in that: In step S4, for each activated modeling path at each scale, a bidirectional association modeling between variable nodes is achieved through a bidirectional selective state space structure. The operation steps are as follows: To establish global dependencies between variable nodes in a sequence, forward and reverse selective state-space encoding along the variable dimension is performed on the multi-scale feature embeddings corresponding to the activated paths to achieve bidirectional perception of node features; the forward encoded features and the reverse encoded features are fused to obtain bidirectional encoded feature representations.
6. The method according to claim 1, characterized in that: S5 include: S5.1 Multi-scale path feature weighted aggregation: The encoded features output by each activation path are aligned in the time feature block dimension, and the multi-scale features at the same time position are spliced together to obtain multi-scale fused features. Based on scale-aware weights, the fusion features of different scale paths are weighted and aggregated to obtain the encoded fusion representation; S5.2 Multi-layer stacking and residual fusion: The encoded fusion representation obtained in S5.1 is input into the multi-layer adaptive multi-scale module for layer-by-layer stacking modeling. Deep temporal dependencies are extracted step by step through inter-layer feature transfer, and a unified comprehensive representation is obtained through residual connection. S5.3 Feature Normalization and Nonlinear Enhancement: Layer normalization and feedforward network transformation are performed sequentially on the unified comprehensive representation obtained in S5.2 to obtain the enhanced unified representation. The feedforward network is used to perform nonlinear mapping and enhancement on the features.
7. The method according to claim 1, characterized in that, S6 include: S6.1 Linear Projection and Intermediate Result Generation: The unified comprehensive representation is mapped to the target prediction time step through a linear projection layer to obtain the prediction intermediate result; S6.2 Dimensional Transformation and Predicted Sequence Recovery: Perform dimensional transformation on the intermediate predicted results to restore the timeline order and obtain the predicted sequence; S6.3, Inverse Normalization Processing: Perform an inverse normalization operation on the predicted sequence to restore it to the original data scale and obtain the final prediction result; wherein, the inverse normalization operation corresponds to the reversible normalization operation; S6.4 Feature Completeness Constraints and Parameter Updates: Combining path weight distribution and path activation state, a multi-scale feature spectrum completeness constraint term is constructed, including a discrete metric based on path weight distribution and a discrete metric based on path activation state, used to characterize the distribution characteristics of the path at the weight allocation level and the path activation level, respectively. By jointly constraining the discreteness of the above two distribution characteristics, the model is prevented from being biased towards a single time resolution during feature extraction, thereby ensuring the coordinated expression of information at different time resolutions. Based on the multi-scale feature spectrum completeness constraint term, a joint optimization objective is constructed in conjunction with the prediction loss, and end-to-end updates of the entire network parameters are achieved through gradient backpropagation. Among them, the prediction loss is used to quantify the difference between the model output and the true value, and the multi-scale feature spectrum completeness constraint term is used to guide the model to fully utilize features at different time resolutions and improve the balance of multi-scale feature expression.
8. A multi-scale traffic flow prediction system based on a selective state-space model, characterized in that, include: The tokenization module is used to perform reversible normalization and dimension transpose on the original multivariate traffic flow sequence, thereby decoupling variables and generating a linear tokenized representation sequence. The gated routing module, connected to the tokenization processing module, is used to generate multi-scale feature blocks from the linear tokenized representation sequence, map the multi-scale feature blocks to a high-dimensional latent space through linear projection to obtain multi-scale feature embedding, dynamically generate initial scale scores for the multi-scale feature embedding based on selective state space operators, and output adaptive activation paths and scale-aware weights after traffic flow uncertainty modeling, adaptive feature sparsity filtering and probability mapping. The feature encoding module, connected to the gated routing module, is used to perform bidirectional selective state-space encoding on the multi-scale feature embedding corresponding to the activation path, extract the global dependency relationship between variable nodes and output the path encoding feature; The fusion modeling module, connected to the feature encoding module, is used to aggregate path encoded features based on scale-aware weights, and generate a unified comprehensive representation through multi-layer stacking and residual fusion. The prediction output module, connected to the fusion modeling module, is used to map the unified comprehensive representation to the target time step, and output the final traffic flow prediction result after dimensional transformation and inverse normalization. The parameter optimization module, connected to the prediction output module, is used to construct a joint optimization objective by combining the prediction loss and the completeness constraint of the multi-scale feature spectrum, and to achieve end-to-end update of the model parameters through gradient backpropagation.
