Characterization learning method and device based on time sequence period and trend characteristic recovery

By determining period intervals in the frequency domain and constructing contrast and cross-entropy losses, the period and trend characteristics of long-term sequences are restored, solving the problem of segmentation processing destroying the properties of long-term sequences, significantly improving the representation learning effect, and being suitable for a variety of time-series data fields .

CN118690802APending Publication Date: 2024-09-24ZHEJIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410778066.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-17
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

When existing contrastive learning methods process long-term sequence data, segmentation processing causes the long-term nature to be destroyed, and long-term features are ignored, resulting in poor representation results.

Method used

By determining the period interval in the frequency domain, dividing equal-length samples, and constructing contrastive loss and cross-entropy loss, the periodic and trend characteristics of the long-term sequence are restored, and the encoder is optimized by combining existing contrastive learning methods.

Benefits of technology

It significantly improves the representation learning effect of long-term sequence data, is suitable for medical, meteorological and other fields, and improves the accuracy of data representation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118690802A
    Figure CN118690802A
Patent Text Reader

Abstract

The invention discloses a representation learning method and device based on time sequence period and trend characteristic recovery, and the method comprises the steps: specifically determining a period interval according to the distribution of a plurality of long-time sequence records in a frequency domain, determining the length of a sample according to the period interval, and dividing each long-time sequence record into a plurality of equal-length samples according to the length of the sample; constructing a corresponding positive and negative sample set for a single sample in each long-time sequence record, and mining periodic characteristics of the long-time sequence records by constructing comparison loss based on the positive and negative sample sets; performing relative position prediction on different samples belonging to the same long-time sequence record, and learning trend characteristics of the long-time sequence record by constructing cross entropy loss; the two constructed losses are added to the existing comparative learning to optimize the encoder to realize the representation learning of the long-time sequence record, so that the representation representation of the corresponding long-time sequence record in the fields of medical treatment, meteorology and the like can be promoted by the existing comparative learning method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of time series data characterization, and specifically relates to a characterization learning method and device based on time series period and trend characteristic recovery. Background Art

[0002] Time series data is very common in human daily production and life, such as data collected by IoT sensors, data collected by medical treatment, climate data, etc. With the popularization of various collection devices (such as wearable devices, industrial sensors, etc.), time series data has become a very important and common data resource. How to use time series data more effectively has also become an important research topic. However, a large amount of time series data requires a lot of manpower and experience to be labeled, so self-supervised learning is applied to the field of time series. Contrastive learning is a self-supervised learning method that uses enhancement technology to obtain similar samples, flexibly defines positive and negative sample pairs, and shows increasingly powerful time series representation capabilities. By using loss functions such as NCE and InfoNCE, contrastive learning can narrow the distance between positive and negative samples in the representation space.

[0003] Most time series have the characteristic of a large number of sampling points. When contrastive learning is used to process time series, segmentation becomes a common technique, which can split the time series records into shorter samples. For example, ECG and EEG time series in the medical field can be segmented into shorter samples, and data in speech, images, text and other fields can also be segmented. Segmenting long time series usually helps the training process of contrastive learning. First, contrastive learning can obtain more training samples, which is beneficial for datasets with limited data. Second, segmentation makes intra-record comparison possible, thereby improving the effect of representation learning. Third, setting short samples as contrast units can save a lot of GPU memory consumption.

[0004] Although the strategy of segmenting time series data has advantages in contrastive learning, the long features of the original data may be destroyed by segmentation. For example, the long periodicity and long trend of the original time series disappear after the record is segmented into many short samples. However, most of the existing contrastive learning methods ignore this information loss. Existing contrastive learning methods often use various consistency definitions to obtain a good representation space, such as contextual consistency, time-frequency consistency, sample enhancement consistency, time-domain neighbor consistency, combination of consistency at different levels, etc. Among the above strategies, only the time-domain neighbor consistency and the combination of consistency at different levels focus on mining the sample relationship in the same record, while other methods only study the relationship between all samples or within the sample. In addition, the proximity consistency is committed to the study of local similarity, while the combination of consistency at different levels directly makes the samples in a single record become positive pairs. Both methods ignore the long-term characteristics of the record.

[0005] Therefore, in view of the problem that the existing time series contrastive learning algorithm destroys the long-term properties of time series data, there is an urgent need for a method to restore the long-term properties of time series data after segmentation to achieve better characterization effects. Summary of the invention

[0006] In view of the above, the purpose of the present invention is to provide a representation learning method and device based on the recovery of time series periodicity and trend characteristics, which utilizes the recovery of periodicity and trend in long time series to realize a pluggable enhancement component, which can help existing comparative learning methods improve the representation performance on corresponding long time series records in the fields of medicine, meteorology, transportation, etc.

[0007] To achieve the above-mentioned purpose of the invention, an embodiment provides a representation learning method based on time series cycle and trend characteristic recovery, comprising the following steps:

[0008] The period interval is determined based on the distribution of multiple long time series records in the frequency domain, and the sample length is determined based on the period interval, and each long time series record is divided into multiple samples of equal length according to the sample length;

[0009] For each single sample in each long time series record, a corresponding positive and negative sample set is constructed, and based on the positive and negative sample sets, a contrast loss is constructed to mine the periodic characteristics of the long time series record. Among them, samples that belong to the same long time series record as the single sample and are separated from the starting time point by an integer multiple of the period interval are taken as positive samples, and the rest of the samples are taken as negative samples;

[0010] Predict the relative positions of different samples in the same long time series record, and learn the trend characteristics of the long time series record by constructing the cross entropy loss;

[0011] The constructed contrastive loss and cross entropy loss are appended to the existing contrastive learning to optimize the encoder to achieve representation learning of long time series records.

[0012] Preferably, the period interval is specifically determined based on the distribution of multiple long time series records in the frequency domain, including:

[0013] Convert each long time series record containing M*T sampling points into the frequency domain to obtain a spectrogram, and average the spectrograms of all long time series records to obtain the spectrogram Then, according to the average spectrum The ratio of the amplitude to the frequency selects the appropriate frequency wmax, and the period interval P is determined based on the appropriate frequency wmax and the number of sampling points MT:

[0014]

[0015] Among them, N represents the total number of long time series records, n represents the number index, f represents the feature dimension index in the long time series record, F represents the total number of feature dimensions, Φnf represents the spectrum corresponding to the fth feature dimension in the nth data, Mean The amplitude corresponding to the j-th frequency wj in , argmax(·) finds the maximum frequency.

[0016] Preferably, determining the sample length according to the periodic interval includes:

[0017] The sample length T is Where n is a positive integer and P is the period interval.

[0018] Preferably, the contrast loss constructed based on the positive and negative sample sets It is expressed as:

[0019]

[0020] Among them, Xi∈D represents the i-th sample in the sample set D, Indicates that it belongs to the positive sample set The i-th positive sample in Indicates that it belongs to the negative sample set The i-th negative sample in, E represents the expectation, Zi represents the representation vector of Xi through the encoder, express Through the representation vector of encoder G, express Through the representation vector of encoder G, sim represents the cosine similarity, and the temperature coefficient τ∈(0,+∞) controls the width of the distribution.

[0021] Preferably, a prediction network is added to the output of the encoder to realize the relative position prediction of different samples, and the cross entropy loss is constructed It is expressed as:

[0022]

[0023] Among them, Xi∈D represents the i-th sample in the sample set D, Indicates that it belongs to the positive sample set The i-th positive sample in, E represents the expectation, G(Xi) represents the representation vector of Xi through the encoder G, express Through the representation vector of encoder G, It means that G(Xi) and splicing, Cd(·) represents the representation of the dth dimension of the output representation of the dmax dimension obtained by the concatenated vector after the prediction network, dmax represents the number of time intervals P in a long time series record, Represents Xi and The number of real time intervals P between is an indicator function, when It takes 1 when it is, otherwise it takes 0.

[0024] Preferably, the representation learning method is used for representation learning in the medical field, wherein each long time series record represents time series data of medical-related indicators or parameters, including: ECG time series data, EEG time series data, EMG time series data, HAR time series data, etc.

[0025] Preferably, the representation learning method is used for representation learning in the meteorological field, wherein each long time series record represents time series data of meteorological related indicators or parameters, including: rainfall time series data, various gas concentration time series data, temperature time series data, air humidity time series data, etc.

[0026] Preferably, the representation learning method is used for representation learning in the field of transportation, wherein each long time series record represents time series data of traffic flow related indicators or parameters, including: vehicle flow time series data, pedestrian flow time series data, travel time time series data, etc.

[0027] Preferably, the method further comprises: using the optimized encoder as a feature extractor for a downstream task, and fine-tuning it on a small data set to achieve the downstream task.

[0028] To achieve the above-mentioned purpose of the invention, the embodiment further provides a representation learning device based on time series cycle and trend characteristic recovery, comprising:

[0029] A preprocessing module is used to determine the period interval according to the distribution of multiple long time series records in the frequency domain, determine the sample length according to the period interval, and divide each long time series record into multiple samples of equal length according to the sample length;

[0030] A contrast loss construction module is used to construct the corresponding positive and negative sample sets for each single sample in each long time series record, and to mine the periodic characteristics of the long time series record by constructing contrast loss based on the positive and negative sample sets, wherein the samples that belong to the same long time series record as the single sample and are separated from the starting time point by an integer multiple of the period interval are regarded as positive samples, and the remaining samples are regarded as negative samples;

[0031] A cross entropy loss building module is used to predict the relative positions of different samples in the same long time series record, and to learn the trend characteristics of long time series records by building cross entropy loss;

[0032] The representation learning module is used to append the constructed contrastive loss and cross entropy loss to the existing contrastive learning to optimize the encoder to achieve representation learning of long time series records.

[0033] To achieve the above-mentioned purpose of the invention, an embodiment also provides a computing device, including a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, they are used to implement the above-mentioned representation learning method based on time series cycle and trend characteristic recovery.

[0034] Compared with the prior art, the present invention has the following beneficial effects:

[0035] 1. By adding a recovery method for periodic and trend characteristics based on contrast loss and cross entropy loss to the existing contrastive learning, the characterization learning effect of long time series data can be greatly improved. The results are obvious when tested on public EEG and other types of data sets.

[0036] 2. The representation learning method based on the recovery of time series period and trend characteristics plays an inspiring role in the representation learning of long time series data, and is applicable to various types of time series data in the fields of medicine, meteorology, etc. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] 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, other drawings can be obtained based on these drawings without creative work.

[0038] Figure 1 is an overall flow chart of a representation learning method based on time series cycle and trend characteristic recovery provided by an embodiment;

[0039] Figure 2 This is a graph of GPU consumption and classification effect test results performed on an EEG dataset of Alzheimer's syndrome provided in an embodiment;

[0040] Figure 3 is a comparison result diagram before and after the method of the present invention provided in the embodiment is combined with the existing comparative learning method;

[0041] Figure 4 It is a visualization comparison diagram of the representation space before and after the method of the present invention provided in the embodiment is combined with the existing contrastive learning method;

[0042] Figure 5 It is a structural schematic diagram of representation learning based on time series cycle and trend characteristic recovery provided by an embodiment;

[0043] Figure 6 It is a schematic diagram of the structure of a computing device provided in an embodiment. DETAILED DESCRIPTION

[0044] 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 accompanying drawings and embodiments. It should be understood that the specific implementation methods described herein are only used to explain the present invention and do not limit the scope of protection of the present invention.

[0045] The technical concept of the present invention is: when the existing contrastive learning method is used to characterize long time series data (referred to as time series data) in the fields of medical care, meteorology, etc., the technical problem of poor data characterization due to the destruction of the long time series properties caused by segmented processing will further lead to the accuracy of downstream classification and other tasks. To solve this technical problem, an embodiment of the present invention provides a representation learning scheme based on the recovery of time series period and trend characteristics. While performing segmented processing, it also learns the time series period characteristics and trend characteristics to improve the accuracy of time series data characterization.

[0046] Existing contrastive learning methods and tasks include: Assume that an unlabeled dataset contains N long time series records, where each long time series record Ri contains M*T samples, which are divided into M samples of equal length for training. Each sample Xi contains T sampling points, and each sampling point has F feature dimensions. Pre-train an encoder G as the backbone network in a self-supervised manner. The encoder G can use a sparse convolutional network to extract the features of the original long time series data through convolution. Using the consistency of the data, for a given time series sample Xi∈R T · F , the encoder G learns to represent Zi∈RT · K , where K is the feature dimension in the feature space. The encoder G is then used as a feature extractor for downstream tasks (such as classification tasks) and fine-tuned on small data to complete downstream tasks.

[0047] Based on the above-mentioned comparative learning method and task, the representation learning method based on time series cycle and trend characteristic recovery of the present invention is proposed and explained, as shown in FIG. Figure 1 As shown, the following steps are included:

[0048] S1, determine the period interval according to the distribution of multiple long time series records in the frequency domain, determine the sample length according to the period interval, and divide each long time series record into multiple samples of equal length according to the sample length.

[0049] Each long time series record in the acquired data set is converted into the frequency domain to obtain a spectrogram. Specifically, the spectrogram can be obtained by Fourier transform, and the appropriate period interval P is selected by calculating the spectrogram. Specifically, the spectrograms of all long time series records are averaged. Then, according to the average spectrum The ratio of the amplitude to the frequency selects the appropriate frequency wmax. This selection strategy ensures that the period corresponding to the selected frequency is not too small and that the selected frequency has a large energy. Then the period interval P is determined based on the selected appropriate frequency wmax and the number of sampling points MT:

[0050]

[0051] Among them, N represents the total number of long time series records, n represents the number index, f represents the feature dimension index in the long time series record, F represents the total number of feature dimensions, Φnf represents the spectrum corresponding to the fth feature dimension in the nth data, Mean The amplitude corresponding to the j-th frequency wj in , argmax(·) finds the maximum frequency.

[0052] Since the sample needs to use the selected period interval P for periodicity and trend learning, the appropriate sample length T is determined based on the period interval as Among them, n is a positive integer, and it is also necessary to ensure that T is not too small to prevent excessive segmentation from causing loss of semantic information. And the sample length T divides each long time series record into M samples of equal length for subsequent representation learning.

[0053] S2, constructs the corresponding positive and negative sample sets for each single sample in each long time series record, and constructs contrast loss based on the positive and negative sample sets to mine the periodic characteristics of the long time series records.

[0054] In the embodiment, a comparative learning strategy for learning long-term periodicity is defined, specifically defined as: samples that belong to the same long time series record as a single sample and are separated from the starting time point (this starting time point is the starting time point of the long time series record) by an integer multiple of the period interval are taken as positive samples, and form a positive sample set The remaining samples are regarded as negative samples and constitute the negative sample set The positive sample set constructed in this way The samples contain long time series information.

[0055] Construct contrast loss based on constructed positive and negative sample sets To mine the periodic characteristics of long time series records:

[0056]

[0057] Among them, Xi∈D represents the i-th sample in the sample set D, Indicates The i-th positive sample in Indicates belonging to The i-th negative sample in, E represents the expectation, Zi represents the representation vector of Xi through the encoder G, express Through the representation vector of encoder G, express Through the representation vector of encoder G, sim represents the cosine similarity, and the temperature coefficient τ∈(0,+∞) controls the width of the distribution.

[0058] S3 predicts the relative positions of different samples in the same long time series record and learns the trend characteristics of long time series records by constructing cross entropy loss.

[0059] In the embodiment, relative position prediction is performed on different samples belonging to the same long time series record, that is, a prediction network (e.g., multiple fully connected layers, such as three layers) is added to the output of the encoder to realize relative position prediction of different samples, and a cross entropy loss is constructed. Learn the trend of long time series:

[0060]

[0061] in, Indicates that G(X i )and Splicing, C d (·) represents the concatenated vector obtained by the prediction network. max The d-th dimension representation of the output representation of the dimension, d max represents the number of time intervals P in a long time series record, Represents X i and The number of real time intervals P between is an indicator function, when It takes 1 when it is, otherwise it takes 0.

[0062] S4, the constructed contrastive loss and cross entropy loss are attached to the existing contrastive learning to optimize the encoder to achieve representation learning of long time series records.

[0063] In the embodiment, the loss function in the existing contrastive learning method is The contrast loss constructed and cross entropy loss Append to the existing contrastive learning to get the total loss function for the final representation learning for:

[0064]

[0065] Among them, λ1 and λ2 are custom hyperparameters used to balance the three losses. Through this total loss function Characterization learning of long time series records can enable the encoder to learn the periodic and trend characteristics of long time series data, and improve the representation ability of the optimized encoder.

[0066] After representation learning, the optimized encoder is used as a feature extractor for downstream tasks and fine-tuned on a small dataset to achieve the downstream task, which can be a classification task.

[0067] In the following, classification is used as a downstream task, and the Alzheimer's dataset in the medical field is used as a long time series data to verify the technical effect of the characterization method of the present invention.

[0068] The Alzheimer's dataset contains 663 16-channel EEG time series recording data from 23 patients. The sampling frequency is 256HZ, and each time series record contains 1280 sampling points. The encoder G as the backbone network adopts a sparse convolutional network, which is composed of 10 sparse convolutional blocks connected by residuals. Each block contains a four-layer neural network of GELU->DilatedConv->GELU->DilatedConv. In addition, the size of the convolution kernel is 3, the dimension of the hidden layer is 64, and the output feature dimension is 320. The classifier C consists of a four-layer network of GAP->Linear->Linear->Linear. Both the pre-training and fine-tuning stages are trained for 100 epochs, the learning rate is 0.0001, and the temperature coefficient τ is 0.5. The corresponding task is to determine whether Alzheimer's syndrome exists based on the input EEG time series recording data.

[0069] Using the appropriate frequency wmax=2 determined by the data of the Alzheimer's dataset in step 1 above, we then select the appropriate period interval P=640, and then take n=5, that is, select one-fifth of P as the sample length, that is, T=128, and divide each original record into 10 samples of equal length. Each sample has a label, marking whether it comes from a patient with Alzheimer's or not, for subsequent representation learning. Then, according to the above steps 2-4, a total loss function is constructed, where λ1 and λ2 are both 0.25, and representation learning is performed.

[0070] The embodiment also provides GPU consumption and classification effect tests on the EEG dataset of Alzheimer's syndrome, and different segmentation strategies are used in different tests of contrastive learning. In various tests, different sample lengths are set and the results are compared, such as Figure 2 As shown, it can be found that longer samples do not mean better results, but only lead to higher GPU memory consumption. Therefore, it is critical to select a suitable sample length. The time interval P and the corresponding sample length T determined by the present invention can ensure that the GPU memory consumption and classification effect are balanced at the same time.

[0071] The embodiment also provides a comparison of the effects before and after the method of the present invention is combined with an existing comparative learning method called COMET, which adopts the strategy of unsupervised learning first and then fine-tuning. Figure 3 The comparison shown shows that the method of the present invention significantly improves the representation effect of the existing contrastive learning method.

[0072] The embodiment also provides a visualization comparison of the representation space before and after the combination of the method of the present invention and the existing contrastive learning method, using the t-sne method, where COMET is an existing contrastive learning method that performs well on medical time series data sets. Figure 4 The comparison shown shows that the representation space formed by the method of the present invention is better than the representation space of the existing contrastive learning method, which is specifically manifested in that the interval between positive and negative samples is significantly more obvious.

[0073] like Figure 5As shown, the embodiment also provides a representation learning device 50 based on the recovery of time series period and trend characteristics, including: a preprocessing module 51, a contrast loss construction module 52, a cross entropy loss construction module 53, and a representation learning module 54, wherein the preprocessing module 51 is used to determine the periodic interval according to the distribution of multiple long time series records in the frequency domain, and determine the sample length according to the periodic interval, and divide each long time series record into multiple equal-length samples according to the sample length; the contrast loss construction module 52 is used to construct the corresponding positive and negative sample sets for each single sample in each long time series record, and to mine the periodic characteristics of the long time series records by constructing contrast losses based on the positive and negative sample sets; the cross entropy loss construction module 53 is used to predict the relative positions of different samples belonging to the same long time series record, and to learn the trend characteristics of the long time series records by constructing cross entropy losses; the representation learning module 54 is used to optimize the encoder by appending the constructed contrast loss and cross entropy loss to the existing contrast learning to realize the representation learning of the long time series records.

[0074] It should be noted that the representation learning device based on the recovery of timing cycles and trend characteristics provided in the above-mentioned embodiments should be illustrated with the division of the above-mentioned functional modules when performing representation learning. The above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the terminal or server is divided into different functional modules to complete all or part of the functions described above. In addition, the representation learning device based on the recovery of timing cycles and trend characteristics provided in the above-mentioned embodiments belongs to the same concept as the embodiment of the representation learning construction method based on the recovery of timing cycles and trend characteristics. The specific implementation process is detailed in the embodiment of the representation learning method based on the recovery of timing cycles and trend characteristics, which will not be repeated here.

[0075] Based on the same inventive concept, an embodiment further provides a computing device, including a memory and one or more processors, wherein executable code is stored in the memory, and when the one or more processors execute the executable code, the method for implementing the above-mentioned representation learning method based on time series cycle and trend characteristic recovery specifically includes the following steps:

[0076] S1, determining the period interval according to the distribution of multiple long time series records in the frequency domain, determining the sample length according to the period interval, and dividing each long time series record into multiple samples of equal length according to the sample length;

[0077] S2, constructs the corresponding positive and negative sample sets for each single sample in each long time series record, and constructs contrast loss based on the positive and negative sample sets to mine the periodic characteristics of the long time series record;

[0078] S3, predicts the relative positions of different samples in the same long time series record, and learns the trend characteristics of the long time series record by constructing the cross entropy loss;

[0079] S4, the constructed contrastive loss and cross entropy loss are attached to the existing contrastive learning to optimize the encoder to achieve representation learning of long time series records.

[0080] like Figure 6 As shown, the computing device provided in the embodiment, at the hardware level, in addition to the processor and memory, also includes the hardware required for other services such as internal bus, network interface, memory, etc. The memory is a non-volatile memory, and the processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to implement the representation learning method based on the recovery of timing cycles and trend characteristics described in S1-S4 above. Of course, in addition to the software implementation method, the present invention does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0081] In summary, the present invention provides a representation learning scheme based on the recovery of time series cycle and trend characteristics. Compared with the commonly used contrastive learning method, the present invention recovers the problem of long-term characteristics lost after segmentation of long-term series data, and has a significant improvement in the effect of representation learning.

[0082] The specific implementation methods described above provide a detailed description of the technical solutions and beneficial effects of the present invention. It should be understood that the above is only the most preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, supplements and equivalent substitutions made within the scope of the principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A representation learning method based on time series cycle and trend characteristic recovery, characterized in that: The following steps are involved: The period interval is determined based on the distribution of multiple long time series records in the frequency domain, and the sample length is determined based on the period interval, and each long time series record is divided into multiple samples of equal length according to the sample length; For each single sample in each long time series record, a corresponding positive and negative sample set is constructed, and based on the positive and negative sample sets, a contrast loss is constructed to mine the periodic characteristics of the long time series record. Among them, samples that belong to the same long time series record as the single sample and are separated from the starting time point by an integer multiple of the period interval are taken as positive samples, and the rest of the samples are taken as negative samples; Predict the relative positions of different samples in the same long time series record, and learn the trend characteristics of the long time series record by constructing the cross entropy loss; The constructed contrastive loss and cross entropy loss are appended to the existing contrastive learning to optimize the encoder to achieve representation learning of long time series records.

2. The representation learning method based on time series cycle and trend characteristic recovery according to claim 1 is characterized in that: The period interval is determined based on the distribution of multiple long time series records in the frequency domain, including: Convert each long time series record containing M*T sampling points into the frequency domain to obtain a spectrogram, and average the spectrograms of all long time series records to obtain the spectrogram Then, according to the average spectrum The ratio of the amplitude to the frequency selects the appropriate frequency wmax, and the period interval P is determined based on the appropriate frequency wmax and the number of sampling points MT: Among them, N represents the total number of long time series records, n represents the number index, f represents the feature dimension index in the long time series record, F represents the total number of feature dimensions, Φnf represents the spectrum corresponding to the fth feature dimension in the nth data, Mean The amplitude corresponding to the j-th frequency wj in , argm ax(·) finds the maximum frequency.

3. The representation learning method based on time series cycle and trend characteristic recovery according to claim 1 is characterized in that: The sample length is determined based on the period interval, including: The sample length T is Where n is a positive integer and P is the period interval.

4. The representation learning method based on time series cycle and trend characteristic recovery according to claim 1 is characterized in that: Contrastive loss based on positive and negative sample sets It is expressed as: Among them, Xi∈D represents the i-th sample in the sample set D, Indicates that it belongs to the positive sample set The i-th positive sample in represents the i-th negative sample in the negative sample set Di-, E represents the expectation, Zi represents the representation vector of Xi through the encoder, express Through the representation vector of encoder G, express Through the representation vector of encoder G, sim represents the cosine similarity, and the temperature coefficient τ∈(0,+∞) controls the width of the distribution.

5. The representation learning method based on time series cycle and trend characteristic recovery according to claim 1 is characterized in that: A prediction network is added to the output of the encoder to predict the relative positions of different samples, and the cross entropy loss is constructed. It is expressed as: Among them, Xi∈D represents the i-th sample in the sample set D, Indicates that it belongs to the positive sample set The i-th positive sample in, E represents the expectation, G(Xi) represents the representation vector of Xi through the encoder G, express Through the representation vector of encoder G, It means that G(Xi) and splicing, Cd(·) represents the d-th dimension representation of the dmax-dimensional output representation obtained by the concatenated vector after the prediction network, dmax represents the number of time intervals P in a long time series record, Represents Xi and The number of real time intervals P between is an indicator function, when It takes 1 when it is, otherwise it takes 0.

6. The representation learning method based on time series cycle and trend characteristic recovery according to claim 1 is characterized in that: The representation learning method is used for representation learning in the medical field, wherein each long time series record represents time series data of medical-related indicators or parameters, including: ECG time series data, EEG time series data.

7. The representation learning method based on time series cycle and trend characteristic recovery according to claim 1 is characterized in that: The representation learning method is used for representation learning in the meteorological field, wherein each long time series record represents time series data of meteorological related indicators or parameters, including: rainfall time series data, and various gas concentration time series data.

8. The representation learning method based on time series cycle and trend characteristic recovery according to any one of claims 1 to 7, characterized in that: Also includes: The optimized encoder is used as a feature extractor for downstream tasks and fine-tuned on a small dataset to achieve the downstream task.

9. A representation learning device based on time series cycle and trend characteristic recovery, characterized in that: include: A preprocessing module is used to determine the period interval according to the distribution of multiple long time series records in the frequency domain, determine the sample length according to the period interval, and divide each long time series record into multiple samples of equal length according to the sample length; A contrast loss construction module is used to construct the corresponding positive and negative sample sets for each single sample in each long time series record, and to mine the periodic characteristics of the long time series record by constructing contrast loss based on the positive and negative sample sets, wherein the samples that belong to the same long time series record as the single sample and are separated from the starting time point by an integer multiple of the period interval are regarded as positive samples, and the remaining samples are regarded as negative samples; A cross entropy loss building module is used to predict the relative positions of different samples in the same long time series record, and to learn the trend characteristics of long time series records by building cross entropy loss; The representation learning module is used to append the constructed contrastive loss and cross entropy loss to the existing contrastive learning to optimize the encoder to achieve representation learning of long time series records.

10. A computing device comprising a memory and one or more processors, wherein the memory stores executable code, characterized in that: When the one or more processors execute the executable code, they are used to implement the representation learning method based on timing cycle and trend characteristic recovery as described in any one of claims 1-8.