Solar wind speed time sequence prediction method based on fragment global and local correlation comparative learning
By constructing positive and negative sample pairs based on fragment global local correlation comparison learning methods, the limitations of time series prediction methods in the prior art in sample construction and timing information capture are solved, and the accuracy and accuracy of solar wind speed time series prediction are improved.
Patent Information
- Application Number
- CN202510345306.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-24
- Publication Date
- 2025-07-08
AI Technical Summary
The existing time series comparison learning method destroys the time dependence of the time series during the construction of positive and negative samples, and ignores the overall time series information within the sequence, and cannot effectively capture periodic characteristics and short-term dependencies at different scales.
Using a method based on global local correlation comparison learning of fragments, positive and negative sample pairs are constructed through global autocorrelation and local cross-correlation comparison losses, and the model captures global long-term features and local short-term features.
It significantly improves the model's ability to capture cycle characteristics at different scales in the time series, and improves the accuracy and accuracy of solar wind speed time series prediction.
Smart Images

Figure CN120277426A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of time series prediction, and relates to a deep learning model training method applied to solar wind speed time series prediction, specifically a solar wind speed time series prediction method based on global and local angle comparison learning of fragments. Background Art
[0002] Time series prediction methods based on deep learning have been deployed and applied in a variety of time series related fields including electricity, transportation, weather and finance, and have achieved remarkable results. High-quality features extracted from historical sequences have a vital impact on future predictions. In order to maximize the potential features that are helpful for prediction, some works start from the structure of deep learning models. By improving the model itself, different types of features are indirectly extracted during the training process, such as seasonal cycles, trends, fluctuations, etc., and new functional modules are added to the existing model to improve the prediction accuracy. Another idea combines self-supervised contrastive learning, which has outstanding performance in computer vision and natural language processing. Under the new training paradigm and task objectives, the model not only needs to complete the prediction task, but also achieve the goal of the self-supervision task. Appropriate contrast tasks will help improve the prediction effect.
[0003] As an important branch of self-supervised learning, self-supervised contrastive learning has been deeply studied and widely used in other fields. It extracts commonalities and differences between samples by shortening the distance between positive sample pairs and pushing the distance between negative sample pairs in feature space, and helps improve downstream task performance by pre-training, fine-tuning, or auxiliary tasks. Since contrastive learning can discover the potential characteristics of the data itself, it performs well in a variety of time series analysis scenarios such as sequence classification, domain shift, transfer learning, and anomaly detection. In the field of time series forecasting, some new advances in recent years are to combine supervised forecasting with self-supervised contrast tasks, guiding the model to improve deep feature extraction capabilities or solve other technical problems through self-supervised objective functions while meeting the forecasting goals.
[0004] Although contrastive learning has been applied to some extent in the field of time series analysis, current contrastive prediction methods still have several limitations. First, the construction idea of self-supervised contrastive sample pairs is unreasonable. Previous time series contrastive representation learning referred to the frameworks of computer vision and natural language processing, using data augmentation in the visual field (rotation, scaling, flipping, etc.) as the source of positive samples. This not only destroys the temporal characteristics of the time series itself, but also for different datasets, the data augmentation methods used are different, relying on empirical attempts. Recent work has noticed the temporal characteristics and discriminates positive and negative samples based on the time interval of the samples, making certain progress. However, its effect depends on the assumption of the non-stationarity of the time series and is also sensitive to the interval threshold. Second, the granularity isolation within self-supervised contrastive samples. Existing mainstream contrastive prediction methods use a single time step as the smallest contrastive example, ignoring the overall temporal information contained in a group of time steps within the sequence and only retaining the spatial dependence between the channels of the multivariate sequence. Some other methods use the entire input window as the feature unit and can only focus on the associations between different windows, failing to capture the dependencies between short sequences within the window. The intra-segment and inter-segment associations at the short segment level within the sequence are very important for time series prediction. Summary of the Invention
[0005] Aiming at the problems of unreasonable construction of sample pairs and granularity isolation in the above-mentioned existing technology contrastive prediction methods, the present invention provides a solar wind speed time series prediction method based on segment global-local correlation contrastive learning, introducing a contrastive auxiliary task based on global autocorrelation and local cross-correlation to improve the model's ability to capture global long-term features and local short-term features in addition to supervised training.
[0006] In order to solve the above technical problems, a solar wind speed time series prediction method based on segment global-local correlation contrastive learning proposed by the present invention includes the following steps:
[0007] Step 1) Data preprocessing: Read in the existing solar wind speed time series dataset, divide it into a training set, a validation set, and a test set at a certain ratio for training, validation, and result testing respectively, linearly fill in missing values and outliers; calculate the mean and variance on the training set and normalize the entire dataset including the validation and test sets based on this statistic;
[0008] Step 2) Obtain the global average autocorrelation degree at the segment level through global autocorrelation calculation: For the training set preprocessed in Step 1), use the segment-level global autocorrelation metric to calculate its global average autocorrelation degree at the segment level;
[0009] Step 3) Extract sample features through a deep learning model: Divide the training set preprocessed in Step 1) into multiple equal-length short segments and input them into the deep learning model to extract sample features;
[0010] Step 4) Obtain the global autocorrelation contrast loss through fragment global autocorrelation contrast learning, including:
[0011] 4-1) According to the time position difference of random samples in the original sequence in the training set, query the global average autocorrelation degree between corresponding position difference samples in the statistics of the global average autocorrelation degree at the fragment level in Step 2), obtain the global correlation statistic, and form a global autocorrelation matrix;
[0012] 4-2) Select the column corresponding to the item with the largest autocorrelation except the diagonal from each row of the global autocorrelation matrix to obtain the positive sample number corresponding to each sample;
[0013] 4-3) Find the corresponding sample feature according to the column number of the column corresponding to the item with the largest cross-correlation except the diagonal, mark the sample corresponding to this sample feature as a positive sample in the random samples, and mark other samples as negative samples;
[0014] 4-4) According to the marked positive and negative samples, calculate the similarity between the sample features extracted by the deep learning model and the positive and negative sample features respectively, and take the logarithm after dividing the similarity of the positive sample pair by the average similarity of the negative sample pair to obtain the fragment global autocorrelation contrast loss;
[0015] 4-5) Take the average value of the fragment global autocorrelation contrast losses of all samples as the global autocorrelation contrast loss;
[0016] Step 5) Obtain the local cross-correlation contrast loss through fragment local cross-correlation contrast learning, including:
[0017] 5-1) For all fragments in each sample, calculate the cross-correlation value pairwise to obtain a fragment cross-correlation matrix;
[0018] 5-2) Select the column corresponding to the item with the largest cross-correlation except the diagonal from each row of the fragment cross-correlation matrix to obtain the positive sample number corresponding to each fragment;
[0019] 5-3) Select the fragment feature marked as the positive sample of this row from the positive sample numbers, and mark other samples in this row as negative samples;
[0020] 5-4) According to the positive and negative samples marked in Step 5-3), take the logarithm after dividing the similarity between each fragment feature and the positive sample feature by the average similarity of the negative samples to obtain the fragment local cross-correlation contrast loss;
[0021] 5-5) Take the average value of the fragment local cross-correlation contrast losses of all samples as the local cross-correlation contrast loss;
[0022] Step 6) Temporal prediction training based on segment global-local contrast learning: Use the prediction layer to calculate the prediction sequence for the sample feature V, and take the mean square error between the prediction sequence and the true sequence as the prediction loss;
[0023] Step 7) Model optimization: Based on the global autocorrelation contrast loss in Step 4), the local cross-correlation contrast loss in Step 5), and the prediction loss in Step 6), the three are added together through weights to obtain the training loss for model optimization, and the initial value of the weight is 1;
[0024] Step 8) Use the optimized model for solar wind speed temporal prediction: If the prediction error of the prediction model on the validation set is still decreasing, then adjust the parameters of the deep learning model and the prediction layer using the training loss, and return to Step 3) until the prediction error of the prediction model on the validation set no longer decreases; If the prediction error of the prediction model on the validation set no longer decreases, then use the optimized model for solar wind speed temporal prediction, the solar wind speed time series in the past period as the input of the model, and the output of the model is the corresponding future wind speed prediction sequence.
[0025] Compared with the prior art, the beneficial effects of the present invention are:
[0026] There are two main problems in the existing time series contrast learning methods during the construction of positive and negative samples: First, they rely on successful experiences in other fields to use simple data augmentation techniques, which will destroy the temporal dependence relationship of the time series itself, resulting in the loss of temporal characteristics of the learned features; Second, these methods usually rely on the timestamp distance between samples to construct positive and negative samples, ignoring the periodic and trend information across long distances. To solve these problems, the present invention proposes a new contrast learning strategy, which selects positive samples through the correlation relationship of samples in the global context, that is, selects the sample pair with the highest correlation and maximizes their feature similarity. This method not only retains the temporal dependence relationship of the time series, but also can dynamically capture the periodic laws at different scales, thus better conforming to the characteristics of the time series itself and enhancing the ability to capture long-distance periodic features.
[0027] In addition, the existing temporal contrast prediction methods usually take a single time step as the minimum unit for feature extraction and contrast, ignoring the overall temporal information contained in a group of time steps within the sequence. Some other methods take the entire input window as the feature unit and cannot capture the dependence relationship between short sequences within the window, while the intra-fragment and inter-fragment associations are crucial for temporal prediction. For this reason, the present invention extends the contrast prediction method from discrete single points to segments as the unit, extracts features from the segment as a whole, so as to better retain the temporal association. At the same time, the present invention further divides the sample internally into multiple short segments, and extracts the interaction features between these segments through contrast learning, significantly enhancing the model's ability to capture short-term dependencies within the input window.
[0028] Through the above innovations, the present invention not only overcomes the limitations of existing methods in positive and negative sample construction and temporal information capture, but also significantly improves the model's ability to capture periodic features of different scales in time series, providing a more powerful representation learning framework for the solar wind speed time series prediction task. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 is a schematic diagram of the overall model structure of the present invention and the position where the loss function acts;
[0030] Figure 2 is a schematic diagram of the segment global autocorrelation contrast loss proposed by the present invention;
[0031] Figure 3 is a schematic diagram of the segment local cross-correlation contrast loss proposed by the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0032] The design idea of the solar wind speed time series prediction method based on segment global-local correlation contrast learning proposed by the present invention is as follows: Among samples from the global perspective and within a sample, short segments are used as units to measure and select other segments with the highest degree of correlation as positive samples, guiding the model to extract common features within the positive samples and discriminative features that distinguish them from low-correlation samples. During the calculation of the contrast loss, the distance between positive sample feature pairs should be much smaller than the average distance between negative sample feature pairs, so as to achieve the purpose of mining common features of positive samples and discriminative features of negative samples. After training and optimization, this contrast loss will guide the model to extract long-distance wind speed change cycles (common features) and trends (discriminative features) from the long distances across the entire length of the solar wind speed dataset; within the sample, short-term wind speed cycles and trend features between different short segments are also discovered and finally used together with global features for future wind speed prediction. This method effectively improves the ability to extract cycle and trend features at different time distances (long distance and short distance) and the prediction accuracy based on features, and is applicable to the prediction task of solar wind speed time series data.
[0033] The temporal prediction contrast learning framework proposed by the present invention includes two parts:
[0034] (1) A positive and negative pair construction strategy based on segment global autocorrelation. Using short segments as units, construct short sequence positive sample pairs with the strongest global correlation to improve the ability to extract ultra-long-term temporal features from a global perspective;
[0035] (2) A segment positive and negative pair construction strategy based on cross-correlation between segments. Construct sample pairs according to the correlation between segments within a window to capture short sequence context dependencies within the window. From the above sample pairs, the contrast loss measures and extracts the corresponding dependencies at the global and local levels respectively as auxiliary tasks to strengthen the model's prediction ability.
[0036] The method of the present invention mainly includes: preprocessing time series data, dividing the data set, dividing segments on the training data and calculating global autocorrelation statistics; using a Transformer model to extract features from the data; according to the relative position of the sample in the original data set, using the global autocorrelation statistics to measure the correlation between sample segments, and selecting the segment with the highest correlation as the positive sample to calculate the segment global autocorrelation contrast loss with the features of other segments; for all segments within a sample, calculating the correlation between sample features, and selecting the segment with the highest correlation as the positive sample to calculate the segment local cross-correlation contrast loss with the features of other segments; making a final prediction on the features, weighted-fusing the global autocorrelation contrast loss, the local cross-correlation contrast loss and the mean square error prediction loss, and updating the model. The present invention introduces segment-level representation and correlation measurement, and constructs positive and negative sample pairs from the perspectives of global and local correlations. This method improves the ability of the time series prediction model to extract sequence features of global long-term dependencies and local short-term variations, and effectively improves the prediction performance of the solar wind speed time series.
[0037] The following further describes the present invention with reference to the accompanying drawings and specific embodiments, but the following embodiments shall not limit the present invention in any way.
[0038] Problem definition in the present invention: Given a solar wind speed time series data set S = {s1, s2, …, s T} with T time steps, historical wind speed observation data X = {x1, x2, …, x L} ∈ S with a length of L time steps can be sampled from this data set, and the task is to predict the wind speed data Y = {y1, y2, …, y H} ∈ S for the next H time steps.
[0039] As Figure 1 shown, taking the solar wind speed time series data as an example, the training method of the time series prediction model proposed by the present invention is described. This method includes the following steps:
[0040] Step 1) Data preprocessing: First, collect the historical data of the solar wind speed and perform division and preprocessing before training. The division step divides the data set into a training set, a validation set and a test set according to a certain ratio and chronological order, ensuring that there is no intersection between the sets and the training set and the validation set correspond to earlier times than the test set. After that, unless otherwise specified, S is used to represent the training data set. In the preprocessing, interpolation filling and mean replacement operations are performed on the missing values and outliers in the data set respectively. Then, the mean and variance are calculated on the training set and applied to the entire data set to complete the maximum-minimum normalization transformation of the data, so as to ensure that the output value range of the model is reasonable and effective.
[0041] Example: For a solar wind speed dataset with 50,000 time points, the dataset is divided in chronological order, specifically: 60% is used as the training set to train the model, 20% is used as the validation set to select the optimal model parameters, and 20% is used as the test set to evaluate the prediction performance. Then, for the missing values in the three sets, interpolation is performed, that is, the data of the previous time step is taken as the value of the current time step.
[0042] Step 2) Calculate the global autocorrelation statistic. Calculate the segment-level global autocorrelation statistic for the divided and normalized training set S. According to the set segment length l, the training set is divided into a series of segment sets P of length l:
[0043] P = {p1, p2, …, p T-l+1 ∣p i = s i :s i+l-1 , i = 1, 2, …, T - l + 1} (1)
[0044] In formula (1), the time interval between any two adjacent segments in the original dataset is 1.
[0045] After that, calculate the cross-correlation values between segments at different distance intervals in turn with segments as the unit. The specific steps for segment-level correlation calculation are as follows:
[0046] After that, calculate the Pearson correlation coefficient between segments. Use the Pearson correlation coefficient ρ XY to represent the linear correlation degree between two sequences X and Y of length L:
[0047]
[0048] In formula (2), x l represents the l-th element in sequence X, and y l Similarly, represents the mean of each element of the two sequences participating in the calculation.
[0049] Based on the above formula, calculate the global segment correlation measure at different interval distances on the ordered segment set P:
[0050]
[0051] In formula (3), h represents the absolute value of the relative position difference between two segments in the original dataset. In short, R PP(h) represents the average global correlation degree among segment pairs corresponding to a time interval of h in the sequence S of length T. When the linear correlation between two segments in the sequence is strong, its correlation value is closer to 1 or -1. Therefore, the global autocorrelation statistic can reflect the average linear correlation between segment pairs of a specific lag length in the entire sequence. This metric takes into account the cross-correlation information between segments and has good interpretability. A higher correlation indicates a higher degree of association between segments at the current lag length and a higher degree of global dependence.
[0052] For example: For the solar wind speed training dataset of 30,000 time points, all segments with an interval of h are obtained by sliding. The first pair of segments is: p1, p 1+h , and so on. Calculate the correlation between each pair of segments and take the average, which is the value of R PP (h) when the independent variable is h.
[0053] Step 3) Feature extraction of the backbone model. Before entering the model, each time series sample X = {x1, x2,..., x L+1} of length L is divided into M sets P of segments of length l along the time dimension. The model extracts features for each segment separately. Each segment sample p i in the set passes through the deep learning model Model to extract features and obtain an output feature v i ;
[0054] v i = Model(p i ) (4)
[0055] In formula (4), the deep learning model Model is an arbitrary time series feature encoder. Using the Transformer model as the feature extractor, its brief calculation formula is as follows:
[0056] Q i = p i W Q , K = p i W K , V = p i W V (5)
[0057] Among them, W Q , W K , W V are weight matrices. Then, calculate the feature v:
[0058]
[0059] Among them, W O is the weight matrix, and d k is a fixed constant.
[0060] Step 4) As Figure 2 , the process of global autocorrelation contrast learning for segments is as follows:
[0061] Step 4-1) Calculation of global autocorrelation matrix: In a batch of N segment samples P, according to the difference in their time positions in the original sequence, calculate the global correlation between the corresponding position-difference samples in the global autocorrelation statistic:
[0062]
[0063] In Equation (7), t1 and t2 respectively represent the positions of two segments in the original sequence dataset S.
[0064] The global correlations between all samples calculated according to the above formula form a global autocorrelation matrix A of size (M*N)*(M*N) global :
[0065] A global (i,j) = r global (p i , p j ) (8)
[0066] In Equation (8), A global (i,j) represents the global correlation between the i-th and j-th segment samples in a batch of segment samples.
[0067] Step 4-2) Select the column number corresponding to the item with the largest cross-correlation value except the diagonal from each row in the global autocorrelation matrix A global to obtain the positive sample number corresponding to each segment. For example, if the feature of any sample in a batch of samples is v (i) , for this sample, find the column number corresponding to the column with the largest autocorrelation from the i-th row of the autocorrelation matrix, and let it be j.
[0068] Step 4-3) From the column number j obtained in Step 4-2), find the corresponding sample feature v (j) , as the positive sample corresponding to the sample feature v (i) in the previous step, and the other features v (k) in the same batch as negative samples.
[0069] Illustrative example: As Figure 2 shown in the heat map, the 9th row represents the cross-correlation values between a batch of samples and the 9th sample. Except for the diagonal, the column label with the largest cross-correlation value is 11. Therefore, the 11th sample is marked as the positive sample, and the other samples are marked as negative samples.
[0070] Step 4-4) After marking the positive and negative samples of all sample features in the completed batch, calculate the similarity between each sample feature and its positive and negative sample features, divide the similarity of the positive sample pair by the average similarity of the negative sample pairs, and take the logarithm to obtain the segment global autocorrelation contrast loss. For any sample feature v in a batch (i) , there exists another sample with the highest global correlation with it, and it is marked as the positive sample v (j) , and the other samples in the batch are marked as negative samples v (k) . On this basis, the segment global autocorrelation contrast loss is defined as follows:
[0071]
[0072] In formula (9), Sim(·,·) represents the similarity between two features, usually the cosine similarity:
[0073]
[0074] In formula (10), |·| represents the norm of the feature.
[0075] Step 5) As Figure 3 shown, the segment local cross-correlation contrast learning process is as follows:
[0076] Step 5-1) Similar to the global autocorrelation contrast loss, first calculate the local cross-correlation matrix: In each sample feature obtained in Step 3), there are multiple equally long segment features. Calculate the cross-correlation value pairwise for the segments according to the Person correlation coefficient in formula (2):
[0077]
[0078] According to the segment cross-correlation value calculated by formula (11), each input sample can obtain a segment cross-correlation matrix of size M*M:
[0079] A local (i,j) = r local (p i , p j ) (12)
[0080] In formula (12), A local (i,j) represents the local correlation between the i-th and j-th segments in a sample.
[0081] Step 5-2) For each row i in the local cross-correlation matrix A local , select the column number corresponding to the item with the largest cross-correlation value except the diagonal, that is: Let any segment feature in a sample be v (i) , for this feature, from the column number corresponding to the column with the largest cross-correlation in the i-th row of the cross-correlation matrix, let it be j.
[0082] Step 5-3): From the column number j obtained in Step 5-2), find the corresponding segment feature v (j) , as the sample feature v in the previous step (i) The corresponding positive sample, and the other segment features v in the same batch (k) are used as negative samples.
[0083] Illustrative example: As in Figure 3 the heat map, the 9th row represents the cross-correlation value between other segments and the 9th segment in a sample. Except for the diagonal, the column label with the largest cross-correlation value is 11. Therefore, the 11th sample is marked as the positive sample, and the other samples are marked as negative samples.
[0084] Step 5-4): According to the positive and negative samples marked in Step 5-3), calculate the similarity between each segment feature and the positive sample feature, and divide the similarity of the positive sample by the average similarity of the negative samples, and take the logarithm to obtain the segment local cross-correlation contrast loss:
[0085] Step 5-4-1): For any segment feature v n in a sample x (n,i) , there is always another segment sample with the highest local correlation with it, and it is marked as the positive sample v (n,j) , and the other samples in the batch are marked as negative samples v (n,k) . On this basis, the segment local cross-correlation contrast loss of a batch of samples is defined as follows:
[0086]
[0087] In Equation (13), Sim(·,·) represents the similarity between two features, which is the same as Equation (8).
[0088] Step 6): Training for solar wind speed time series prediction based on segment global-local contrast learning:
[0089] Step 6-1): Based on the feature v extracted by the deep learning model in Step 3), use the final prediction layer Predictor to map the feature to the prediction output
[0090]
[0091] In Equation (14), W P and b are both learnable matrices. The mean squared error MSE is used to measure the error between the prediction sequence and the true sequence y, as the prediction loss:
[0092]
[0093] Step 7): Based on the global autocorrelation contrast loss in Step 4), the local cross-correlation contrast loss in Step 5), and the prediction loss in Step 6), the three are summed with weights to obtain the training loss that guides the optimization of the model:
[0094] L total = α * L GlobalCorr + (1 - α) * L LocalCorr + L pred (16)
[0095] In Equation (16), α is the loss term weight, which controls the relative magnitudes of the two contrast losses.
[0096] To adaptively adjust the model's prediction focus, an exponential loss weight decay mechanism is set. The update rule for each round is as follows:
[0097] α = β * α (17)
[0098] In Equation (17), β is the decay coefficient, which is generally set to 0.99.
[0099] After learning, the prediction model can accept the solar wind speed time series over a past period as input and give the corresponding future wind speed prediction sequence. Through the prediction sequence, the future changes in solar wind speed over a period can be anticipated in advance. After learning, the model will no longer need to calculate Figure 1 the local cross-correlation contrast loss and the global autocorrelation contrast loss of the segments shown, and the prediction results can be directly obtained through the deep learning model.
[0100] Research materials
[0101] This method is applied to the time series prediction task of solar wind speed. The dataset used includes 50,000 time points, and each time point consists of six indicators: date, solar particle temperature, solar wind density, solar wind pressure, ratio of magnetic field pressure to thermal pressure, and wind speed. Among them, for the multi-variable prediction task, five indicators except the date need to be predicted, and for the single-variable prediction task, the wind speed indicator needs to be predicted. Among them, the input length of all methods is the numerical values of 96 time points, and the prediction lengths are 96, 192, 336, and 720. The mean squared error MSE and the mean absolute error MAE are used as indicators to evaluate the time series prediction effect of the model. Table 1 shows the comparison between this method and other publicly available methods in the solar wind time series prediction task.
[0102] Table 1
[0103]
[0104] Table 1 shows the prediction results of the present method and three other publicly available time series prediction methods in the task of predicting the solar wind speed time series. It can be seen from Table 1 that, compared with other methods, the present method achieves the best prediction effect under the above-mentioned conditions of different prediction lengths and numbers of variables, that is, the smallest MSE and MAE errors, which indicates that the method proposed by the present invention can well complete the long-term and short-term wind speed prediction tasks. Thus, the practicability and prediction accuracy of the present method in the task of predicting the solar wind speed time series are proved.
[0105] In this study, additional materials selected publicly available datasets in 7 different application fields such as ETTh1, ETTh2, ETTm1, ETTm2, ECL, Weather, and Traffic, and used the mean square error MSE and mean absolute error MAE as indicators to evaluate the time series prediction effect of the model. Table 2 (and the continued Table 2) shows the comparison of the prediction results of the method proposed by the present invention and other recent and mainstream methods on the multivariate time series dataset. In the table, OOM indicates that the method is not available under the corresponding dataset or prediction length conditions.
[0106] Table 2
[0107]
[0108] Continued Table 2
[0109]
[0110]
[0111] Using existing mature methods and datasets, the data in Table 2 further proves that the present method achieves the smallest prediction error in a variety of different application scenarios (mechanical equipment, energy and power, weather, and traffic), and can be applied to various fields to complete the time series prediction task.
[0112] Although the present invention has been described above in conjunction with the accompanying drawings, the present invention is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Under the inspiration of the present invention, those of ordinary skill in the art can also make many improvements and changes without departing from the purpose of the present invention, and these all fall within the protection scope of the present invention.
Claims
1. A solar wind speed time series prediction method based on fragment global-local correlation contrast learning, characterized in that It includes the following steps: Step 1) Data preprocessing: Read in the existing solar wind speed time series dataset, divide it into a training set, a validation set, and a test set at a certain ratio for training, validation, and result testing respectively, linearly fill in missing values and outliers; calculate the mean and variance on the training set and normalize the entire dataset including the validation and test sets based on these statistics; Step 2) Obtain the global average autocorrelation degree at the segment level through global autocorrelation calculation: For the training set preprocessed in Step 1), use the segment-level global autocorrelation metric to calculate its global average autocorrelation degree at the segment level; Step 3) Extract sample features through a deep learning model: Divide the training set preprocessed in Step 1) into multiple equal-length short segments and input them into the deep learning model to extract sample features; Step 4) Obtain the global autocorrelation contrast loss through segment global autocorrelation contrast learning, including: 4-1) According to the time position difference of random samples in the original sequence in the training set, query the global average autocorrelation degree between corresponding position difference samples in the statistics of the global average autocorrelation degree at the segment level in Step 2) to obtain the global correlation statistic and form a global autocorrelation matrix; 4-2) Select the column corresponding to the item with the largest autocorrelation except the diagonal from each row of the global autocorrelation matrix to obtain the positive sample number corresponding to each sample; 4-3) Find the corresponding sample feature according to the column number of the column corresponding to the item with the largest cross-correlation except the diagonal, mark the sample corresponding to this sample feature as the positive sample in the random samples, and mark other samples as negative samples; 4-4) According to the marked positive and negative samples, calculate the similarity between the sample features extracted by the deep learning model and the positive and negative sample features respectively, and take the logarithm after dividing the similarity of the positive sample pair by the average similarity of the negative sample pair to obtain the segment global autocorrelation contrast loss; 4-5) Take the average value of the segment global autocorrelation contrast losses of all samples as the global autocorrelation contrast loss; Step 5) Obtain the local cross-correlation contrast loss through segment local cross-correlation contrast learning, including: 5-1) For all segments in each sample, calculate the cross-correlation value pairwise to obtain a segment cross-correlation matrix; 5-2) Select the column corresponding to the item with the largest cross-correlation except the diagonal from each row of the segment cross-correlation matrix to obtain the positive sample number corresponding to each segment; 5-3) Select the segment feature marked as the positive sample of this row from the positive sample numbers, and mark other samples in this row as negative samples; 5-4) According to the positive and negative samples marked in Step 5-3), take the logarithm after dividing the similarity between each segment feature and the positive sample feature by the average similarity of the negative samples to obtain the segment local cross-correlation contrast loss; 5-5) Take the average value of the segment local cross-correlation contrast losses of all samples as the local cross-correlation contrast loss; Step 6) Temporal prediction training based on segment global-local contrast learning: Use the prediction layer to calculate the prediction sequence for the sample feature V, and take the mean square error between this prediction sequence and the true sequence as the prediction loss; Step 7) Model optimization: Based on the global autocorrelation contrast loss in step 4), the local cross-correlation contrast loss in step 5), and the prediction loss in step 6), the three are summed up with weights to obtain the training loss for model optimization, and the initial value of the weight is 1; Step 8) Use the optimized model to perform time series prediction of solar wind speed: If the prediction error of the prediction model on the validation set is still decreasing, then use the training loss to adjust the parameters of the deep learning model and the prediction layer, and return to step 3) until the prediction error of the prediction model on the validation set no longer decreases; If the prediction error of the prediction model on the validation set no longer decreases, then use the optimized model to perform time series prediction of solar wind speed. The time series of solar wind speed in the past period is used as the input of the model, and the output of the model is the corresponding future wind speed prediction sequence.
2. The solar wind speed time series prediction method according to claim 1, characterized in that, The specific content of step 2) is as follows: Step 2-1) For the preprocessed training set of solar wind speed time series, let this training set be a time series S = {s1, s2, …, s T}, which is divided into a series of ordered segment sets P with a length of L: P = {p1, p2, …, p T-L+1 | p i = s i : s i+L-1 , i = 1, 2, …, T - L + 1} (1) Step 2-2) Calculate the Pearson correlation coefficient between segments: Use the Pearson correlation coefficient ρ XY to represent the degree of linear correlation between two sequences X and Y with length L: In formula (2), x l represents the l-th element in sequence X, and represents the mean value of each element of the two sequences involved in the calculation. Step 2-3) The designed segment global correlation metric of the present invention, according to the ordered segment set P in formula (1), the global correlation calculation method acting on it is as follows: In formula (3), h represents the absolute value of the relative position difference between two segments in the original dataset, and R PP (h) represents the average global correlation degree between segment pairs with a time interval of h in the sequence S of length T.
3. The solar wind speed time series prediction method according to claim 1, wherein The specific content of step 3) is as follows: Before entering the model, each time series sample X of length T = {x1, x2, …, x T+1} is divided into a set P of M segments of length L along the time dimension. The model extracts features for each segment individually, and each segment sample p in the set i passes through the deep learning model Model to extract features and obtain an output feature v i ; v i = Model(p i ) (4) In formula (4), the deep learning model Model is an arbitrary time series feature encoder, and the Transformer model is used as the feature extractor. Its brief calculation formula is as follows: Q i = p i W Q , K = p i W K , V = p i W V (5) Among them, W Q , W K , W V is the weight matrix; then, calculate the feature v: Among them, W o is the weight matrix, and d k is a fixed constant.
4. The solar wind speed time series prediction method according to claim 1, wherein The specific content of step 4) is as follows: Step 4-1) Global autocorrelation matrix calculation, including: Step 4-1-1) In a batch of N segment samples P, according to the difference in their time positions in the original sequence, calculate the global correlation between the corresponding position difference samples in the global autocorrelation statistic: In formula (7), t1 and t2 respectively represent the positions of two segments in the original sequence; Step 4-1-2): Based on the global correlation among all samples in Step 4-1-1), construct the global autocorrelation matrix A global : A global (i,j) = r global (p i , p j )(8) In formula (8), A global (i, j) represents the global correlation between the i-th and j-th fragment samples in a batch of fragment samples; Step 4-2) From each row of the global autocorrelation matrix A obtained in Step 4-1-2) global select a column number corresponding to the term with the largest autocorrelation value except for the diagonal, specifically as follows: Step 4-2-1) Assume that any sample feature in a batch of samples is v (i) , for this sample, find the column number corresponding to the column with the largest autocorrelation from the i-th row of the autocorrelation matrix, and denote it as j; Step 4-3): From the column number j obtained in Step 4-2), find the corresponding sample feature v (j) , as the sample v in Step 4-2-1) (i) corresponding positive sample, and other features v in the same batch (k) are used as negative samples; 4-4) According to the positive and negative samples marked in step 4-3), calculate the similarity between each sample feature and its positive and negative sample features, and divide the similarity of the positive sample pair by the average similarity of the negative sample pair, and take the logarithm to obtain the segment global autocorrelation contrast loss: Step 4-4-1) For any sample feature v in a batch (i) , there exists another sample with the highest global correlation with it, and it is marked as the positive sample v (j) , and the other samples in the batch are marked as negative samples v (k) ; On this basis, the fragment global autocorrelation contrast loss is defined as follows: In formula (9), Sim(·,·) represents the similarity between two features, usually the cosine similarity: In formula (10), |·| represents the norm of the feature.
5. The solar wind speed time series prediction method according to claim 1, wherein The specific content of step 5) is as follows: Step 5-1) Local cross-correlation matrix calculation: Step 5-1-1) In each sample input in step 3), there are multiple segments of equal length. Calculate the cross-correlation value for each pair of segments according to formula 2): Step 5-1-2) From step 5-1-1), each input sample can obtain a segment cross-correlation matrix: A local (i,j) = r local (p i , p j )(12) In formula (12), A local (i, j) represents the local correlation between the i-th and j-th segments in a sample; Step 5-2) From each row of the local cross-correlation matrix A obtained in Step 5-1-2) local select the column number corresponding to the item with the largest autocorrelation value except for the diagonal elements, specifically as follows: Step 5-2-1) Assume that any fragment feature in a sample is v (i) , for this feature, set the column number corresponding to the column with the maximum autocorrelation in the i-th row of the autocorrelation matrix as j; Step 5-3): From the column number j obtained in Step 5-2), find the corresponding segment feature v (j) , as the sample v in Step 5-2-1) (i) corresponding positive sample, and other segment features v in the same batch (k) are used as negative samples; Step 5-4) According to the positive and negative samples marked in step 5-3), calculate the similarity between each segment feature and the positive sample feature, and divide the similarity of the positive sample pair by the average similarity of the negative sample pair, and take the logarithm to obtain the segment local cross-correlation contrast loss: Step 5-4-1) For a sample x n for any fragment feature v (n,i) in it, there exists another fragment sample with the highest local correlation with it, and it is marked as the positive sample v (n,j) , and the other samples in the batch are marked as negative samples v (n,k) ; On this basis, the fragment local cross-correlation contrast loss of a batch of samples is defined as follows: In formula (13), Sim(·,·) represents the similarity between two features, which is the same as formula (10).
6. The solar wind speed time series prediction method according to claim 1, wherein The specific content of step 6) is as follows: Step 6-1): Based on the feature v extracted by the deep learning model in Step 3), use the final predictor layer Predictor to map the feature to the prediction output W in Equation (14) P and b are both learnable matrices; Use the mean squared error (MSE) to measure the error between the predicted sequence and the true sequence y as the prediction loss:
7. The solar wind speed time series prediction method according to claim 1, characterized in that The specific content of step 7) is as follows: Step 7-1) Based on the global autocorrelation contrast loss in step 4), the local cross-correlation contrast loss in step 5), and the prediction loss in step 6), the three are summed up with weights to obtain the training loss guiding model optimization: L total = α * L GlobalCorr + (1 - α) * L LocalCorr + L pred (16) In formula (16), α is the loss term weight, which controls the relative magnitude of the two contrast losses; Step 7-2) is to adaptively adjust the model prediction focus, and an exponential loss weight decay mechanism is set. The update rule for each round is as follows: α=β*α(17) In formula (17), β is the decay coefficient, and the value of β is 0.99.