Time sequence classification method based on improved genetic algorithm and Fourier transform

Through the improved genetic algorithm and Fourier transform, combined with the frequency domain saliency mode acquisition method, the balance problem between accuracy and time consumption in time series classification is solved, and efficient Shapelet feature extraction and classification is achieved, which is suitable for large data set, improving interpretability and accuracy.

CN118656774AInactive Publication Date: 2024-09-17SOUTHWEST PETROLEUM UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411154612.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-22
Publication Date
2024-09-17
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing time series classification methods are difficult to achieve a balance between accuracy and time consumption, especially when processing large data sets, and lack interpretability, resulting in limited application prospects.

Method used

Using improved genetic algorithm and Fourier transform, through improved crossover operator and variable-length sliding window design, Shapelet features are independently obtained for each time series, and through frequency domain saliency mode acquisition method, combined with zero amplitude and Pruning strategy to achieve high-precision classification.

Benefits of technology

It achieves fast acquisition and high-precision classification of Shapelets, maintains the interpretability of the method, avoids complex parameter adjustment processes, and is suitable for large time series data sets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118656774A
    Figure CN118656774A
Patent Text Reader

Abstract

The invention discloses a time sequence classification method based on an improved genetic algorithm and Fourier transform, and belongs to the field of time sequence classification. According to the technical scheme, through an improved genetic algorithm, a fitness function of the improved genetic algorithm can rapidly descend, high-quality Shaplet features of the sequence can be obtained, and discrete Fourier transform is adopted to obtain a time sequence frequency domain saliency mode. According to the specific improved design, independent Shaplet is learned for a single sequence, and the interpretability of the method is reserved through the design; and moreover, a crossover operator of the improved genetic algorithm enables the genetic algorithm to learn effective genes in a more targeted manner, so that a fitness function can be rapidly reduced. According to the frequency domain feature part, a variable-length sliding window is combined with discrete Fourier transform and f test for significance analysis, and the problem of information loss caused by Shaplet features is effectively solved through the design. Compared with other interpretable methods, the result of the method has advantages in precision and time complexity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of time series classification, and in particular to a time series classification method based on genetic algorithm and Fourier transform. Background Art

[0002] Time series classification tasks have appeared in various fields and have a wide range of applications. Influenced by the current era of big data, time series often have large feature space dimensions, and classification methods based on deep learning lack interpretability, which limits their application prospects in some fields. In recent years, time series related technologies have greatly improved interpretability and classification accuracy, such as Shapelet feature representation in the time domain, that is, characterizing the global through subsequences. Although there are disadvantages such as high time complexity and the inevitable loss of important information of the original sequence when obtaining Shapelet, it is difficult to apply to large data sets, but it still becomes the mainstream method for time series interpretability research. Usually, the research on Shapelet is mainly focused on reducing its time cost, such as Fast Shapelet, and improving its classification accuracy, such as Shapelet Transform, but it is difficult for them to achieve a balance between time consumption and accuracy.

[0003] Using frequency domain information to represent time series is also a common research direction, such as SFA, BOSS, WEASEL, etc., which can achieve a balance between interpretability and accuracy. However, existing research is also limited to its complex hyperparameter adjustment, which greatly reduces the robustness of the methods used for different problems.

[0004] Since genetic algorithms do not need to calculate gradients, they have the advantages of fast iteration speed and high classification accuracy. However, existing studies on obtaining Shapelets through genetic algorithms have not focused on the impact of internal structures on the quality of their Shapelets, such as GENDIS. However, the huge advantage of genetic algorithms in terms of time cost cannot be ignored.

[0005] In general, the current interpretable feature representations based on time series have some drawbacks. It is difficult to achieve a balance between accuracy and time consumption, which makes it difficult to process large data sets and has limited application prospects. Summary of the invention

[0006] The purpose of the present invention is to solve the problem that there is no good interpretability method that can take into account both classification accuracy and time cost. In order to improve the speed of obtaining Shapelet, the present invention introduces an improved genetic algorithm. On the basis of the existing one, the crossover operator inside it is changed to make it more targeted at extracting Shapelet features, and a form of obtaining its Shapelet separately for each time series is designed. This is the biggest difference from the original form of obtaining a group of Shapelets for the entire data set. Such a design avoids sacrificing the interpretability of the method; at the same time, the present invention designs a frequency domain significant pattern acquisition method, which uses a variable-length sliding window to traverse the sequence, and acts on each window through discrete Fourier transform, uses zero amplitude and each window to do f significance test, and uses two different pruning strategies to screen the best frequency domain significant window for discrete Fourier inverse transform, and finally achieves high-precision classification of time series.

[0007] Specifically, the present invention provides a time series classification method based on an improved genetic algorithm and Fourier transform, which mainly includes the following steps: S1. Obtain independent Shapelet features for each time series of the data set through an improved genetic algorithm and use it as a time-domain significant pattern; S2, traverse each time series through a sliding window of variable length, and perform discrete Fourier transform on the sequence in the window; S3, perform an f test on all acquired windows and zero amplitude to measure their significance, and retain the windows that meet the conditions; S4, filter by pruning strategy, and finally retain the window as the significant pattern in frequency domain; S5, performing inverse Fourier transform on the last retained frequency domain significant pattern, and concatenating it with the time domain significant pattern; S6. Perform subsequent classification processing.

[0008] The genetic algorithm described in step S1 adopts an improved method, and the specific improvement is to solve the characteristic matrix of the genetic algorithm fitness function D , dist ( T,S ) represents the distance value between the Shapelet candidate children and the time series, where S Represents the Shapelet candidate child set, with j Candidate progeny, using S j Represents an independent individual of the Shapelet candidate offspring; T is a set of time series, with i time series, using T i Represents independent individuals in the time series. Similarly dist ( T i ,S ) represents the distance value between the Shapelet candidate offspring and a single time series individual; p is any position in the time series, W l is the window size, here W l Set to Shapelet individual S j The same size, so T i [ A,B ] represents the subsequence of the time series from position A to position B. By continuously sliding the window, the minimum subsequence distance value is used as the distance value between the Shapelet candidate offspring and the individual of a single time series. d ( A,B ) is a distance function representing the distance from A to B, such as the Euclidean distance or the DTW distance. The difference of this invention is that in order to retain the interpretability of the method, the characteristic matrix of the entire genetic algorithm fitness function is not used. D Instead of optimizing the fitness, the diagonal values ​​of the matrix are optimized to find a high-quality Shapelet for each time series, as shown in the following formula: ; The second improvement lies in its crossover operator. The present invention innovatively proposes two new crossover methods to obtain better offspring. The first crossover method is called a random position-based crossover operator. Different from the traditional one-point or two-point crossover, the position-based crossover will increase the crossover fragments. The second crossover method is called weight-based crossover. A weight value is added to each new offspring gene, and the attenuation coefficient is set to 0.9. When the gene completes the crossover, the weight will be multiplied by the attenuation coefficient, and the gene will preferentially cross with the high-weight fragments. The advantage of this design is that it has a broader field of vision to learn the high-quality gene fragments of the offspring.

[0009] The variable-length sliding window described in step S2 avoids the complex parameter adjustment process of existing studies and can separate important information in the time series at multiple scales. That is, there is no need to set a specific size of the window, but a range. The algorithm will automatically retain windows that meet the conditions for subsequent processing.

[0010] In step S3, the f-test values ​​of all windows obtained in S2 and zero amplitude are calculated as a significance test. The present invention retains all significant windows, discards window information that does not meet the f-test hypothesis, and the number of retained patterns is set to 5.

[0011] The pruning strategy described in step S4 includes two pruning operations, namely, first, when the f-test values ​​are equal, the window pattern with a smaller length is retained. Since the goal of the present invention is to obtain a second significant pattern in the frequency domain that is completely independent of the significant pattern in the time domain, fast DTW is used to calculate the distance between the candidate frequency domain pattern and the significant feature in the time domain, and only the pattern with the largest distance is retained. It is worth noting that the order of the above two pruning strategies cannot be reversed.

[0012] The process described in step S5 requires inverse transformation of the window obtained in S4 and then concatenation with the Shapelet obtained in S1.

[0013] Step S6 performs subsequent classification processing on the features obtained in S5.

[0014] Beneficial effects: The present invention realizes the rapid acquisition of Shapelet, retains the interpretability of the method based on previous studies, and improves the accuracy, while avoiding the complex parameter adjustment process, which is helpful for applying it to large time series data sets. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 It is a schematic diagram of the general flow of the time series classification method based on genetic algorithm and Fourier transform of the present invention; Figure 2 is an example diagram of the crossover operator of the present invention; Figure 3 is a comparison chart of the fitness drop curves of the present invention and GENDIS on the FaceAll dataset, and E-STAR is the abbreviation of the present invention; Figure 4 It is a comparison diagram of the fitness decline curves of the present invention and GENDIS on the Hering data set, and E-STAR is the abbreviation of the present invention; Figure 5 It is a comparison diagram of the fitness decline curves of the present invention and GENDIS on the ItalyPowerDemand data set, and E-STAR is the abbreviation of the present invention; Figure 6 It is a comparison diagram of the fitness decline curves of the present invention and GENDIS on the PhalangesOutlinesCorrect data set, and E-STAR is the abbreviation of the present invention; Figure 7 It is a comparison chart of the fitness decline curves of the present invention and GENDIS on the SonyAIBORobotSurface2 data set, and E-STAR is the abbreviation of the present invention; Figure 8 is a comparison chart of the fitness decline curves of the present invention and GENDIS on the Wine data set, and E-STAR is the abbreviation of the present invention; Fig. 9 is an example diagram of the interpretable Shapelet in the present invention; Fig.10 It is a comparison chart of the accuracy of the present invention and other classification methods, and E-STAR is the abbreviation of the present invention. DETAILED DESCRIPTION

[0016] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments and the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.

[0017] like Figure 1 As shown, the present invention provides a time series classification method based on genetic algorithm and Fourier transform, comprising the following steps: S1. Obtain independent Shapelet features for each time series of the data set through an improved genetic algorithm and use it as a time-domain significant pattern; S2, traverse each time series through a sliding window of variable length, and perform discrete Fourier transform on the sequence in the window; S3, perform an f test on all acquired windows and zero amplitude to measure their significance, and retain the windows that meet the conditions; S4, filter by pruning strategy, and finally retain the window as the significant pattern in frequency domain; S5, performing inverse Fourier transform on the last retained frequency domain significant pattern, and concatenating it with the time domain significant pattern; S6. Perform subsequent classification processing.

[0018] The genetic algorithm described in step S1 adopts an improved method, and the specific improvement is to solve the characteristic matrix of the genetic algorithm fitness function D , dist ( T,S ) represents the distance value between the Shapelet candidate children and the time series, where S Represents the Shapelet candidate child set, with j Candidate progeny, using S j Represents an independent individual of the Shapelet candidate offspring; T is a set of time series, with i time series, using T i Represents independent individuals in the time series. Similarly dist ( T i ,S ) represents the distance value between the Shapelet candidate offspring and a single time series individual; pis any position in the time series, W l is the window size, here W l Set to Shapelet individual S j The same size, so T i [ A,B ] represents the subsequence of the time series from position A to position B. By continuously sliding the window, the minimum subsequence distance value is used as the distance value between the Shapelet candidate offspring and the individual of a single time series. d ( A,B ) is a distance function representing the distance from A to B, such as the Euclidean distance or the DTW distance. The difference of this invention is that in order to retain the interpretability of the method, the characteristic matrix of the entire genetic algorithm fitness function is not used. D Instead of optimizing the fitness, the diagonal values ​​of the matrix are optimized to find a high-quality Shapelet for each time series, as shown in the following formula: ; Since calculating the distance between a shapelet of length L and a time series of length M requires (M−L + 1) × L point-by-point comparisons, in the worst case, each time series needs to perform O ( M 2 ) operations, resulting in a computational complexity of O ( NM 2 ). These distance calculations are applied to each individual in each generation representing a small set of patches in the population, so the time complexity of the original method is O ( GPKNM 2 ),in G is the total algebra, P is the overall size, K is the number of Shapelets candidates represented by each person in the population. Another benefit of the optimization process of the present invention is that its time complexity is reduced from O ( GPKND ), which greatly saves the time consumed by the algorithm. D is the calculation time of DTW.

[0019] The second improvement is in its crossover operator. The present invention innovatively proposes two new crossover methods to obtain better offspring. The first crossover method is called a random position-based crossover operator. Different from the traditional one-point or two-point crossover, position-based crossover increases the number of crossover fragments and can more likely focus on higher-quality fragments in the gene, such as Figure 2 As shown in part (a) of the figure, the corresponding parts in the upper and lower boxes are crossed; the second crossover method is called weighted crossover, which adds a weight value to each new offspring gene, and the decay coefficient is set to 0.9. When the gene completes the crossover, the weight will be multiplied by the decay coefficient, and the gene will be crossed with the high-weight fragments first. The advantage of this design is that it has a broader field of vision to learn the high-quality gene fragments of the offspring, rather than just learning from some candidates, which is conducive to the rapid decline of fitness, such as Figure 2 As shown in part (b) of the figure, the weights of the fragments in the three boxes in the right part decrease from left to right, and the parts with higher weights are preferentially selected for crossover. As shown in the left figure, the corresponding part of the leftmost frame is crossover. The present invention selects 6 types of data sets to verify the effectiveness of the design, and compares it with the existing genetic algorithm GENDIS for obtaining Shapelet. All fitness decline curves have advantages, such as Figures 3 to 8 shown.

[0020] The variable-length sliding window described in step S2 avoids the complex parameter adjustment process of existing studies and can separate important information in the time series at multiple scales. That is, there is no need to set the specific size of the window, but rather set the length range of the window. The algorithm will automatically retain windows that meet the conditions for subsequent processing, while increasing the number of samples to avoid errors in the subsequent use of the f-test.

[0021] In step S3, the f-test values ​​of all windows obtained in S2 and zero amplitude are calculated as a significance test. The present invention retains all significant windows and discards the window information that does not meet the f-test hypothesis, which is called the top-K significance mode. The K value is set to 5, that is, 5 potential frequency domain modes are retained.

[0022] The pruning strategy described in step S4 includes two pruning operations, namely, first, when the f-test values ​​are equal, the window pattern with the smallest length is retained. Since the goal of the present invention is to obtain a second significant pattern in the frequency domain that is completely independent of the significant pattern in the time domain, fast DTW is used to calculate the distance between the candidate frequency domain pattern and the significant feature in the time domain, and only the window pattern with the largest distance is retained. It is worth noting that the order of the above two pruning strategies cannot be reversed.

[0023] The process described in step S5 requires the inverse transformation of the window obtained by S4 and then splicing it with the Shapelet obtained by S1. The advantage of doing so is that the time domain information is supplemented. This is because the Shapelet feature may cause the loss of some important time domain information, and the frequency domain feature often contains pattern information that is difficult to mine in the time domain. Therefore, the present invention uses Fourier transform to supplement the time domain information. The process described in step S5 requires the inverse transformation of the window obtained by S4 and then splicing it with the Shapelet obtained by S1. The advantage of doing so is that the time domain information is supplemented. This is because the Shapelet feature may cause the loss of some important time domain information, and the frequency domain feature often contains pattern information that is difficult to mine in the time domain. Therefore, the present invention uses Fourier transform to supplement the time domain information.

[0024] Step S6 performs subsequent classification processing on the features obtained in S5. In order to verify the effectiveness of the present invention, a simple linear regression classifier is used as the classifier, which is convenient for comparison and verification with other methods.

[0025] In the specific implementation case of the present invention, 32 data sets in an online hosted time series database (UCR Time Series Classification Archive) were selected. The time series classification method of the present invention was used for analysis, and the classification results of the Shapelet feature characterization related method were compared. The experimental results are shown in Figure 2. Fig.10 As shown in the figure: The algorithms shown in the figure are Shapelet Transform, ST; Learning Time Series Shapelets, LTS; FastShapelets, FS; GENDIS. In order to ensure the reliability of the invention, the comparative experiment uses the same parameters as GENDIS, with the population size set to 100, 100 iterations, early stopping set to 10, crossover probability set to 0.4, and mutation probability set to 0.1. Compared with GENDIS, which also uses genetic algorithms as a framework for obtaining Shapelets, the advantages of the invention over GENDIS are demonstrated through interpretability results, such as Fig. 9 As shown, the dataset used is ECG5000.

[0026] The technical means disclosed in the scheme of the present invention are not limited to the technical means disclosed in the above-mentioned implementation mode, but also include technical schemes composed of any combination of the above-mentioned technical features. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications are also regarded as the protection scope of the present invention.

Claims

1. A time series classification method based on improved genetic algorithm and Fourier transform, characterized by: The time series classification method comprises the following steps:

1. Obtain independent Shapelet features for each time series of the data set through an improved genetic algorithm and use it as a time-domain significant pattern; 2. Traverse each time series through a sliding window of variable length and perform discrete Fourier transform on the sequence in the window; 3. Perform an f-test on all acquired windows and zero amplitude to measure their significance, and retain the windows that meet the conditions; 4. Filter through pruning strategy, and finally retain the window as the significant pattern in frequency domain; 5. Perform inverse Fourier transform on the last retained frequency domain saliency pattern and concatenate it with the time domain saliency pattern; 6. Carry out subsequent classification processing.

2. The time series classification method according to claim 1, characterized in that: The improved genetic algorithm described in step 1 specifically includes: The diagonal values ​​of the feature matrix of the genetic algorithm fitness function are optimized to find high-quality Shapelets for each time series, as shown in the following formula: ; in D is the characteristic matrix of the genetic algorithm fitness function, dist ( T,S ) represents the distance value between the Shapelet candidate children and the time series, where S Represents the Shapelet candidate child set, with j Candidate progeny, using S j Represents an independent individual of the Shapelet candidate offspring; T is a set of time series, with i time series, using T i Represents independent individuals in the time series. Similarly dist ( T i ,S ) represents the distance value between the Shapelet candidate offspring and a single time series individual; p is any position in the time series, W l is the window size, here W l Set to Shapelet individual S j The same size, so T i [ A,B ] represents the subsequence of the time series from position A to position B. By continuously sliding the window, the minimum subsequence distance value is used as the distance value between the Shapelet candidate offspring and the individual of a single time series. d ( A,B ) is the distance function representing the distance from A to B; The offspring are obtained through the random position-based crossover operator and the weight-based crossover operator.

3. The time series classification method according to claim 1, characterized in that: The sliding window described in step 2 is variable in length, specifically, the length range of the window is set, and the window that meets the f test is retained through step 3 for subsequent processing.

4. The time series classification method according to claim 1, characterized in that: The pruning strategy described in step 4 includes two pruning operations, specifically: first, when the f-test values ​​are equal, the window pattern with the smallest length is retained; then fast DTW is used to calculate the distance between the candidate frequency domain pattern and the time domain significant feature, and only the window pattern with the largest distance is retained.

5. The time series classification method according to claim 1, characterized in that: The subsequent classification process described in step 6 is specifically to perform classification process using a linear regression classifier.

Citation Information

Cited By

  • Time sequence classification method based on improved discrete wavelet transform and trend similarity measurement

    CN119989128A