Shapelet-based interpretable time series classification method and system for large language models
By combining an adaptive sliding window mechanism and a large language model (LLM), shape features are evaluated and filtered, which solves the problem of insufficient capture of multi-scale patterns and semantic information in time series classification, and achieves high-performance and interpretable time series classification.
Patent Information
- Application Number
- CN202511077505.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-01
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2045-08-01
AI Technical Summary
Existing technologies ignore the inherent characteristics of data in time series classification, making it difficult to effectively capture multi-scale time series patterns and sparse but crucial semantic information. Furthermore, large language models (LLMs) suffer from performance limitations in understanding the semantic gap between numerical sequences and textual modalities.
An adaptive sliding window mechanism is used to obtain candidate shape feature subsequences. Combined with a large language model (LLM), semantic relevance, perturbation stability and interpretability are evaluated. A multi-dimensional evaluation mechanism is constructed to screen shape features and enhance feature representation and interpretability.
It improves the performance and interpretability of time series classification, effectively learns and utilizes multi-scale temporal patterns and sparse semantic information in time series data, and enhances the accuracy and interpretability of classification results.
Smart Images

Figure CN120561664B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the field of artificial intelligence, and particularly relates to a large language model explainable time series classification method and system based on shapelets. BACKGROUND
[0002] Time series classification aims to provide automated decision support for numerous industrial scenarios by analyzing data with temporal dependencies to identify potential patterns and class assignments. Traditional time series classification methods rely on complex feature engineering and large amounts of data, relying on manually designed features and similarity measures, which have problems such as complex feature engineering and non-transparent decision logic. While deep learning-based methods can automatically extract complex features, they have defects such as large model parameter quantity, high training cost, and poor explainability. Typical traditional time series classification methods include dynamic time warping-based K-nearest neighbor algorithm (DTW-KNN), random forest based on statistical features (RF), and shapelet transform-based classification framework (Shapelet Transform). Typical deep learning methods include end-to-end models such as ResNet and InceptionTime, and time series processing models based on Transformer architecture (such as Informer and Autoformer).
[0003] In recent years, a time series classification framework based on shapelets has been proposed. Shapelets are local time subsequences extracted from time series, which have strong class discrimination ability. However, traditional shapelet screening methods (such as information gain and F-statistics) have the fundamental defects of semantic fragmentation and knowledge blindness, such as in traffic flow prediction, they may screen out shapelets that are statistically significant but cannot identify the corresponding semantic scenarios, or in the medical field, they may ignore shapelets that meet the pathological characteristics defined in medical science but lack statistical significance. Existing technical solutions are:
[0004] 1. LLM-TS integrator:
[0005] 1) Align the representation by maximizing the mutual information between the traditional model and the LLM.
[0006] 2) Directly input the original time series data into the LLM for zero-shot classification.
[0007] The core problems are:
[0008] 1) The semantic gap between numerical sequences and text modalities makes it difficult for LLMs to effectively understand time series patterns.
[0009] 2) The quadratic complexity of model parameter quantity and sequence length limits the ability to process long sequences.
[0010] 3) Failed to break the stereotype of "LLM as a classifier", ignoring its value in feature semantic enhancement.
[0011] 2、Traditional shape feature method:
[0012] 1) Enumerate shape elements through sliding window and filter them by information gain.
[0013] 2) Construct feature vector based on shape element distance for classification.
[0014] Fundamental defects:
[0015] 1) Semantic fragmentation: statistically significant shape elements cannot correspond to domain knowledge (such as ECG pathological features).
[0016] 2) Knowledge blindness: ignoring shape elements that meet medical definitions but lack statistical significance.
[0017] 3) Single screening dimension: relying only on statistical indicators such as information gain.
[0018] In summary, the main shortcomings of existing technical solutions are as follows:
[0019] 1. Ignoring the inherent characteristics of time series: existing methods based on large language models (LLM) usually perform sub-optimally because they ignore the inherent characteristics of time series data. Time series data is semantically sparse and contains unique temporal patterns (such as short-term fluctuations and long-term trends). Most methods align text and time series data, ignoring these fundamental characteristics, resulting in limited performance.
[0020] 2. Inadequate capture of temporal patterns: time series data exhibits various temporal patterns, and existing methods of directly fine-tuning LLMs may not effectively capture these complex, multi-scale temporal patterns.
[0021] 3. Insufficient extraction of time series semantics: the semantic information in time series data is sparse, and directly applying pre-trained LLMs on text cannot accurately interpret the specific semantics contained in time series data.
[0022] Therefore, how to enhance the performance of LLM in time series classification tasks so that it can effectively learn and utilize the inherent multi-scale temporal patterns and sparse but crucial semantic information in time series data becomes a pressing problem. SUMMARY
[0023] To solve the above technical problems, the present application provides a large language model explainable time series classification method based on shape elements, comprising the following steps:
[0024] Step S1: load pre-trained LLM weights, configure parameters of each subsystem; load time series from data source, normalize and fill missing values for preprocessing;
[0025] Step S2: input the preprocessed time series into the candidate shape feature generation module, use the adaptive sliding window mechanism to obtain the candidate shape feature subsequence, and filter the candidate shape feature subsequence by calculating the composite distance and formulating the screening strategy to obtain the candidate shape element set ;
[0026] Step S3: input the candidate shape element set into the text-guided shape feature evaluation module, evaluate each candidate shape element using LLM in three dimensions of semantic relevance, perturbation stability and explainability to obtain its quality score and explanation text, filter the candidate shape elements with quality scores below the threshold to obtain the final shape element set ;
[0027] Step S4: input the After representation learning, the feature vector is input into the classifier model to output the prediction result of the corresponding label.
[0028] Advantages:
[0029] 1. The Shapelet-LLM collaborative framework is proposed, which innovatively combines shape features with LLM, uses the semantic understanding and knowledge reasoning ability of LLM to evaluate and screen shape features, and provides high-quality feature representation for time series classification.
[0030] 2. The multi-dimensional evaluation mechanism is constructed, which evaluates shape features from three dimensions of semantic relevance, discriminability and explainability, ensuring that the screened shape features not only have good classification performance, but also have clear physical meaning and explainability.
[0031] 3. The text-guided feature is enhanced by constructing a structured text input to guide LLM to conduct in-depth analysis and explanation of shape features, providing rich text explanation for classification results and enhancing the explainability of the model. BRIEF DESCRIPTION OF DRAWINGS
[0032] Figure 1 It is a large language model explainable time series classification method based on shape element flow diagram of the application;
[0033] Figure 2 It is a structure block diagram of a large language model explainable time series classification system based on shape element of the application. DETAILED DESCRIPTION
[0034] In order to make the objects, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not to limit the present application. In addition, the technical features involved in the various embodiments of the present application described below can be combined with each other as long as they do not conflict with each other.
[0035] Table 1 is the Chinese and English expression of the terms used in the present application
[0036]
[0037] Example one
[0038] As Figure 1 shown, the large language model explainability time series classification method based on shape meta provided by the embodiment of the present application comprises the following steps:
[0039] Step S1: load the pre-trained LLM weight, configure the parameters of each subsystem; load the time series from the data source, and perform normalization and missing value filling preprocessing on the time series;
[0040] Step S2: input the preprocessed time series into the candidate shape feature generation module, use the adaptive sliding window mechanism to obtain the candidate shape feature subsequence, and filter the candidate shape feature subsequence by calculating the composite distance and formulating the screening strategy, to obtain the candidate shape meta set .
[0041] Step S3: input the candidate shape meta set into the text-guided shape feature evaluation module, use the LLM to evaluate each candidate shape meta in three dimensions of semantic relevance, perturbation stability and explainability, obtain its quality score and explanation text, filter the candidate shape meta with a quality score lower than the threshold, and obtain the final shape meta set .
[0042] Step S4: input the as shape meta-based time series representation learning, obtain the feature vector input into the classifier model, and output the prediction result of the corresponding label.
[0043] In one embodiment, the above step S1: load the pre-trained LLM weight, configure the parameters of each subsystem; load the time series from the data source, and perform preprocessing on the time series, specifically including:
[0044] Load the pre-trained LLM weight, configure the parameters of each subsystem, such as the window size of candidate shape feature generation, the number of shape features, the prompt template of LLM, etc.
[0045] The time series is preprocessed by data cleaning, normalization and missing value filling to obtain a training set.
[0046] In one embodiment, the step S2 of inputting the preprocessed time series into the candidate shape feature generation module, using an adaptive sliding window mechanism to obtain a candidate shape feature subsequence, and screening the candidate shape feature subsequence by calculating a composite distance and formulating a screening strategy to obtain a candidate shape element set comprises:
[0047] Step S21: using an adaptive sliding window mechanism to obtain a candidate shape feature subsequence, wherein the adaptive sliding window mechanism specifically comprises:
[0048] Step S211: let the preprocessed time series be , wherein is the length of the time series, is the number of channels, the label of is ; let the subsequence be , wherein is the starting position, is the length;
[0049] Step S212: calculate the Euclidean distance , and count the number of pairs of subsequences matching the preset tolerance threshold r:
[0050] ;
[0051] ;
[0052] wherein represents the standard deviation; count the number of subsequences matching the preset tolerance threshold r;
[0053] calculate the sample entropy of to measure the complexity of the sequence:
[0054] ;
[0055] Step S213: calculate the frequency energy distribution standard deviation of as the Fourier energy difference to measure the stability of the sequence periodic pattern:
[0056] ;
[0057] ;
[0058] wherein, , is the frequency component index; represents the time domain sampling point; is the effective frequency component number extracted by the main frequency band;
[0059] Step S214: according to the sample entropy and the Fourier energy difference, a preset scaling factor , the length of the adaptive sliding window can be calculated:
[0060] ;
[0061] In the embodiment of the present application , the subsequence of the time sequence extracted according to the adaptive sliding window is taken as a candidate shape feature subsequence.
[0062] The adaptive sliding window mechanism designed in the present application comprehensively judges the complexity and stability of the time sequence, solves the single dimension problem of the traditional Shapelet screening, and realizes the adaptive matching of the window size and the sequence complexity. In the embodiment of the present application, the subsequence extracted by the sliding window with a step is taken as a candidate shape feature subsequence.
[0063] For the screening of the candidate subsequence, the distance between the subsequence and the original sequence needs to be evaluated, and then the existing subsequence is screened according to the distance to form a feature Shapelet for measuring the category of the time sequence. The traditional measurement methods such as complexity invariant distance (CID) and shape dynamic time warping (ShapeDTW) have the problem of being too single, and the single distance statistics of the subsequence is difficult to reflect the adaptation degree of the subsequence. This is contradictory to the cross-domain highly complex characteristics of the time sequence. Therefore, the present application calculates the distance between the subsequence and the original sequence by using the following composite distance.
[0064] Step S22: calculate the composite distance between the sub-time sequence and the original time sequence, specifically including:
[0065] Step S221: calculate the complexity invariant distance , which is used to measure the similarity of two sequences , of the same channel regardless of the amplitude difference of the sequences:
[0066] ;
[0067] ;
[0068] wherein, represents the complexity estimate of the sequence ; is the dynamic time warping distance;
[0069] Step S222: calculate the shape dynamic time warping distance, which is used to measure the similarity between the shape change feature of the sub-sequence and the original sequence:
[0070] ;
[0071] wherein, is the local gradient feature; is the full set of dynamic warping paths in the DTW method, o represents the starting point of the path π, and d represents the end point of the path π;
[0072] Step S223: obtain the composite distance between the sub-sequence and the original sequence by weightedly blending the above two distances:
[0073] ;
[0074] wherein, the preset weight coefficients (0.7, 0.3) in the above formula can be optimized by the UCR grid search method of the time series data set.
[0075] The composite distance designed in the present application, that is, by ensures the overall trend, and by auxiliary enhancement of local shape sensitivity.
[0076] Step S23: formulate a screening strategy, specifically including the following steps:
[0077] Step S231: calculate the information gain IG of the candidate sub-sequence for the class label, which is used to measure the significance of the shape element for enhancing the classification sensitivity:
[0078] ;
[0079] wherein, is the information entropy, is the distance threshold value; is the class label vector;
[0080] Step S232: calculate the F-statistic, which is used to measure the difference between classes:
[0081] ;
[0082] wherein, SSB is the between-class sum of squares, SSW is the within-class sum of squares, K is the number of classes, and N is the total number of samples;
[0083] Step S233: calculate the variance contribution rate, which is used to evaluate the representation ability of the shape element in the feature space:
[0084] ;
[0085] wherein Var is variance;
[0086] Step S234: According to the statistical significance requirement of , the screening strategy is formulated as:
[0087] ;
[0088] wherein, is a dynamic threshold value determined by and ; is the mean of the current candidate set information gain; is the standard deviation of the current candidate set information gain;
[0089] After the above steps of screening, the candidate shapelet set is obtained.
[0090] The traditional method completes the representation learning step after obtaining the shapelet set . The general shapelet-based classification idea will calculate the similarity distance between the input sample and each shapelet in , and use it as a component to form a feature vector and send it to the classifier. However, the actual classification effect is not always better than other time series classification methods, and the shapelet itself also has a lot of potential meaning that can be mined. Therefore, the present application uses LLM to further screen and generate interpretable text, improving the performance of the classification method while further mining the meaning of the feature subsequence represented by the shapelet for the time series data set.
[0091] In one embodiment, the above step S3: inputting the candidate shapelet set into the text-guided shape feature evaluation module, evaluating each candidate shapelet using LLM in three dimensions of semantic relevance, perturbation stability and interpretability, obtaining its quality score and explanation text, filtering the candidate shapelets with a quality score below a threshold, and obtaining the final shapelet set , specifically comprising:
[0092] Step S31: Taking the key-value pair encoding of the knowledge base of a specific vertical field , wherein the feature dimension is d and the number of knowledge entries is n; converting each candidate shapelet in the candidate shapelet set into a query vector by linear projection; the semantic relevance score can be obtained from the maximum attention weight, which is used to quantify the matching degree of the shapelet and the domain knowledge:
[0093] ;
[0094] Where d is the feature dimension;
[0095] This invention utilizes knowledge from a vertical domain knowledge base to enhance the perception and judgment of subsequences, and semantic relevance scores quantify the matching degree between shape elements and domain knowledge. For example, in research on electrocardiogram (ECG) data, a medical knowledge base is introduced into the shape element set to calculate the relevance between shape elements and the case features presented by specific ECGs.
[0096] Step S32: Calculate the perturbation stability score to exclude statistically unstable features.
[0097] ;
[0098] ;
[0099] in, This indicates that the injected disturbance noise follows a normal distribution.
[0100] For cases requiring statistical robustness verification, this invention can inject noise into the original sequence to generate a perturbation sequence and recalculate the information gain fluctuation to further eliminate statistically unstable features.
[0101] Step S33: Obtain interpretability results through a dual-channel generator, and then use LLM to determine the semantic relevance based on the interpretability results. Disturbance stability Based on the scores, output the final interpretability score. That is, the numerical sequence of shape elements is directly used as text, and the visual image of the shape elements is encoded by the CLIP model; the two are concatenated and input into LLM to obtain the multimodal interpretability result of LLM.
[0102] The interpretability results of this invention are achieved through a dual-channel generator: (the visual image of the shape element is input to) the visual channel outputs a superimposed comparison image of the shape element and the typical sequence pattern in the vertical domain, and (the numerical text of the shape element is input to) the text channel generates a natural language interpretation such as "The ST segment elevation of 0.2mV lasting for 4 seconds meets the AHA diagnostic criteria for myocardial ischemia v2023".
[0103] Step S34: Calculate the evaluation decision score, filter out candidate shape elements whose scores are lower than the screening threshold, and obtain the final shape element set. Filtering threshold Obtained by harmonizing semantic relevance score, perturbation stability score, and interpretability score:
[0104] .
[0105] Experiments show that for the data sets involved in the experiment, after screening by the large language model, the number of shape elements is reduced (i.e. the dimension of the feature vector is reduced) but the final classification performance is improved. This further proves the great potential of large language models in enhancing representation learning methods and the rationality of the present application.
[0106] In one embodiment, the above step S4: obtaining As a shape element-based time series representation learning, a feature vector is input into a classifier model, and a prediction result corresponding to a label is output, specifically including:
[0107] The shape element set completes the classification task as a time series representation learning method: according to the input time series data The distance between each shape element The distances are concatenated as the feature vector of the time series, and any classification model such as a support vector machine or a random forest is input to complete the classification task.
[0108] Table 2 is a comparison of the accuracy of the present application and the prior art on the multivariate time series classification task data set. The selected data set spans multiple fields and has strong differences: Ethanol (gas concentration detection), HandW (gesture recognition), PEMS-SF (traffic flow prediction), SCP1 / SCP2 (medical data detection classification), and UWave (accelerometer action classification). The comparison methods include the traditional machine learning method XGBoost gradient boosting tree, the deep learning method model TCN (time convolution network), Flowformer (time series feature flow transformer), TimesNet (multi-period time series modeling network), and LLM-TS (large language model adapted time series classification framework). The present application method not only achieves the highest accuracy on all data sets, but also has strong robustness to various time series patterns compared to other methods, overcoming the classification limitations of existing methods in complex scenarios such as high noise and long cycle dependence.
[0109] Table 2 Comparison of time series classification task effects
[0110]
[0111] Embodiment Two
[0112] As Figure 2 shown, the embodiment of the present application provides a large language model explainable time series classification system based on shape elements, including the following modules:
[0113] The initialization and preprocessing module 51 is configured to load pre-trained LLM weights, configure parameters of each subsystem, load time series from a data source, and preprocess the time series.
[0114] The candidate shape feature generation module 52 is configured to input the preprocessed time series into the candidate shape feature generation module, obtain a candidate shape feature subsequence using an adaptive sliding window mechanism, and filter the candidate shape feature subsequence by calculating a composite distance and formulating a filtering strategy to obtain a candidate shape element set. ;
[0115] The text-guided shape feature evaluation module 53 is configured to input the candidate shape element set into the text-guided shape feature evaluation module, evaluate each candidate shape element in terms of semantic relevance, perturbation stability, and interpretability using an LLM to obtain a quality score and an explanation text, filter candidate shape elements with a quality score below a threshold, and obtain a final shape element set. ;
[0116] The classification module 54 is configured to input the as a shape element-based time series representation learning, input a feature vector into a classifier model, and output a prediction result corresponding to a label.
[0117] A shape element-based large language model explainable time series classification device, comprising one or more electronic devices, wherein the one or more electronic devices are configured to implement a shape element-based large language model explainable time series classification method.
[0118] An electronic device comprising: one or more processors; a memory configured to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement a shape element-based large language model explainable time series classification method.
[0119] A computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to implement a shape element-based large language model explainable time series classification method.
[0120] A non-transitory computer-readable storage medium having stored thereon a computer program that, when executed by a processor, implements a shape element-based large language model explainable time series classification method.
[0121] The foregoing is considered as illustrative only of the principles of the application. Numerous modifications and changes will readily occur to those skilled in the art, and the generic principles defined herein can be applied to other embodiments without departing from the spirit or scope of the application. Therefore, the application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A large language model explainability time series classification method based on shape meta, characterized in that, Comprising: Step S1: loading pre-trained LLM weights, presetting the hyperparameters of the candidate shape feature generation module, the text-guided shape feature evaluation module, and the classifier module; Load time series from data source, normalize and fill in missing values for preprocessing; Step S2: input the preprocessed time series into a candidate shape feature generation module, obtain a candidate shape feature subsequence by using an adaptive sliding window mechanism, and screen the candidate shape feature subsequence by calculating a composite distance and formulating a screening strategy to obtain a candidate shape element set ; Wherein, the candidate shape feature subsequence is obtained by using an adaptive sliding window mechanism, specifically including: Step S211: let the pre-processed time series be wherein, is the length of the time series, is the number of channels, is the label vector of ; let the sub-sequence be wherein is the start position, is the length; Step S212: Calculate the Euclidean distance , statistics Number of sub-sequence pairs matching the preset tolerance threshold r: ; ; wherein, denotes the standard deviation; Statistics of sub-sequences Number of sub-sequences matching under a pre-set tolerance threshold r of sub-sequences The sample entropy of the sequence is calculated as follows: to measure the complexity of the sequence: ; Step S213: Calculate the standard deviation of the frequency energy distribution of the sequence as a Fourier energy difference to measure the stability of the sequence periodic pattern: ; ; wherein , is a frequency component index; denotes a time domain sample point; is the number of valid frequency components extracted for the primary band; Step S214: preset scaling factor is calculated according to the sample entropy and the Fourier energy difference , the length of the adaptive sliding window is calculated : ; a time series extracted according to the adaptive sliding window subsequences as candidate shape feature subsequences; Wherein, the composite distance is calculated, specifically including the following steps: Step S221: Calculate the complexity-invariant distance , for measuring two sequences of different lengths but same channel , Similarity in neglecting sequence amplitude difference: ; ; wherein represents a complexity measure of the sequence is a dynamic time warping distance; Step S222: Calculate the morphological dynamic time warping distance for measuring the similarity of the morphological change feature of the sub-sequence to the original sequence ; wherein, is a local gradient feature; is a dynamic warping method, o represents the starting point of the path π, and d represents the end point of the path π. Step S223: obtain the composite distance between the subsequence and the original sequence by weighted reconciliation of the above two distances: ; Step S3: input the candidate shape element set into a text-guided shape feature evaluation module, evaluate each candidate shape element in three dimensions of semantic relevance, perturbation stability and interpretability using LLM, obtain its quality score and interpretation text, filter out candidate shape elements with quality scores below a threshold, and obtain a final shape element set ; Step S4: obtaining the feature vector inputting the classifier model, and outputting a prediction result corresponding to the label. As a shapelet-based time series representation learning, a feature vector is obtained to input a classifier model, and a prediction result corresponding to a label is output.
2. The shapelet-based large language model explainability time series classification method according to claim 1, characterized in that, The filtering strategy of step S2, specifically including: Step S231: Calculate candidate sub-sequences For the information gain IG of the class label, which is used to measure the significance of the shapelet in enhancing the sensitivity of classification: ; wherein, is the information entropy, is the distance threshold; is the class label vector; Step S232: calculate the F-statistic to measure the difference between classes; ; Wherein, SSB is the between-class sum of squares, SSW is the within-class sum of squares, K is the number of classes, and N is the total number of samples; Step S233: calculate the variance contribution rate to evaluate the representation ability of the shape in the feature space: ; Wherein, Var is the variance; Step S234: according to the statistical significance requirement, make a screening strategy as follows: ; wherein, is a dynamic threshold determined by and ; is the mean of the current candidate set information gain; is the standard deviation of the current candidate set information gain; After the above steps of screening, a candidate shape element set is obtained .
3. The shapelet-based large language model explainability time series classification method according to claim 2, characterized in that, The step S3: inputting the candidate shape element set into a text-guided shape feature evaluation module, evaluating the semantic correlation, perturbation stability and explainability of each candidate shape element by using the LLM to obtain a quality score and an explanation text of the candidate shape element, filtering the candidate shape elements with a quality score lower than a threshold, and obtaining a final shape element set , and specifically comprises: Step S31: Taking the key-value pair encoding of the knowledge base of the preset vertical field , where the feature dimension is d, and the number of knowledge entries is n; converting each candidate shape element in the candidate shape element set into a query vector through linear projection ; obtaining a semantic relevance score from the maximum attention weight, which is used to quantify the matching degree of the shape element and the domain knowledge: ; Wherein, d is the feature dimension; Step S32: calculate the perturbation stability score to exclude statistically unstable features: ; ; wherein represents the injected disturbance noise, which is normally distributed; Step S33: Obtain the explainability result by the multi-modal large model generator, and then the LLM outputs the final explainability score based on the explainability result and the semantic correlation , the score of the perturbation stability ; that is, the numerical sequence form of the shape element is directly taken as text, and the visual image of the shape element is encoded by the CLIP model; after splicing, the LLM is input to obtain the multi-modal explainability result of the LLM; Step S34: Calculate the evaluation decision score, filter the candidate shape elements with scores lower than the screening threshold, and obtain the final shape element set screening threshold obtained by harmonizing the semantic correlation score, the perturbation stability score, and the interpretability score: 。 4. A shapelet-based large language model explainability time series classification system, comprising: Comprising the following modules: Initialization and preprocessing module, for loading pre-trained LLM weights, presetting the hyperparameters of the candidate shape feature generation module, the text-guided shape feature evaluation module, and the classifier module; Load time series from data source, normalize and fill in missing values for preprocessing; The candidate shape feature generation module is configured to input the preprocessed time sequence into the candidate shape feature generation module, acquire a candidate shape feature subsequence by using an adaptive sliding window mechanism, and screen the candidate shape feature subsequence by calculating a composite distance and formulating a screening strategy to obtain a candidate shape element set ; Wherein, the candidate shape feature subsequence is obtained by using an adaptive sliding window mechanism, specifically including: Step S211: let the pre-processed time series be wherein, is the length of the time series, is the number of channels, is the label vector of the time series, let the sub-sequence be wherein is the start position, is the length. Step S212: Calculate the Euclidean distance , statistics Number of sub-sequence pairs matching the preset tolerance threshold r: ; ; wherein, denotes the standard deviation; statistics of sub-sequences sub-sequences matched at a pre-set tolerance threshold r the number of The sample entropy of the sequence is calculated as follows: H = -log2(P) ; Step S213: Calculate the standard deviation of the frequency energy distribution of the sequence as a Fourier energy difference to measure the stability of the sequence periodic pattern: ; ; wherein , is a frequency component index; denotes a time domain sample point; is the number of valid frequency components extracted for the primary band; Step S214: preset scaling factor according to sample entropy and Fourier energy difference , calculate the length of adaptive sliding window : ; a time series extracted according to the adaptive sliding window subsequences as candidate shape feature subsequences; Wherein, the composite distance is calculated, specifically including the following steps: Step S221: Calculate the complexity-invariant distance , for measuring two sequences of different lengths but same channel , Similarity in neglecting sequence amplitude difference: ; ; wherein represents a sequence of complexity estimates; is a dynamic time warping distance; Step S222: Calculate the morphological dynamic time warping distance for measuring the similarity of the morphological change feature of the sub-sequence to the original sequence ; wherein, is a local gradient feature; is a dynamic warping method, o represents the starting point of the path π, and d represents the end point of the path π. Step S223: obtain the composite distance between the subsequence and the original sequence by weighted reconciliation of the above two distances: ; The text-guided shape feature evaluation module is configured to input the candidate shape element set into the text-guided shape feature evaluation module, evaluate each candidate shape element in three dimensions of semantic correlation, perturbation stability and interpretability by using the LLM, obtain a quality score and an interpretation text of the candidate shape element, filter the candidate shape elements with a quality score lower than a threshold, and obtain a final shape element set ; A classification module is configured to classify As a shapelet-based time series representation learning, the feature vector is input into a classifier model, and a prediction result corresponding to a label is output.
5. A shapelet-based large language model explainability time series classification apparatus, characterized in that, One or more electronic devices, wherein the one or more electronic devices are configured to implement the method of any one of claims 1-3.
6. An electronic device, comprising: Comprising: One or more processors; Memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any one of claims 1-3.
7. A computer-readable storage medium, characterized in that, Executable instructions are stored thereon, which are executed by a processor to make the processor implement the method of any one of claims 1-3.
8. A non-transitory computer-readable storage medium, comprising: A computer program is stored thereon, which is executed by a processor to implement the method of any one of claims 1-3.
Citation Information
Patent Citations
Time series data classification method and device, terminal equipment and storage medium
CN113836240A
Fault diagnosis and suggestion method based on interpretable artificial intelligence and large model
CN120338140A