Time series data classification method based on Shaplet and pso feature selection

Through the feature selection method of Shapelet and particle swarm optimization algorithm, the problem of excessive number of candidate subsequences in timing classification is solved, the calculation complexity is reduced and the feature evaluation standard is improved, and efficient timing data classification is achieved.

CN118885889AInactive Publication Date: 2024-11-01WENZHOU UNIV +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411385075.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2024-11-01
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

When the existing Shapelet-based timing classification method is used to process long time series, the number of candidate sub-sequences is too large, resulting in high computational complexity and poor accuracy, and the feature evaluation criteria need to be optimized.

Method used

A feature selection method based on Shapelet and particle swarm optimization algorithm is used to generate candidate features by segmenting and disassembling molecular sequences, and the optimal features are selected from them using particle swarm optimization algorithm, and a time domain and frequency domain features are classified.

Benefits of technology

It significantly reduces the number of candidate subsequences, reduces the computational complexity, and improves the feature evaluation criteria and classification accuracy, and enhances the diversity of feature expression.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885889A_ABST
    Figure CN118885889A_ABST
Patent Text Reader

Abstract

The invention provides a time series data classification method based on Shaplet and pso feature selection, and the method comprises the steps: obtaining an original time series, and initializing a segmentation number, a Shaplet candidate set, a subsequence set and a subsequence length range; segmenting the original time sequence according to the segmentation number to obtain a sub-sequence set; iteratively calculating the sub-sequence set to select a sub-sequence with the maximum current fitting error and a corresponding point with the maximum fitting error, splitting the currently selected sub-sequence left and right by taking the point as a center, adding the split sequence with the length within the sub-sequence length range into a shaplet candidate set, and after each iteration is completed, obtaining the sub-sequence with the maximum fitting error. Deleting and updating the currently selected sub-sequences of the sub-sequence set, and ending iterative calculation until the current number of the sub-sequences in the shaplet candidate set is greater than or equal to the segmentation number; and outputting a final shaplet candidate set. By implementing the method, the number of the candidate subsequences can be remarkably reduced, and the feature evaluation standard is improved while the calculation complexity is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a time series data classification method based on shapelet and pso feature selection. Background Art

[0002] At present, in the field of signal processing, time domain information often uses Shapelet-based time series classification methods to achieve feature extraction, that is, feature extraction is achieved by identifying important subsequences in the time series (called Shapelet) for classification. At this time, Shapelet is a time series subsequence with high discrimination ability, which can capture the key features of the time series and is used to distinguish different categories of time series.

[0003] However, in the prior art, Shapelet-based time series classification methods generally use a sliding window method to extract all possible subsequences as candidate features on each time series, and use information gain as an evaluation criterion to select the shapelet with the best discriminative ability.

[0004] However, once the original time series is too long, the number of candidate subsequences will be too large, resulting in a complex solution process and poor accuracy. In addition, the evaluation criteria for candidate features need to be improved and optimized.

[0005] Therefore, in order to solve the above problems, there is an urgent need for a new time series data classification method that can significantly reduce the number of candidate subsequences and reduce the computational complexity while improving the feature evaluation criteria. Summary of the invention

[0006] The technical problem to be solved by the embodiments of the present invention is to provide a time series data classification method based on shapelet and pso feature selection, which can significantly reduce the number of candidate subsequences and reduce the computational complexity while improving the feature evaluation standard.

[0007] In order to solve the above technical problems, an embodiment of the present invention provides a time series data classification method based on shapelet and pso feature selection, and the method comprises the following steps: S1. Get the original time series and initialize the number of segments to , the shaplet candidate set is empty, the subsequence set is empty, and the subsequence length range is [ ]; S2, according to the number of divisions , the original time series is segmented to obtain subsequences, and the resulting subsequences are added to the subsequence set; S3: Determine whether the current number of subsequences in the shaplet candidate set is less than the number of segmentations. ; If yes, go to step S4; if no, go to step S7; S4. According to the formula and Calculate the sum of the fitting errors of all subsequences in the subsequence set , and further select the current fitting error and maximal subsequence; where each subsequence is defined as M ; and are the subsequences in the subsequence set respectively M The starting point code and the end point code; is a subsequence in the subsequence set M The total number of all calculation points in ; Hehe are the subsequences in the subsequence set respectively M The starting and ending values ​​of The subsequence in the subsequence set M Middle The value of the calculation point; S5, in the currently selected fitting error and The largest subsequence determines the fitting error The maximum point and the fitting error determined The largest point is taken as the center, and the currently selected fitting error and The largest subsequence is split into left and right, and two subsequences are obtained, both with fitting errors. The maximum point split sequence is obtained, and further, from the two split sequences obtained, the split sequences whose lengths are within the subsequence length range are added to the shaplet candidate set; S6. Delete the currently selected fitting error and The largest subsequence is updated and the process returns to step S3; S7. Output the final shapelet candidate set.

[0008] Wherein, the method further comprises: The minimum distance between each subsequence in the output final shapelet candidate set and the original time series is taken as a candidate feature to form a feature combination, and a particle swarm optimization algorithm is used to find an optimal solution for the feature combination, and further according to the optimal solution, a corresponding subsequence is selected from the output final shapelet candidate set as the optimal feature output; wherein, in the particle swarm optimization algorithm, the fitness function used is constructed based on the classification accuracy and the number of feature selections.

[0009] Among them, through the formula , calculate the minimum distance between each subsequence in the final shapelet candidate set and the original time series ;in, is the original time series; The original time series Length, for Length; The original time series A starting index of , the length is subsequence; It represents the original time series subsequence The distance between.

[0010] Among them, the expression of the feature combination is .

[0011] The specific steps of using the particle swarm optimization algorithm to find the optimal solution for the feature combination, and further selecting the corresponding subsequence as the optimal feature output from the output final shapelet candidate set according to the optimal solution include: Step b1: Set the basic parameters of the particle swarm optimization algorithm, including population size, maximum number of iterations, maximum and minimum particle speeds, and individual optimal position weights. , global optimal position weight , and inertia weight ; Step b2: Randomly initialize the position and velocity of the particle in the feature space; wherein the position of each particle represents a feature subset, and each dimension of the position corresponds to the selection state of a feature; if the selection state value is 0, it means that it is not selected; conversely, if the selection state value is 1, it means that it is selected; Step b3: Use the number of feature selection and classification accuracy to construct the fitness function of the particle swarm optimization algorithm: , and use the fitness function to calculate the initial fitness value of each particle, and further use the current position and fitness value of each particle as the initial individual optimal position and optimal fitness value of the particle; where, is the classification accuracy; is the total number of features, which is the total number of subsequences in the final shapelet candidate set output, and takes a fixed value; Choose the number of features; and An important parameter used to balance the number of feature selection and classification accuracy, both of which take fixed values ​​between (0,1); Step b4: Update the speed of each particle according to the current particle position, speed, individual optimal position and global optimal position; the speed update formula is: ; The position update formula is ; For particles In iteration speed at 1000 s; particle In iteration The position at the time; For particles In iteration speed at 1000 s; particle In iteration The position at the time; For particles The individual optimal position of is the global optimal position; and are two random numbers between [0,1] respectively; Step b5: Use the feature subset selected by the current particle as input features to train the full convolutional neural network classification model, and record the classification accuracy of each particle after training; Step b6: Use the classification accuracy as the return value of the fitness function, calculate the fitness value in combination with the number of feature selections, and update the individual optimal position and the global optimal position; Step b7: When the maximum number of iterations is reached or the fitness value reaches the preset threshold, the search process is terminated, and the feature subset corresponding to the global optimal particle is finally selected as the final feature selection result output; Step b8: According to the final feature selection result, select the corresponding subsequence from the output final shapelet candidate set as the optimal time domain feature output.

[0012] Wherein, the method further comprises: The original time series is converted into frequency domain data, and the frequency domain data is fused with the output optimal time domain features by feature splicing, and the fused features are further used to construct a fully convolutional neural network (FCN) classification model; wherein the fully convolutional neural network (FCN) classification model consists of 3 one-dimensional convolutional layers plus a normalization layer and a ReLU activation layer, and the convolution kernel sizes of its convolutional layers are set to 8, 5, and 3, respectively, and the filter sizes are set to 128, 256, and 128, respectively.

[0013] An embodiment of the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the time series data classification method based on shapelet and pso feature selection as described above is implemented.

[0014] An embodiment of the present invention further provides a storage medium storing computer executable instructions, which, when executed by a computer processor, are used to execute the time series data classification method based on shapelet and pso feature selection as described above.

[0015] Implementing the embodiments of the present invention has the following beneficial effects: 1. Compared with the traditional shapelet generation method, the present invention introduces a method for generating candidates with time features, selects some intuitive time series subsequences as time features, and generates candidate shapelets by selecting key points in the time series, which can significantly reduce the number of candidate subsequences, reduce the computational complexity, and improve the interpretability of the model; 2. Compared with the traditional method that relies on brute force search and information gain, the present invention adopts the particle swarm optimization algorithm to select the optimal time domain features from the shapele candidate set containing important perception points (i.e., points with the largest fitting error) through collaborative search of the group, which not only improves the shapele feature evaluation standard, but also further reduces the computational complexity; 3. The present invention combines the optimal time domain features with the frequency domain features for classification, thereby enhancing the diversity of feature expression. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, without paying creative labor, other drawings obtained based on these drawings still belong to the scope of the present invention.

[0017] Figure 1A flowchart of a time series data classification method based on shapelet and pso feature selection provided by an embodiment of the present invention; Figure 2 A framework diagram of a fully convolutional neural network (FCN) in a time series data classification method based on shapelet and pso feature selection provided in an embodiment of the present invention; Figure 3 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0018] In order to make the objectives, technical solutions and advantages of the present invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings.

[0019] like Figure 1 As shown in the figure, a time series data classification method based on shapelet and pso feature selection is proposed in an embodiment of the present invention, and the method comprises the following steps: Step S1: Get the original time series and initialize the number of segments to , the shaplet candidate set is empty, the subsequence set is empty, and the subsequence length range is [ ]; Step S2: according to the number of divisions , the original time series is segmented to obtain subsequences, and the resulting subsequences are added to the subsequence set; Step S3: Determine whether the current number of subsequences in the shaplet candidate set is less than the number of segmentations. ; If yes, go to step S4; if no, go to step S7; Step S4: According to the formula and Calculate the sum of the fitting errors of all subsequences in the subsequence set , and further select the current fitting error and maximal subsequence; where each subsequence is defined as M ; and are the subsequences in the subsequence set respectively M The starting point code and the end point code; is a subsequence in the subsequence set M The total number of all calculation points in ; Hehe are the subsequences in the subsequence set respectively M The starting and ending values ​​of The subsequence in the subsequence set M Middle The value of the calculation point; Step S5: In the currently selected fitting error and The largest subsequence determines the fitting error The maximum point and the fitting error determined The largest point is taken as the center, and the currently selected fitting error and The largest subsequence is split into left and right, and two subsequences are obtained, both with fitting errors. The split sequence of the largest point, and further, from the two split sequences obtained, the split sequence whose length is within the subsequence length range is added to the shaplet candidate set; Step S6: Delete the currently selected fitting error and The largest subsequence is updated and the process returns to step S3; Step S7: output the final shapelet candidate set.

[0020] The specific process is as follows: In step S1, the original time series is input , and initialize the parameters; the parameters include but are not limited to the number of splits. , the shaplet candidate set is empty, the subsequence set is empty, and the subsequence length range is [ ]; The minimum expected length , is the maximum period length.

[0021] In step S2, the original time series According to the number of divisions Split and get subsequences, and this Each subsequence is added to the subsequence set.

[0022] In step S3, it is determined whether the current number of subsequences in the shaplet candidate set is less than the number of segmentations. If yes, execute step S4; if no, jump to step S7. It should be noted that since the shaplet candidate set is empty for the first time, the current number is 0.

[0023] In step S4, first, the fitting errors and sums of all subsequences in the subsequence set are calculated according to the following formula: : Each subsequence is defined as M ; and are the subsequences in the subsequence set M The starting point code and the end point code; is a subsequence in a subsequence set M The total number of all calculation points in ; Hehe are the subsequences in the subsequence set M The starting and ending values ​​of Subsequence in a subsequence set M Middle The value of the calculation point.

[0024] Secondly, the fitting errors and In the , select the current fitting error and The largest subsequence. In step S5, first, from the currently selected fitting error and The largest subsequence determines the fitting error The largest point, i.e. the perceptually important point ( PIP ),and .

[0025] Secondly, the fitting error The largest point is taken as the center, and the currently selected fitting error and The largest subsequence is split into left and right, and two subsequences are obtained, both with fitting errors. The largest point split sequence and ;in, PIP The previous subsequence is denoted as , PIP The subsequent subsequence is recorded as .

[0026] Finally, from these two split sequences and In the subsequence length range [ ] are added to the shaplet candidate set. For example, if The length conforms to the given subsequence length range [ ], it will be retained as a candidate and added to the shaplet candidate set; otherwise, it will be discarded. shaplet candidate set.

[0027] In step S6, the currently selected fitting error and The largest subsequence is updated and the process returns to step S3.

[0028] Repeat steps S3 to S6 until the current number of subsequences in the shaplet candidate set is greater than or equal to the number of segmentations. until.

[0029] In step S7, the above iterative calculation is ended and the final shapelet candidate set is output.

[0030] In summary, in the process of generating candidate features, the present invention can significantly reduce the number of candidate subsequences by selecting key points in the time series to generate candidate shapelets, thereby reducing the computational complexity and improving the interpretability of the model.

[0031] In an embodiment of the present invention, based on the particle swarm optimization algorithm, the collaborative search of the group can also reduce the computational complexity in the shapelet selection process. Therefore, the method further includes: The subsequences in the final shapelet candidate set are respectively converted to the original time series The minimum distance between them is the candidate feature to form a feature combination, and the particle swarm optimization algorithm is used to find the optimal solution for the feature combination, and further according to the optimal solution, the corresponding subsequence is selected from the output final shapelet candidate set as the optimal feature output; wherein, in the particle swarm optimization algorithm, the fitness function used is constructed based on the classification accuracy and the number of feature selections.

[0032] Specifically, the first step is to convert the original time series Transformed into a new representation. In the new representation, each time feature is considered as a feature, and the corresponding value is the time feature To the original time series The distance between.

[0033] That is, the following formula is used to calculate the subsequences in the final shapelet candidate set: To the original time series Minimum distance between : ; in, The original time series Length, for Length; The original time series A starting index of , the length is subsequence; It represents the original time series subsequence The distance between.

[0034] At this point, assuming there are k time features, the original time series T will be converted into the following form: Therefore, the feature combination is The second step is to use particle swarm optimization algorithm to optimize the feature combination Find the optimal solution, and further select the corresponding subsequence as the optimal feature output from the final shapelet candidate set based on the optimal solution. The specific steps include: Step b1: Set the basic parameters of the particle swarm optimization algorithm, including population size, maximum number of iterations, maximum and minimum particle speeds, and individual optimal position weights. , global optimal position weight , and inertia weight ; Step b2: Randomly initialize the position and velocity of the particle in the feature space; wherein the position of each particle represents a feature subset, and each dimension of the position corresponds to the selection state of a feature; if the selection state value is 0, it means that it is not selected; conversely, if the selection state value is 1, it means that it is selected; Step b3: Use the number of feature selection and classification accuracy to construct the fitness function of the particle swarm optimization algorithm: , and use the fitness function to calculate the initial fitness value of each particle, and further use the current position and fitness value of each particle as the initial individual optimal position and optimal fitness value of the particle; where, is the classification accuracy; is the total number of features, which is the total number of subsequences in the final shapelet candidate set output, and takes a fixed value; Choose the number of features; and An important parameter for balancing the number of feature selection and classification accuracy, both of which take fixed values ​​between (0,1); for example, Set to 1, Set to 0.01; Step b4: Update the speed of each particle according to the current particle position, speed, individual optimal position and global optimal position; the speed update formula is: ; The position update formula is ; For particles In iteration speed at 1000 s; particle In iteration The position at the time; For particles In iteration speed at 1000 s; particle In iteration The position at the time; For particles The individual optimal position of is the global optimal position; and are two random numbers between [0,1] respectively; Step b5: Use the feature subset selected by the current particle as input features to train the full convolutional neural network classification model, and record the classification accuracy of each particle after training; Step b6: Use the classification accuracy as the return value of the fitness function, calculate the fitness value in combination with the number of feature selections, and update the individual optimal position and the global optimal position; Step b7: When the maximum number of iterations is reached or the fitness value reaches the preset threshold, the search process is terminated, and the feature subset corresponding to the global optimal particle is finally selected as the final feature selection result output; Step b8: According to the final feature selection result, select the corresponding subsequence from the final shapelet candidate set as the optimal time domain feature output.

[0035] In summary, the present invention adopts the particle swarm optimization algorithm to search through the group's collaborative search from the important perception points PIP The optimal time domain features are selected from the shapele candidate set, which not only improves the shapele feature evaluation standard, but also further reduces the computational complexity.

[0036] In the embodiment of the present invention, in order to realize multi-modal temporal feature fusion, the method further includes: The original time series Convert it into frequency domain data, and fuse the frequency domain data with the output optimal time domain features through feature splicing, and further use the fused features to construct a fully convolutional neural network FCN classification model; wherein, the fully convolutional neural network FCN classification model consists of 3 one-dimensional convolutional layers plus a normalization layer and a ReLU activation layer, and the convolution kernel size of its convolutional layer is set to 8, 5, and 3 respectively, and the filter size is set to 128, 256, and 128 respectively.

[0037] In one example, first, the frequency domain data is converted to create a multimodal time series dataset containing time domain and frequency domain information. By transforming the data through Fast Fourier Transform (FFT), we can obtain the spectrum of the time series, which reflects the amplitude and phase information of each frequency component. The frequency domain features can capture the periodicity and frequency components in the data, and supplement the information of the time domain features.

[0038] Secondly, a multimodal data set is constructed, and the specific format is: frequency domain information sequence and time domain information sequence. The frequency domain information sequence and the time domain information sequence are processed differently, and the obtained frequency domain data are extracted to obtain the mean, variance, peak value, energy and other statistics of the frequency domain information as frequency domain features. The time domain features are the optimal time domain features selected by the particle swarm optimization algorithm.

[0039] Finally, the optimal time domain features and frequency domain features are fused through feature splicing, and the fused features are used to construct a fully convolutional neural network (FCN) classification model.

[0040] For example, 1) the optimal time domain features are fused with the frequency domain statistical features; 2) Determine the network structure based on the input data and initialize all hyperparameters, including the number of input channels, number of categories, kernel size of the convolutional layer, number of filters, etc. (e.g. Figure 2 shown); 3) Set the hyperparameters of training, including the number of epochs, batch size, learning rate, etc.

[0041] 4) Initialize the optimizer (Adam) and loss function (cross entropy loss).

[0042] 5) Set the variable maxacc to store the best accuracy and initialize it to 0.

[0043] 6) Start the training process. The specific steps are as follows: a. For each epoch: i. Initialize the total loss total_loss to 0.

[0044] ii. For each batch in the training set: 1. Load data and target tags onto the device.

[0045] 2. Convert the one-hot encoded target labels to category indices.

[0046] 3. Set the model to training mode.

[0047] 4. Perform forward calculation to get the output.

[0048] 5. Calculate the loss.

[0049] 6. Back propagation, calculate gradients.

[0050] 7. Update model parameters.

[0051] 8. Add the loss of this batch to total_loss.

[0052] b. After each epoch, calculate the accuracy on the validation set.

[0053] i. If the validation set accuracy of the current epoch is higher than maxacc, update maxacc.

[0054] 7) When all epochs are completed, the maximum training set accuracy maxacc is returned.

[0055] According to the above process, the present invention will obtain the classification label and classification accuracy of the test set.

[0056] The present invention is mainly used in the analysis of multi-sensor time series data when the robot is walking. The experimental data includes two sensor-based time series data sets, SonyAIBORobotSurface1 and SonyAIBORobotSurface2. These data sets include multi-dimensional information such as acceleration and angular velocity of the robot when walking on different surfaces captured by the sensor. The present invention finally realizes an efficient classification model by performing multi-level processing on these sensor data.

[0057] Table 1 shows the classification accuracy of the method proposed in the present invention, some shapelet-based methods and traditional methods on the test data set.

[0058] Table 1 Among them, Multi-SP (Multimodal time-frequency data classification based on shapelet and pso feature selection) is the method of the present invention, and TSC-TF (Time Series Classification method based on Temporal Features) is a method for selecting shapelet based on random forest importance metric, and the two use different feature selection methods. Also because the shapelet method has the characteristic of strong interpretability, the present invention is compared with another time series data method based on feature vectors (catch22) and the TSC method (FS) based on interpretable features with strong interpretability. In addition, our method is to convert the original subsequence into features by distance calculation, which is a distance-based method, so two commonly used distance-based baseline models (1NN-DTW) and (DTW-F) are used. The accuracy of the model of the present invention reached more than 90% on both data sets, and was better than all the comparison methods.

[0059] Based on the above embodiments and their preferred solutions, those skilled in the art can understand that, in actual operation, the technical concept involved in the present invention can be applied to a variety of implementations. The present invention uses the following carrier as an exemplary illustration: (1) An electronic device. The device may specifically include: one or more processors, a memory, and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions, and when the instructions are executed by the device, the device executes the steps / functions of the aforementioned embodiment or equivalent implementation. The electronic device may specifically be an electronic device related to a computer, such as but not limited to various types of interactive terminals and electronic products, such as a specific vehicle-mounted intelligent terminal, a mobile terminal, etc.

[0060] like Figure 3 As shown, an electronic device is provided in an embodiment of the present invention. Specifically, the electronic device includes a processor 41 and a memory 42. The processor 41 and the memory 42 can communicate with each other through an internal connection path to transmit control and / or data signals. The memory 42 is used to store computer programs, and the processor 41 is used to call and run the computer program from the memory 42. The processor 41 and the memory 42 can be combined into a processing device, or more commonly, they are independent components. The processor 41 is used to execute the program code stored in the memory 42 to implement the above functions. In specific implementation, the memory 42 can also be integrated in the processor 41, or independent of the processor 41.

[0061] The processor 41 in the electronic device may be a system on chip SOC, which may include a central processing unit (hereinafter referred to as CPU), and may further include other types of processors, such as a graphics processing unit (hereinafter referred to as GPU), etc. In short, the various processors or processing units inside the processor 41 may work together to implement the method steps / functions of the aforementioned embodiments or equivalent implementations.

[0062] (2) A computer data storage medium on which a computer program or the above-mentioned device is stored, which, when the computer program or the above-mentioned device is executed, enables the computer to execute the method steps / functions of the above-mentioned embodiment or equivalent implementation method.

[0063] In several embodiments provided by the present invention, any function, if implemented in the form of a software functional unit and sold or used as an independent product, can be stored in a computer data storage medium. Based on such an understanding, some technical solutions of the present invention are essentially or part of the technical solution that contributes to the prior art or part of the technical solution can be embodied in the form of the software product described below.

[0064] It should be particularly pointed out that the storage medium may refer to a server or a similar computer device, specifically, a storage device in a server or a similar computer device storing the aforementioned computer program or the aforementioned apparatus.

[0065] Implementing the embodiments of the present invention has the following beneficial effects: 1. Compared with the traditional shapelet generation method, the present invention introduces a method for generating candidates with time features, selects some intuitive time series subsequences as time features, and generates candidate shapelets by selecting key points in the time series, which can significantly reduce the number of candidate subsequences, reduce the computational complexity, and improve the interpretability of the model; 2. Compared with the traditional method that relies on brute force search and information gain, the present invention adopts the particle swarm optimization algorithm to select the optimal time domain features from the shapele candidate set containing important perception points (i.e., points with the largest fitting error) through collaborative search of the group, which not only improves the shapele feature evaluation standard, but also further reduces the computational complexity; 3. The present invention combines the optimal time domain features with the frequency domain features for classification, thereby enhancing the diversity of feature expression.

[0066] A person skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, such as ROM / RAM, disk, CD-ROM, etc.

[0067] The above disclosure is only a preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.

Claims

1. A time series data classification method based on shapelet and pso feature selection, It is characterized in that The method comprises the following steps: S1. Get the original time series and initialize the number of segments to , the shaplet candidate set is empty, the subsequence set is empty, and the subsequence length range is [ ]; S2, according to the number of divisions , the original time series is segmented to obtain subsequences, and the resulting subsequences are added to the subsequence set; S3: Determine whether the current number of subsequences in the shaplet candidate set is less than the number of segmentations. ; If yes, go to step S4; if no, go to step S7; S4. According to the formula and Calculate the sum of the fitting errors of all subsequences in the subsequence set , and further select the current fitting error and maximal subsequence; each subsequence is defined as M ; and are the subsequences in the subsequence set respectively M The starting point code and the end point code; is a subsequence in the subsequence set M The total number of all calculation points in ; Hehe are the subsequences in the subsequence set respectively M The starting and ending values ​​of The subsequence in the subsequence set M Middle The value of the calculation point; S5, in the currently selected fitting error and The largest subsequence determines the fitting error The maximum point and the fitting error determined The largest point is taken as the center, and the currently selected fitting error and The largest subsequence is split into left and right, and two subsequences are obtained, both with fitting errors. The split sequence of the largest point, and further, from the two split sequences obtained, the split sequence whose length is within the subsequence length range is added to the shaplet candidate set; S6. Delete the currently selected fitting error and The largest subsequence is updated and the process returns to step S3; S7. Output the final shapelet candidate set.

2. The time series data classification method based on shapelet and pso feature selection as claimed in claim 1, It is characterized in that The method further comprises: The minimum distance between each subsequence in the output final shapelet candidate set and the original time series is taken as a candidate feature to form a feature combination, and a particle swarm optimization algorithm is used to find an optimal solution for the feature combination, and further according to the optimal solution, a corresponding subsequence is selected from the output final shapelet candidate set as the optimal feature output; wherein, in the particle swarm optimization algorithm, the fitness function used is constructed based on the classification accuracy and the number of feature selections.

3. The time series data classification method based on shapelet and pso feature selection as claimed in claim 2, It is characterized in that By formula , calculate the minimum distance between each subsequence in the final shapelet candidate set and the original time series ;in, is the original time series; The original time series Length, for Length; The original time series A starting index of , the length is subsequence; It represents the original time series subsequence The distance between.

4. The time series data classification method based on shapelet and pso feature selection as claimed in claim 3, It is characterized in that The expression of the feature combination is .

5. The time series data classification method based on shapelet and pso feature selection as claimed in claim 4, It is characterized in that The specific steps of using the particle swarm optimization algorithm to find the optimal solution for the feature combination, and further selecting the corresponding subsequence as the optimal feature output from the output final shapelet candidate set according to the optimal solution include: Step b1: Set the basic parameters of the particle swarm optimization algorithm, including population size, maximum number of iterations, maximum and minimum particle speeds, and individual optimal position weights. , global optimal position weight , and inertia weight ; Step b2: Randomly initialize the position and velocity of the particle in the feature space; wherein the position of each particle represents a feature subset, and each dimension of the position corresponds to the selection state of a feature; if the selection state value is 0, it means that it is not selected; conversely, if the selection state value is 1, it means that it is selected; Step b3: Use the number of feature selection and classification accuracy to construct the fitness function of the particle swarm optimization algorithm: , and use the fitness function to calculate the initial fitness value of each particle, and further use the current position and fitness value of each particle as the initial individual optimal position and optimal fitness value of the particle; where, is the classification accuracy; is the total number of features, which is the total number of subsequences in the final shapelet candidate set output, and takes a fixed value; Choose the number of features; and An important parameter used to balance the number of feature selection and classification accuracy, both of which take fixed values ​​between (0,1); Step b4: Update the speed of each particle according to the current particle position, speed, individual optimal position and global optimal position; the speed update formula is: ; The position update formula is ; For particles In iteration speed at 1000 s; particle In iteration The position at the time; For particles In iteration speed at 1000 s; particle In iteration The position at the time; For particles The individual optimal position of is the global optimal position; and are two random numbers between [0,1] respectively; Step b5: Use the feature subset selected by the current particle as input features to train the full convolutional neural network classification model, and record the classification accuracy of each particle after training; Step b6: Use the classification accuracy as the return value of the fitness function, calculate the fitness value in combination with the number of feature selections, and update the individual optimal position and the global optimal position; Step b7: When the maximum number of iterations is reached or the fitness value reaches the preset threshold, the search process is terminated, and the feature subset corresponding to the global optimal particle is finally selected as the final feature selection result output; Step b8: According to the final feature selection result, select the corresponding subsequence from the output final shapelet candidate set as the optimal time domain feature output.

6. The time series data classification method based on shapelet and pso feature selection as claimed in claim 5, It is characterized in that The method further comprises: The original time series is converted into frequency domain data, and the frequency domain data is fused with the output optimal time domain features by feature splicing, and the fused features are further used to construct a fully convolutional neural network (FCN) classification model; wherein the fully convolutional neural network (FCN) classification model consists of 3 one-dimensional convolutional layers plus a normalization layer and a ReLU activation layer, and the convolution kernel sizes of its convolutional layers are set to 8, 5, and 3, respectively, and the filter sizes are set to 128, 256, and 128, respectively.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the time series data classification method based on shapelet and pso feature selection is implemented as described in any one of claims 1 to 6.

8. A storage medium storing computer executable instructions, It is characterized in that When the computer executable instructions are executed by a computer processor, they are used to perform the time series data classification method based on shapelet and pso feature selection as described in any one of claims 1 to 6.