A time series classification method based on frequency domain feature extraction

CN118606844BActive Publication Date: 2026-09-08HANGZHOU DIANZI UNIV +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410756696.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-13
Publication Date
2026-09-08
Estimated Expiration
2044-06-13

AI Technical Summary

Technical Problem

然后,使用这种方法来进行时序建模以此来实现时序分类还存在着两个难以避免的关键问题:缺乏频域维度上的特征抽取和注意力层时空复杂度过高的问题

Benefits of technology

[0014]This invention introduces a DR-attention self-attention layer as a temporal modeling method for time-series data, supplementing the feature representation of time-series data in the temporal dimension. Then, it combines a dot product reduction strategy to effectively reduce the spatiotemporal complexity of the self-attention layer, thereby completing the learning of temporal features while reducing the required resources and improving the accuracy of time-series classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118606844B_ABST
    Figure CN118606844B_ABST
Patent Text Reader

Abstract

The application discloses a time series classification method based on frequency domain feature extraction, which first acquires time series information of different dimensions in a data set and applies standardization. Secondly, the standardized time series information is put into a time block layer for decomposition, and the decomposed data is input into a self-attention layer in a Transformer to extract time domain features. Then, Fourier decomposition is performed on the time domain features, and high-frequency components and low-frequency components on the frequency domain are retained simultaneously by selecting an operator, and then inverse Fourier transformation is performed to convert the time series data to the time domain dimension. Finally, according to the time domain feature and the frequency domain feature information, the time series data is classified by a classifier. Thus, the application solves the problem of lacking learning of frequency domain information in the classification process of time series data, and improves the accuracy of time series classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of social data governance, specifically involving a time series classification method based on frequency domain feature extraction. Background Technology

[0002] Today, users of various applications generate massive amounts of data during their use. Multivariate time series data are ubiquitous in applications; they are longitudinally acquired sequences of events, each event consisting of observations recorded by multiple attributes, typically by a set of sensors simultaneously over time. For example, electrocardiogram (ECG) signals in electronic health records (EHRs) can be represented as multivariate time series data, which can be obtained from multiple sensors over time. Because time series data is a popular data type, present in a wide range of research fields and applications, comprehensive analysis of this data can facilitate decision-making in practical applications such as human activity identification, healthcare monitoring, and industry detection. In particular, Multivariate Time Series Classification (MTSC), as one of the fundamental problems in time series analysis, has received significant attention from both academia and industry.

[0003] Transformer-based time series classification models have received widespread attention and have recently made significant progress as a sequence modeling method. Therefore, training time series data using Transformer-based classification models to fully leverage the Transformer's ability to capture long-range dependencies and interactions in the time domain is currently the mainstream deep learning approach for time series classification. However, using this method for time series modeling and classification still faces two unavoidable key problems: the lack of feature extraction in the frequency domain and the excessively high spatiotemporal complexity of the attention layer. The lack of frequency domain feature extraction means that Transformer-based time series classification models only analyze and extract features in the time domain. However, time series data can be modeled and analyzed not only in the time domain but also in the frequency domain, and the lack of frequency domain feature extraction will affect the accuracy of time series classification to some extent. The high spatiotemporal complexity of the attention layer remains a persistent problem because the time and memory complexity of the self-attention mechanism in the Transformer architecture is proportional to the square of the sequence length input. These are key issues that time series classification needs to address. Summary of the Invention

[0004] One objective of this invention is to address the insufficient accuracy of existing time series classification techniques and the data imbalance in time series classification datasets. This invention proposes a time series classification method based on frequency domain feature extraction. By modeling the time series in both the time and frequency domains, different features are extracted. Fourier transform is used to effectively extract frequency domain features from the time series data, thus supplementing the features of the time series data. Transformer networks, self-attention mechanisms, and Fourier transforms are utilized to extract both time and frequency domain features, constructing a complete time series classification model based on frequency domain feature extraction to improve the accuracy of time series classification.

[0005] The technical solution adopted in this invention is as follows:

[0006] Step 1: Obtain time series information of different dimensions in the dataset, and standardize the time series dataset so that each feature of the data has zero mean and unit variance.

[0007] Step 2: Apply standardization to both training and testing data, and put the standardized time series information into the time block layer for decomposition.

[0008] By effectively decomposing the data through time-block layers and inputting it into different stages, the model learns time series representation methods under different dimensions and lengths, thereby improving its ability to understand time series data.

[0009] Step 3: Extracting temporal features from time-series data: Input the decomposed data into the self-attention layer in the Transformer to extract temporal features.

[0010] Transformer reduces the time scale of k and v in the self-attention layer by using a variant of the self-attention layer, DR-attention, which effectively reduces the computational overhead of q, k, and v, and reduces the time and space complexity to a certain extent.

[0011] Step 4: Extracting frequency domain features from time-series data: Fourier decomposition of time-domain features is performed using the Fourier module, and frequency domain components are preserved by selecting operators. Then, frequency domain features are obtained by inverse Fourier transform combined with seasonal trend decomposition MOE.

[0012] Step 5: Based on the time domain features and frequency domain features, the classifier performs classification to obtain the classification results.

[0013] The technical solution provided by this invention has the following beneficial effects:

[0014] This invention introduces a DR-attention self-attention layer as a temporal modeling method for time-series data, supplementing the feature representation of time-series data in the temporal dimension. Then, it combines a dot product reduction strategy to effectively reduce the spatiotemporal complexity of the self-attention layer, thereby completing the learning of temporal features while reducing the required resources and improving the accuracy of time-series classification.

[0015] This invention introduces a frequency domain feature extraction model as a frequency domain modeling method for time series data, serving as a feature representation of time series data in the frequency domain dimension. By learning features from the Fourier transform vectors and extracting frequency domain features through selection operators, this invention solves the problem of lacking learning of frequency domain information in the classification process of time series data, thereby improving the accuracy of time series classification. Attached Figure Description

[0016] Figure 1 This is an overall flowchart of the method of the present invention;

[0017] Figure 2 This is a schematic diagram of the network structure of the present invention. Detailed Implementation

[0018] The present invention will now be further analyzed with reference to the accompanying drawings.

[0019] A time-series classification method based on frequency domain feature extraction, such as Figure 1 and Figure 2 As shown, it includes the following steps:

[0020] Step (1): Obtain time series information of different dimensions in the dataset. By applying standardization techniques to the original time series data, each feature has zero mean and unit variance, and the dimensionality is kept consistent before and after, thus obtaining the time series vector. Where B represents the number of items per batch, M represents the dimension of the current dataset, and D represents the length of the time series data. The vectors are then fed into the time-blocking layer, introducing a hierarchical structure to learn time series representations at different time scales, i.e., aggregating continuous neighborhood points through slicing operations.

[0021] E = Concat(B, s) j *M, D / s j )

[0022] Where E represents the previous time series vector, (B, s) j *M, D / s j The ) indicates the current dimension size. Concat means concatenating and merging the time-series representations at different scales, returning the time-series representations at different scales. j This is the window slice size. (Per second) jContinuous points are grouped into a single information time slice. Assuming the entire model consists of three stages, each employing the same method, the fine-grained original time series is concatted into a new granular version, where each time block is T / 4 in length. The time series is then flattened and projected into a 4C-dimensional embedding vector. The output vector of the previous stage serves as the input to the next stage. This stage-propagation approach effectively learns time series representations at different scales.

[0023] Step (2): Temporal dimension feature extraction of time series data. Temporal dimension time series data modeling is mainly accomplished by the self-attention layer in the Transformer. The self-attention layer attempts to calculate the similarity between the query and the key, and assigns weights through dot product. The attention weight matrix is ​​multiplied by an output matrix and a bias vector is added to obtain the final output representation matrix, which contains the context-aware representation of each position. This is used as the feature representation of the time series in the temporal dimension for subsequent encoder layers or other related tasks.

[0024] In the Transformer model, the attention layer is a core component. It plays a crucial role in processing sequential data, effectively capturing the correlation and importance between different positions in the sequence, assigning different weights, and using this information for the model's learning and inference processes. Simultaneously, it allows each position to directly access information preceding and following the entire sequence, which is why it can directly assign weights. It utilizes a self-attention mechanism to obtain global contextual information.

[0025] This invention introduces a novel attention computation strategy called Dot Product Reduced Attention (DRA) to replace traditional temporal self-attention and reduce time and space complexity. The core idea of ​​the DRA mechanism is to reduce the size of the attention dot product by calculating a reduced version of the inputs k and v. The details of the DRA operation in stage j can be described as follows:

[0026]

[0027] Where Concat represents a join operation, N j W is the number of heads in the attention layer. o It is a weight matrix.

[0028]

[0029] in These are linear projection parameters. Therefore, the size of each head is equal to C. j / N jHere, DR represents a reduction in the time scale of k and v, thereby reducing the size of the dot product, which can be written as:

[0030] DR(x) = Norm(Reshape(x, R) j W T )

[0031] in Represents the input sequence, R j Represents the reduction ratio of the attention layer in stage j. Reshape(x, R) j () reshapes the input sequence x into a sequence of size L. j / R j Operations on the sequence, W T It reduces the dimension of the input sequence to C. j The linear projection. Here, the present invention uses layer normalization to implement Norm. Then, as with the traditional attention dot product, the dot product of q, k, and v is performed. The attention dot product of the present invention can also be expressed as:

[0032]

[0033] The computational cost of this attention operation is 1 / R that of standard self-attention. i Therefore, the dot product reduction self-attention mechanism of the present invention can handle longer input feature maps or sequences without requiring too many resources.

[0034] Step (3) Frequency domain feature extraction of time series data: Following the time domain feature extraction in step (2), the time series data also needs frequency domain feature extraction. This invention uses a random selection of a certain number of Fourier components, including both high-frequency and low-frequency components, to represent the time series modeling in the frequency domain. The following will analyze the reasons for this selection and the rationale for randomness:

[0035] Suppose there are m time series, denoted as X1(t), ..., X... m (t). Perform a Fourier transform on each time series, and the transformed vector representation is as follows:

[0036] a i =(a i,1 , ..., a i,d ) T ∈R m×d

[0037] This invention will each X i (t) is transformed into vector a iHere, m represents the number of time series, d represents the length of the time series, each row represents a different time series, and each column corresponds to a different Fourier decomposition component. While retaining all frequency components can restore all information to the greatest extent, completely retaining all components may lead to overfitting of historical data, thus affecting the final classification effect. Therefore, to avoid overfitting and retain as much historical information as possible, this invention selects a subset of high-frequency and low-frequency components generated by Fourier transform in the time series data; that is, it uniformly selects s ​​components from n Fourier components, where d > s. This avoids the previous overfitting situation. The above is the rationale analysis of screening and randomization.

[0038] Frequency domain feature extraction is represented as:

[0039]

[0040] in This represents the output vector of the current self-attention layer. The MOE module is the seasonal trend decomposition MOE module, which can effectively extract the seasonal trend components in time series data. This method effectively extracts the frequency domain features of time-series data using Fourier modules. It also employs the aforementioned approach, uniformly and randomly retaining s components from the generated n components to preserve historical information as much as possible while minimizing overfitting. The generated... After full connection, residual connection is performed again to solve the problems of gradient vanishing and gradient exploding, and improve the training effect of the model. Then, a seasonal trend decomposition (MOE) layer is added, and the result is used as the output of frequency domain feature extraction.

[0041] The Fourier module in the frequency domain feature extraction module of this invention uses the discrete Fourier transform. To represent the Fourier transform, then This represents the inverse Fourier transform. Assume we have a sequence of real numbers X. n In the time domain, where n = 1, 2, ..., N, the Discrete Fourier Transform is defined as... Where i is the imaginary unit, X l Let l = 1, 2, ..., N be a sequence of complex numbers in the frequency domain. The inverse discrete Fourier transform is defined as:

[0042]

[0043] Frequency domain feature extraction using discrete Fourier transform and inverse discrete Fourier transform can effectively reduce computational complexity.

[0044] The specific steps in the Fourier module are as follows:

[0045] Fourier modules for input (x∈R) N×D Perform a linear projection, where ω is the weight:

[0046] q=x·ω

[0047] Then q is transformed from the time domain to the frequency domain. The time scale after the Fourier transform of Q is represented as Q∈C. N×D In the frequency domain, only M randomly selected modes are retained; therefore, this invention uses a selection operator:

[0048]

[0049] in And M << N, the global Fourier module can be defined as:

[0050]

[0051] Where R∈C D×D×M The parameter kernel is randomly initialized, let Y = Q⊙C, where Y∈C M×D The algorithm ⊙ is defined as follows: Where d i d0 is the input channel, and d0 is the output channel. Due to the need for front-to-back dimension alignment, the high-frequency and low-frequency components selected by the selection operator need to be zero-padded to C. N×D The dimension is then converted back to time domain information by performing an inverse Fourier transform.

[0052] To handle common complex periodic patterns and significant data trends, a Seasonal Trend Decomposition (MOE) module is introduced into the frequency domain feature extraction module. The MOE module contains a set of filters of different sizes used to combine the extracted trend components with relevant weights to form the final trend term.

[0053] Step (4): Based on the vector output from the frequency domain feature extraction module, predict the probability that the event sequence belongs to the j-th category.

[0054]

[0055] in This represents the j-th element after passing through the frequency domain feature extraction module.

[0056] The loss function used in this invention is the cross-entropy loss function. The calculation method for the cross-entropy loss of a single-label n-classification task for a batch is shown in the equation.

[0057]

[0058] Where batch_size represents the number of batches. This represents the true category of the time series, and n represents the number of categories in the time series.

[0059] This invention conducts all experiments on 13 public datasets selected from the well-known UEA Multivariate Time Series Classification (MTSC) archive. In fact, the UEA archive has become one of the most widely used multivariate time series benchmarks. We selected a set of 13 multivariate datasets from the UEA archive, which differ in the number, length, and number of time series samples and classes. Specifically, this invention selects: ArticleyWordRecognition (AWR), AtrialFibrillation (AF), CharacterTrajectories (CT), FaceDetection (FD), HandMovementDirection (HMD), Heartbeat (HB), MotorImagery (MI), NATOPS (NA), PenDigits (PD), PEMS-SF (PEMS), SelfRegulationSCP2 (SRS2), SpokenArabicDigits (SAD), and StandWalkJump (SWJ). In these original datasets, both the training and test sets have been well-processed. For fair comparison, this invention does not perform any processing on these datasets. This invention summarizes the main characteristics of the datasets in Table 1.

[0060] Table 1: Static data of the experimental dataset

[0061]

[0062]

[0063] For each dataset, classification accuracy is calculated as an evaluation metric. Average rank and the number of wins / draws are also calculated to compare different methods.

[0064] Table 2: Details of Implementation Results

[0065] AWR 0.987 0.997 0.993 0.98 0.9733 AF 0.333 0.4 0.133 0.414 0.4667 CT 0.997 0.984 0.987 0.998 0.9875 FD 0.556 0.574 0.563 0.645 0.6967 HMD 0.378 0.365 0.527 0.347 0.6622 HB 0.751 0.702 0.727 0.626 0.761 MI 0.59 0.49 0.59 0.55 0.59 NA 0.939 0.917 0.883 0.877 0.9222 PEMS 0.751 0.861 0.763 0.867 0.896 PD 0.98 0.905 0.98 0.989 0.9848 SRS2 0.55 0.533 0.556 0.561 0.5778 SAD 0.983 0.96 0.982 0.99 0.9873 SWJ 0.4 0.4 0.2 0.4 0.5333 Avg 0.707 0.699 0.683 0.711 0.772

[0066] As shown in Table 2, the present invention has been compared with previous time series classification models. Compared with Tapnet, MR-PETSC, SMATE and DANET released in previous years, the overall average accuracy of the present invention has been improved by 6.50%, 7.31%, 8.88% and 6.11%, respectively.

Claims

1. A time series classification method based on frequency domain feature extraction, characterized in that, Includes the following steps: Step 1: Obtain time series information from different dimensions of the dataset and perform standardization processing; Step 2: Put the standardized time series information into the time block layer for decomposition. Step 3: Input the decomposed data into the self-attention layer in the Transformer to extract temporal features; The self-attention layer in the Transformer uses TR-attention to reduce the self-attention layer's latency. Time scale, reduce The computational overhead for the three is as follows: Temporally Reduced Attention (TRA) is used as an attention computation strategy to replace temporal self-attention, by using input... Attention is calculated based on the reduction; the TRA operation in stage 𝑗 is described as follows: in It refers to the number of heads in the attention layer. It is a weight matrix; in These are linear projection parameters; the size of each head is equal to... , express Time scale reduction: in Represents the input sequence. This indicates the reduction ratio of the attention layer in stage 𝑗; It reshapes the input sequence 𝑥 into a form of size 𝑥. Operations on sequences, It reduces the dimension of the input sequence to Linear projection; implemented using layer normalization operation. Then proceed The dot product operation, the attention dot product is represented as: The computational cost of the attention operation is the same as that of standard self-attention. ; Step 4: Perform Fourier decomposition on the time-domain features using the Fourier module, retain the frequency-domain components by selecting operators, and then obtain the frequency-domain features by inverse Fourier transform combined with seasonal trend decomposition MOE. Step 5: Based on the time domain features and frequency domain features, the classifier performs classification to obtain the classification results.

2. The time series classification method based on frequency domain feature extraction according to claim 1, characterized in that, The implementation of the time-blocking layer is as follows: Aggregate contiguous neighborhood points through slicing operations: in This represents the previous time series vector. Indicates the current dimension size. Indicates the quantity per batch. Indicates the dimension of the current dataset. Indicates the length of the time series data. This indicates that time blocks are segmented, concatenated, and merged to return time series representations at different scales. It is the window slice size; each Each consecutive point will be grouped into a single information time slice.

3. The time series classification method based on frequency domain feature extraction according to claim 2, characterized in that, In step 4, the frequency domain feature extraction is represented as follows: in This represents the output vector of the current self-attention layer. The module is the Seasonal Trend Decomposition (MOE) module. It extracts the frequency domain features of time-series data through Fourier transform modules, and then generates... Perform full connection Then, residual linking is performed again, followed by the addition of a seasonal trend decomposition (MOE) layer, and the result is used as the output of frequency domain feature extraction.

4. The time series classification method based on frequency domain feature extraction according to claim 3, characterized in that, The Fourier module uses the Discrete Fourier Transform. To represent the Fourier transform, then This represents the inverse Fourier transform; assume there is a sequence of real numbers. In the time domain, among The Discrete Fourier Transform is defined as ,in It is the imaginary unit. It is a complex sequence in the frequency domain, and the inverse discrete Fourier transform is defined as... The specific steps in the Fourier module are as follows: Fourier module for input Perform linear projection. Weights: Then Transform from the time domain to the frequency domain; the time scale after the Fourier transform of Q is expressed as... In the frequency domain, only M randomly selected modes are retained, using a selection operator: in and The global Fourier module is defined as: in It is a randomly initialized parameter kernel, making ,in The algorithm Defined as ,in It is the input channel. It is the output channel; the high-frequency and low-frequency components selected by the selection operator are padded with zeros. The dimension is then converted back to time domain information by performing an inverse Fourier transform.

Citation Information

Patent Citations

  • Time sequence prediction method based on frequency domain information enhancement and multi-scale trend enhancement

    CN117807405A

  • Methods and systems for implicit attention with sub-quadratic complexity in artificial neural networks

    WO2023039681A1