Training data processing method and device, storage medium and electronic equipment

By performing periodic analysis and feature extraction of power load data, positive and negative sample pairs are constructed, which solves the problem of low prediction power load accuracy in the prior art, and achieves higher prediction accuracy and stability.

CN119988976APending Publication Date: 2025-05-13HUANENG CLEAN ENERGY RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510113028.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-23
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

The prior art is difficult to effectively capture the multi-periodic and complex dynamic characteristics of power load data when predicting power load, resulting in low prediction accuracy.

Method used

By periodically analyzing the historical power load data, building a periodic matrix, and performing feature extraction, training features are generated to build positive and negative sample pairs, which are used to train load prediction models.

Benefits of technology

This method can more accurately reflect the dynamic changes in power load, improve prediction accuracy and stability, and improve the generalization ability of the model when sample data is limited.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119988976A_ABST
    Figure CN119988976A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a training data processing method and device, a storage medium and electronic equipment, and the method comprises the steps: carrying out the periodic analysis of each initial sample, obtaining the periodic component of each initial sample, constructing a periodic matrix of each initial sample based on the periodic component of each initial sample, and obtaining a periodic matrix of each initial sample; performing feature extraction processing on the periodic matrix of each initial sample to obtain a training feature of each initial sample; according to the training features of each initial sample, a positive sample pair corresponding to each initial sample and a negative sample pair corresponding to each initial sample are constructed, and the positive sample pair corresponding to each initial sample and the negative sample pair corresponding to each initial sample are used for training a load prediction model. According to the invention, the method solves a problem that the prediction precision of the power load is not high, and achieves the effect of improving the prediction precision of the power load.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of power systems, and more specifically, to a method, device, storage medium and electronic device for processing training data. Background Art

[0002] In the operation and management of power systems, load forecasting is one of the core links and has an important impact on power dispatching, market transactions and system planning. Although related load forecasting methods, such as statistical models such as ARIMA and exponential smoothing, or deep learning models such as RNN and LSTM, can predict future load values ​​to a certain extent, they have limitations in dealing with the multi-periodicity and complex dynamic characteristics of power load data. Power load data not only exhibits periodic characteristics such as daily cycles and weekly cycles, but is also affected by non-periodic factors such as weather, holidays, and emergencies. These complex change patterns make the forecasting task extremely challenging.

[0003] In the related art, when predicting power load, it is usually impossible to effectively capture the multi-period characteristics of power load data and the local and global dynamic changes of data at different time scales, which leads to low accuracy in predicting power load. Summary of the invention

[0004] The embodiments of the present application provide a method, device, storage medium and electronic device for processing training data to at least solve the technical problem of low accuracy in predicting power load in related technologies.

[0005] According to one aspect of an embodiment of the present application, a method for processing training data is provided, including:

[0006] Acquire an initial sample set, wherein each initial sample in the initial sample set includes time series data of historical power load;

[0007] Performing period analysis on each of the initial samples to obtain a period component of each of the initial samples, wherein the period component of each of the initial samples includes N specified periods corresponding to each of the initial samples, where N is a positive integer greater than or equal to 2;

[0008] Based on the periodic components of each initial sample, construct a periodic matrix of each initial sample, wherein the periodic matrix of each initial sample includes load values ​​recorded at preset time points in N specified periods corresponding to each initial sample;

[0009] Performing feature extraction processing on the periodic matrix of each initial sample to obtain training features of each initial sample;

[0010] According to the training features of each initial sample, construct a positive sample pair corresponding to each initial sample and a negative sample pair corresponding to each initial sample, wherein the positive sample pair corresponding to each initial sample is constructed based on different periodic features in the training features of each initial sample, and the negative sample pair corresponding to each initial sample is constructed based on different periodic features in the training features of other initial samples except the initial sample;

[0011] The positive sample pairs corresponding to each of the initial samples and the negative sample pairs corresponding to each of the initial samples are used to train a load prediction model, and the load prediction model is a model for performing power load prediction.

[0012] According to another aspect of the embodiment of the present application, there is also provided a training data processing device, including:

[0013] An acquisition unit, configured to acquire an initial sample set, wherein each initial sample in the initial sample set includes time series data of historical power load;

[0014] A parsing unit, configured to perform period parsing on each of the initial samples to obtain a period component of each of the initial samples, wherein the period component of each of the initial samples includes N specified periods corresponding to each of the initial samples, where N is a positive integer greater than or equal to 2;

[0015] A first construction unit is configured to construct a period matrix of each initial sample based on the period component of each initial sample, wherein the period matrix of each initial sample includes load values ​​recorded at preset time points in N specified periods corresponding to each initial sample;

[0016] An extraction unit, used for performing feature extraction processing on the periodic matrix of each initial sample to obtain a training feature of each initial sample;

[0017] A second construction unit is used to construct a positive sample pair corresponding to each initial sample and a negative sample pair corresponding to each initial sample according to the training features of each initial sample, wherein the positive sample pair corresponding to each initial sample is constructed based on different periodic features in the training features of each initial sample, and the negative sample pair corresponding to each initial sample is constructed based on different periodic features in the training features of other initial samples except the initial sample;

[0018] The positive sample pairs corresponding to each of the initial samples and the negative sample pairs corresponding to each of the initial samples are used to train a load prediction model, and the load prediction model is a model for performing power load prediction.

[0019] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.

[0020] According to another aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in any of the above method embodiments.

[0021] According to another aspect of the embodiments of the present application, there is further provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the steps in any one of the above method embodiments through the computer program.

[0022] Through the present application, each initial sample is periodically analyzed to obtain the periodic components of each initial sample, wherein the periodic components of each initial sample include N specified periods corresponding to each initial sample, and N is a positive integer greater than or equal to 2; based on the periodic components of each initial sample, a periodic matrix of each initial sample is constructed, wherein the periodic matrix of each initial sample includes the load values ​​recorded at preset time points in the N specified periods corresponding to each initial sample. Through periodic analysis and periodic matrix construction, both short-term fluctuations and long-term trends of power load data can be captured simultaneously, thereby enhancing the ability to handle complex periodic changes. By performing feature extraction processing on the periodic matrix of each initial sample, the training features of each initial sample are obtained to construct a positive sample pair corresponding to each initial sample and a negative sample pair corresponding to each initial sample as the input of the load forecasting model. This can more accurately reflect the dynamic changes of the power load, thereby improving the prediction accuracy and stability, and solving the problem of low accuracy in predicting power load in related technologies. In addition, through periodic analysis and comparative learning, the multi-periodic information in the power load data can be more effectively captured and utilized, so that even when the sample data is limited, the generalization ability of the power load forecasting model can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 is a schematic diagram of an application scenario of a method for processing training data according to an embodiment of the present application;

[0024] Figure 2 is a flowchart of an optional training data processing method according to an embodiment of the present application;

[0025] Figure 3 is a schematic diagram of an optional feature extraction model according to an embodiment of the present application;

[0026] Figure 4 is a schematic diagram of an optional training data processing method according to an embodiment of the present application;

[0027] Figure 5 is a flowchart of another optional training data processing method according to an embodiment of the present application;

[0028] Figure 6 is a structural block diagram of an optional training data processing device according to an embodiment of the present application;

[0029] Figure 7 It is a block diagram of a computer system structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0030] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0032] According to one aspect of an embodiment of the present application, a method for processing training data is provided. Optionally, in this embodiment, the method for processing training data may be applied to, but is not limited to, Figure 1The hardware environment shown includes a terminal device 102 and a server 104. The server 104 can be connected to the terminal device 102 via a network, and can be used to provide services (e.g., application services, etc.) for the terminal device 102 or a client installed on the terminal device 102. A database can be set on the server 104 or independently of the server 104 to provide data storage services for the server 104.

[0033] The above network may include but is not limited to at least one of the following: wired network, wireless network. The above wired network may include but is not limited to at least one of the following: wide area network, metropolitan area network, local area network, and the above wireless network may include but is not limited to at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The terminal device 102 may be but is not limited to a PC (Personal Computer), a mobile phone, a tablet computer, etc. The server 104 may be but is not limited to a cloud server, a server cluster or other server types.

[0034] The training data processing method of the embodiment of the present application may be executed by the server 104, or by the terminal device 102, or by both the server 104 and the terminal device 102. The training data processing method of the embodiment of the present application may be executed by the terminal device 102 or by a client installed thereon.

[0035] Taking the method for processing training data in this embodiment executed by the terminal device 102 as an example, Figure 2 is a flowchart of an optional training data processing method according to an embodiment of the present application, such as Figure 2 As shown, the process of the method may include the following steps:

[0036] Step S202, obtaining an initial sample set, wherein each initial sample in the initial sample set includes time series data of historical power load;

[0037] Step S204, performing period analysis on each initial sample to obtain a period component of each initial sample, wherein the period component of each initial sample includes N specified periods corresponding to each initial sample, where N is a positive integer greater than or equal to 2;

[0038] Step S206, constructing a period matrix of each initial sample based on the period component of each initial sample, wherein the period matrix of each initial sample includes the load values ​​recorded at preset time points in N specified periods corresponding to each initial sample;

[0039] Step S208, performing feature extraction processing on the periodic matrix of each initial sample to obtain training features of each initial sample;

[0040] Step S210, based on the training features of each initial sample, construct a positive sample pair corresponding to each initial sample and a negative sample pair corresponding to each initial sample, wherein the positive sample pair corresponding to each initial sample is constructed based on different periodic features in the training features of each initial sample, and the negative sample pair corresponding to each initial sample is constructed based on different periodic features in the training features of other initial samples except the initial sample; wherein the positive sample pair corresponding to each initial sample and the negative sample pair corresponding to each initial sample are used to train a load prediction model, and the load prediction model is a model for performing power load prediction.

[0041] The training data processing method in this embodiment can be applied to the field of power systems, especially in the scenario of power load forecasting. Power load forecasting is the core link of power dispatching, market trading and system planning. It requires the model to accurately predict future power demand so that power companies can adjust power generation and transmission strategies in a timely manner to ensure the stable operation and economic efficiency of the power system. In power load forecasting, historical load data is the main input of the prediction model. These data usually exist in the form of time series, recording the changes in power demand over a period of time (such as the past few years).

[0042] In related technologies, power load forecasting methods, such as ARIMA and LSTM, are mainly based on one-dimensional time series data for forecasting. Although these methods perform well when processing load data with linear trends, they have limitations in capturing multi-periodic changes and nonlinear fluctuations. In particular, when dealing with the complex periodicity of power load data (such as daily, weekly, and seasonal changes), it is usually impossible to effectively capture the multi-periodic characteristics of power load data, as well as the local and global dynamic changes of data at different time scales. This leads to low accuracy in predicting power load.

[0043] In order to at least partially solve the above technical problems, in this embodiment, the multi-periodicity information of the power load data can be effectively extracted to construct positive and negative sample pairs. By constructing positive and negative sample pairs, the feature differences of the same sample in different periods and the feature differences between different samples can be learned, which helps the model to form a higher quality representation in the feature space, thereby improving the accuracy of power load prediction. In addition, through periodic analysis and contrastive learning, the multi-periodicity information in the power load data can be more effectively captured and utilized, so that even when the labeled data (i.e., sample data) is limited, the generalization ability of the load prediction model can be improved.

[0044] It should be noted that the initial sample set may include a group of initial samples, and each initial sample in a group of initial samples includes the time series data of historical power load. Among them, time series data, also known as time series data, is a sequence of data points recorded continuously over time, mainly including the power load value in a certain period of time in the past, usually recorded at time intervals of hours, days or longer. The time series data of historical power load provides the pattern and trend of load changes, which is the basis for training and verification of power load prediction models.

[0045] Optionally, cycle analysis refers to the process of identifying and separating different periodic components from the time series data of historical power load. In this embodiment, cycle analysis can be used to identify periodic patterns on different time scales. For example, different time scales such as daily cycle, weekly cycle, monthly cycle, etc. Cycle analysis can be used to construct a multi-cycle representation form.

[0046] The initial samples in the initial sample set are subjected to periodic analysis to obtain the periodic components of each initial sample. The periodic components may include N specified periods, where N is a positive integer greater than or equal to 2. Selecting N specified periods will focus on the periodic changes in at least two different time scales in the power load data, which helps the model capture the complex dynamic patterns of power demand.

[0047] The period matrix of each initial sample can be constructed based on the period component of each initial sample, wherein the period matrix of each initial sample includes the load value recorded at the preset time point in each initial sample in the N specified periods corresponding to each initial sample. The preset time point can be a time point at which data is recorded at a preset time interval, for example, if the load value is recorded once every hour, then the load values ​​corresponding to 24 time points are recorded for 24 hours.

[0048] The construction process of the period matrix is ​​the result of converting one-dimensional time series data into a two-dimensional form. The period matrix of each initial sample contains the load values ​​of the sample in different periods (such as days and weeks), arranged by time points. This conversion can more intuitively show the periodicity of the data, and this processing method can facilitate feature extraction.

[0049] Feature extraction refers to the process of extracting key information or features from raw data that are helpful for model learning and prediction. In this embodiment, the period matrix of each initial sample can be analyzed by a deep learning model to extract the feature vector of each initial sample at different periods, that is, the training features of each initial sample. Using the training features of each initial sample, construct positive and negative sample pairs corresponding to each initial sample, and the positive and negative sample pairs include positive sample pairs and negative sample pairs. Among them, the positive sample pairs corresponding to each initial sample are constructed based on the different period features in the training features of each initial sample, and the negative sample pairs corresponding to each initial sample are constructed based on the different period features in the training features of other initial samples other than the initial sample. That is, the positive sample pair refers to a vector pair from the same initial sample but with different period features, and the positive sample pair should be as close as possible in the feature space to reflect the intrinsic correlation of the data. The negative sample pair is a vector pair from different initial samples, and the negative sample pair should be as far away as possible in the feature space to distinguish the features of different samples. The positive sample pair and the negative sample pair can be used to optimize the feature representation of the model. For example, the initial sample set includes three initial samples (A, B, C). For the initial sample A in the initial sample set, the corresponding positive sample pair is constructed based on the different periodic features in the training features of the initial sample A, and the corresponding negative sample pair is constructed based on the different periodic features in the training features of the initial samples B and C.

[0050] The load forecasting model is a model used to predict electricity demand. The load forecasting model can be built based on statistical methods, machine learning or deep learning technology. Optionally, the load forecasting model can use a fully connected neural network, SVM, etc. The input of the load forecasting model is the training features obtained through contrastive learning optimization, and the model is trained to predict future power load values. In addition, during the training process of the load forecasting model, a preset loss function is used to guide the training, because the loss function defines the gap between the model prediction value and the true value, which guides the optimization direction of the model to minimize the prediction error. For load forecasting models based on contrastive learning, we usually combine contrastive learning loss and specific loss functions of the prediction task, such as mean squared error (MSE) or root mean square error (RMSE), to comprehensively evaluate the performance of the model.

[0051] Through the embodiments provided by the present application, each initial sample is periodically analyzed to obtain the periodic components of each initial sample, wherein the periodic components of each initial sample include N specified periods corresponding to each initial sample, and N is a positive integer greater than or equal to 2; based on the periodic components of each initial sample, a periodic matrix of each initial sample is constructed, wherein the periodic matrix of each initial sample includes the load values ​​recorded at preset time points in the N specified periods corresponding to each initial sample. Through periodic analysis and periodic matrix construction, both short-term fluctuations and long-term trends of power load data can be captured simultaneously, thereby enhancing the ability to handle complex periodic changes. By performing feature extraction processing on the periodic matrix of each initial sample, the training features of each initial sample are obtained to construct a positive sample pair corresponding to each initial sample and a negative sample pair corresponding to each initial sample as the input of the load forecasting model. This can more accurately reflect the dynamic changes of the power load, thereby improving the prediction accuracy and stability, and solving the problem of low accuracy in predicting power load in related technologies. In addition, through periodic analysis and comparative learning, the multi-periodic information in the power load data can be more effectively captured and utilized, so that even when the sample data is limited, the generalization ability of the power load forecasting model can be improved.

[0052] In an exemplary embodiment, step S204 includes: performing fast Fourier transform processing on each initial sample to obtain a frequency domain signal of each initial sample; performing amplitude calculation on the frequency domain signal of each initial sample to obtain amplitude information of each initial sample at different frequency components; determining N specified periods corresponding to each initial sample based on the amplitude information of each initial sample at different frequency components to obtain the periodic component of each initial sample, wherein the N specified periods corresponding to each initial sample include the periods corresponding to the largest first N frequencies in the amplitude information of each initial sample at different frequency components.

[0053] It should be noted that the fast Fourier transform (FFT) is an algorithm for converting a time domain signal into a frequency domain signal, and the frequency domain signal of each initial sample is obtained by performing a fast Fourier transform on each initial sample. That is, the time series data of the historical power load is converted into different frequency components, so as to analyze the periodic patterns in the load data.

[0054] The signal obtained after the time domain signal is converted by FFT shows the distribution of data at different frequencies. In this embodiment, the frequency domain signal can reveal the periodic components in the power load data, such as daily cycle, weekly cycle, etc.

[0055] Optionally, the frequency domain signal may include multiple frequency components and each of the multiple frequency components has its corresponding amplitude, which reflects the strength or importance of the frequency component in the original signal. Amplitude calculation is to convert the complex number representation of each frequency component of the frequency domain signal into the modulus length of its real part and imaginary part, that is, its amplitude.

[0056] The N specified periods corresponding to each initial sample include the periods corresponding to the largest first N frequencies in the amplitude information of different frequency components of each initial sample. N is a preset positive integer used to determine the number of most significant periods extracted from the frequency domain signal. In power load forecasting, the N specified periods usually include the most important periodic components in the load data, such as daily cycles, weekly cycles, monthly cycles, etc. These cycles are crucial to understanding the dynamic changes of the load.

[0057] The periodic component refers to the periodic variation pattern identified from the power load data. It is determined through FFT processing and amplitude analysis and can reflect the periodic characteristics of the load data on different time scales.

[0058] In one example, the time series data of the historical power load of each initial sample is subjected to FFT to extract the amplitude and phase of different frequency components corresponding to each initial sample. By analyzing the amplitude of each frequency component corresponding to each initial sample, the period corresponding to the largest first N frequencies in the amplitude information of different frequency components is selected as the designated period of the initial sample. Here, N is 2 for illustration, as shown in the following formulas (1) and (2):

[0059]

[0060] Where A represents the amplitude of each frequency component, T represents the input sequence length, that is, the length of the time series data of the historical power load in the initial sample, f1 and f2 are two specified periods, and p i Represents the period length corresponding to the i-th frequency component.

[0061] In general, the frequency components are selected to be within the range of half the length of the input sequence. When performing FFT, the length of the input sequence determines the frequency resolution, that is, the minimum frequency interval that can be distinguished. The longer the sequence length, the higher the frequency resolution, and the more precisely the periodic components in the signal can be captured. In power load forecasting, the frequency component at half the length of the input sequence usually corresponds to the highest frequency resolution of the signal, which can capture the changes in the shortest period. The frequency component at half the length of the input sequence can ensure that all reconstructible periodic components in the power load data are captured, while avoiding spectral aliasing.

[0062] The above formula (1) can be used to determine the largest first N frequencies in the amplitude information of different frequency components of the initial sample. The above formula (2) can be used to calculate the period corresponding to the selected frequency, and the calculated period length is rounded.

[0063] Through this embodiment, the main periodic components in the power load data can be accurately identified through FFT and amplitude analysis, providing higher quality training data for the power load forecasting model, thereby significantly improving the accuracy, efficiency and robustness of the power load forecasting.

[0064] In an exemplary embodiment, step S206 includes: periodically reconstructing each initial sample according to the periodic component of each initial sample to obtain N periodic subsequences corresponding to each initial sample; arranging the N periodic subsequences corresponding to each initial sample in chronological order to form a period matrix of N specified periods corresponding to each initial sample, wherein the period matrix of each initial sample includes the period matrix of N specified periods corresponding to each initial sample.

[0065] It should be noted that in the scenario of power load forecasting, the initial sample can be the power load data within a specific time period. The periodic component refers to the time periodic characteristics existing in the power load data, such as daily cycle, weekly cycle, seasonal cycle, etc. These components can be extracted from the original data by fast Fourier transform (FFT) or similar methods.

[0066] Periodic reconstruction refers to the process of converting the periodic components in a one-dimensional time series into a two-dimensional matrix. In this process, each periodic component is extracted separately and constructed into a two-dimensional subsequence, namely a periodic subsequence. This conversion process helps to better understand and learn the periodic change patterns in the data, especially when the data contains multiple interlaced periodic patterns. Periodic subsequences are sequence data extracted from the original time series based on specific periodic components and are closely related to the periodic components. In power load forecasting, these periodic subsequences may represent load changes within a specified period, such as load fluctuations within a day or load change patterns within a week.

[0067] The period matrix is ​​a two-dimensional tensor formed by arranging all periodic subsequences related to a certain initial sample in chronological order. Each period matrix corresponds to a specific period, such as a daily period matrix, a weekly period matrix, etc., which can integrate periodic information on different time scales and provide more structured input data for subsequent comparative learning. For example, if the time series data of the historical power load in the initial sample is 24 hours of time series data and the corresponding two specified periods are 4 hours or 8 hours, the corresponding period matrices are 6 times 4 matrices (i.e., a matrix with 6 rows and 4 columns) and 3 times 8 matrices (i.e., a matrix with 3 rows and 8 columns).

[0068] In one example, for example, the initial sample is a power load time series containing 1,000 time points, and the goal is to identify and use daily cycles (cycle length is 24 hours) and weekly cycles (cycle length is 168 hours) to predict the load.

[0069] First, an FFT is performed on the initial samples to identify significant frequency components. Assume that the daily and weekly frequencies are determined, corresponding to cycle lengths of 24 hours and 168 hours, respectively.

[0070] The original time series is periodically reconstructed based on these two cycle lengths. For the daily cycle, the original time series will be decomposed into 41 (i.e., 1000 / 24 ​​rounded up) periodic subsequences of length 24; for the weekly cycle, it will be decomposed into 6 (i.e., 1000 / 168 rounded up) periodic subsequences of length 168.

[0071] Then, these periodic subsequences are arranged in chronological order to form two period matrices. The daily period matrix will contain 41 rows, each row representing the load change of one day; the weekly period matrix will contain 6 rows, each row representing the load change of one week.

[0072] Specifically, when the number of specified cycles is 2, the process of constructing the specified cycle of the initial sample can be described by the following formula (3) and formula (4):

[0073] X 1D ∈R T×1 ; (3)

[0074]

[0075] Padding is the expansion of the one-dimensional data of the initial sample according to the time dimension to make it consistent with compatible. pi (i.e., specifying the period length) and f i (i.e., frequency) respectively represent the number of rows and columns of the changed two-dimensional tensor, Represents frequency f iThe matrix is ​​composed of two-dimensional time series of , whose columns and rows represent the intra-cycle change and inter-cycle change under the corresponding specified period length respectively. i is the i-th specified period.

[0076] Through this embodiment, the periodic components in the power load data are converted into a periodic matrix, which can convert the one-dimensional time series into a two-dimensional structure, so that the model can understand and learn the periodic pattern, especially when processing multi-period data. This conversion method can significantly improve the prediction accuracy of the model. In addition, the use of the periodic matrix can construct more discriminative positive and negative sample pairs. The positive sample pair is a feature representation of the same time series in different periods. The positive sample pair is correlated in time but different in frequency; while the negative sample pair is a feature representation of different time series. The negative sample pair is not correlated in time and frequency. The construction of this sample pair helps the model learn the intrinsic connection between different periodic characteristics in the power load data, so that it can better integrate short-term fluctuations and long-term trends during prediction, and improve the prediction accuracy and generalization ability of the model.

[0077] In an exemplary embodiment, the feature extraction processing of the periodic matrix of each initial sample is performed based on a feature extraction model, wherein the feature extraction model includes at least two convolution modules and at least one fully connected module; the at least two convolution modules and the at least one fully connected module are connected in sequence;

[0078] Step S208 includes: inputting the periodic matrix of each initial sample into the feature extraction model, so that the feature extraction model performs the following processing operations on the periodic matrix of each initial sample: extracting features from the periodic matrix of each initial sample through at least two convolution modules to obtain a set of preliminary training features corresponding to each initial sample; integrating and connecting the set of preliminary training features corresponding to each initial sample through at least one fully connected module to obtain the training features of each initial sample, wherein the training features of each initial sample are used to represent the changing trend of the data in the initial sample within different specified periods.

[0079] It should be noted that the feature extraction model is a deep learning model used to extract key features from data that are helpful for prediction. In this embodiment, the feature extraction model can be a model that maps the original input to the representation space. The feature extraction model includes at least two convolution modules and at least one fully connected module. The convolution module is mainly used to capture local and temporal features in the data, while the fully connected module is used to integrate these features to form a global representation of the entire sample. The convolution operation can identify specific patterns or features in the input data. For example, in power load forecasting, it can capture fluctuations and trends within a specific period. The fully connected module is used in the feature extraction model to integrate and connect the output features of each convolution module to form a more compact vector representation. Through the fully connected layer, the model can learn the relationships and dependencies between features of different periods.

[0080] Optionally, in this embodiment, a convolutional neural network (CNN) may be used as a feature extraction model to extract local features.

[0081] Through this embodiment, by performing convolution and full connection processing on the multi-period matrix of power load data, a more distinguishing and informative feature representation can be extracted from the time series data. The convolution module helps to capture local time series patterns, while the full connection module can integrate these local time series patterns into a global feature representation, thereby reflecting the changing trend of power load in different cycles, which not only contains information on short-term fluctuations, but also integrates data on long-term trends, which can significantly improve the accuracy and generalization ability of the power load forecasting model.

[0082] In an exemplary embodiment, each of the at least two convolution modules includes a convolution layer, an activation function layer, and a pooling layer; through the at least two convolution modules, feature extraction is performed on the periodic matrix of each initial sample to obtain a set of preliminary training features corresponding to each initial sample, including:

[0083] In each of the at least two convolution modules, a convolution operation is performed on the input features of each convolution module through the convolution layer of each convolution module, wherein, in the at least two convolution modules, the input features of the first convolution module are the periodic matrix of each initial sample, and the input features of the other convolution modules except the first convolution module are the output features of the previous convolution modules of the other convolution modules; through the activation function layer of each convolution module and the pooling layer of each convolution module, the output features of the convolution layer of each convolution module are subjected to nonlinear transformation processing and pooling operation processing to obtain a set of preliminary training features corresponding to each initial sample.

[0084] It should be noted that if Figure 3 As shown, Figure 3It is a schematic diagram of an optional feature extraction model of an embodiment of the present application, and the feature extraction model may include at least two convolution modules and at least one fully connected module, wherein each convolution module may include a convolution layer, an activation function layer and a pooling layer, and at least one fully connected module may include at least two fully connected layers. The convolution layer is a core component in a convolutional neural network (CNN), which slides on the input data through its internal convolution kernel (also called a filter) to detect and extract local features. The activation function layer is used to introduce nonlinear transformations into the neural network to address the limitations of linear models. Common activation functions include ReLU (Rectified Linear Unit), sigmoid, tanh, etc. In the feature extraction model, the activation function layer is usually connected after the convolution layer to enhance the learning ability and feature expression ability of the model. The pooling layer is mainly used to reduce the spatial dimension of the data, reduce the amount of calculation, and enhance the robustness and generalization ability of the model. Common pooling operations include maximum pooling and average pooling. Through the pooling operation, the model can ignore the noise and unimportant details in the input data to a certain extent and focus on more critical feature information.

[0085] Specifically, the period matrix of each initial sample is used as the input of the feature extraction model, and the training features of the initial sample under the specified period are output. When there are two specified periods corresponding to the initial sample, it means that for each initial sample, two feature extraction operations need to be performed. Specifically, refer to Figure 4 , Figure 4 It is a schematic diagram of an optional training data processing method of an embodiment of the present application. Among them, each initial sample requires two specified periods for example. First, the initial sample is periodically parsed to obtain two specified periods (i.e., specified period 1 and specified period 2). For each specified period, a two-dimensional data conversion is performed to obtain a period matrix of the initial sample under the specified period. The period matrix of the initial sample under the specified period is input into the feature extraction model for two-dimensional feature extraction to obtain a feature vector (i.e., training feature). Then, each initial sample corresponds to two training features under the specified period.

[0086] Through this embodiment, the use of at least two convolution modules for feature extraction can capture the periodic patterns in the power load data from multiple scales, which helps the model to consider both short-term fluctuations and long-term trends when predicting, significantly improving the accuracy of power load prediction. At the same time, the application of activation function layers and pooling layers ensures that the model can learn nonlinear feature relationships, so that it can still maintain good prediction performance when facing complex and noisy data.

[0087] In an exemplary embodiment, step S202 includes: obtaining historical data, wherein the historical data includes historical load values ​​and historical record times; performing outlier processing and missing value processing on the historical data to obtain preliminary historical time series data; performing random sampling processing on the historical time series data to obtain an initial sample set.

[0088] It should be noted that the historical data may be time series data of power load, including historical load values ​​and historical record times. This historical data covers a sufficiently long period of time to ensure that the model can learn load patterns in different seasons, weekdays and holidays.

[0089] Outliers are observations in a data set that differ significantly from other data points, which may be caused by measurement errors, equipment failures, or extreme events. In power load forecasting, outlier handling typically involves detecting and removing or correcting these abnormal load values ​​to avoid negative impacts on model training. Missing values ​​are missing records at certain points in time in a data set. In power load data, this may be caused by equipment failures, communication interruptions, or data recording errors. Optionally, missing value handling typically involves filling in these missing load records, which can be done by interpolation, predicting missing values ​​based on the average of adjacent data points, or machine learning models.

[0090] Random sampling refers to the process of randomly selecting a portion of data from preliminary historical time series data to form an initial sample set. This helps ensure the representativeness of the training data, avoids overfitting the model to a specific load pattern, and thus improves the generalization ability of the model.

[0091] Through this embodiment, the generation of preliminary historical time series data ensures that the model can be trained based on more accurate data, thereby improving the accuracy of prediction. Random sampling processing helps to build a diverse and representative sample set, which not only increases the efficiency of model training, but also ensures that the model can be effectively generalized to unseen data, thereby improving the prediction performance and robustness of the model.

[0092] In an exemplary embodiment, the method further comprises:

[0093] In the process of training the load forecasting model, the loss value corresponding to each initial sample is calculated through the positive sample pair of each initial sample, the negative sample pair of each initial sample and the preset contrast learning loss function, wherein the loss value corresponding to each initial sample is used to indicate the update of the model parameters of the load forecasting model.

[0094] It should be noted that in the training of the power load forecasting model based on contrastive learning, positive sample pairs usually refer to feature representations extracted from the same power load time series at different periods. These feature representations are temporally correlated, but because they come from different periods of the same sequence, they differ in frequency. The construction of positive sample pairs is based on the "similarity" principle in the contrastive learning strategy, that is, samples from the same source should be more similar in their representation space. Negative sample pairs usually refer to feature representations from different time series, which are unrelated in time and frequency. In contrastive learning, negative sample pairs are used for "contrast", that is, they should be as dissimilar as possible in the representation space. By comparing positive and negative samples, the model can learn the ability to distinguish samples from different sequences, while capturing and utilizing the inherent periodic patterns of each sequence.

[0095] The preset contrastive learning loss function can prompt the model to optimize the feature representation so that the positive sample pairs are close to each other in the feature space, while the negative sample pairs remain distant. Common contrastive learning loss functions include contrastive loss (ContrastiveLoss), NT-Xent loss (Normalized Temperature-scaled Cross Entropy Loss), etc. These functions help the model learn the discriminative multi-cycle features in power load data.

[0096] In the process of training the load forecasting model, for each input initial sample (i.e., a specific time series of power load data), a loss value is calculated based on the contrastive learning loss function. This loss value reflects the rationality of the relative positions of the positive sample pairs and the negative sample pairs in the feature space under the current parameter configuration of the load forecasting model. The goal of optimizing this loss value is to enable the load forecasting model to more accurately learn the periodic changes and trends in the power load data.

[0097] In one example, n initial samples can be randomly sampled from preliminary historical time series data, denoted as {X i}, i = 1, ..., n. After periodic decomposition and two-dimensional feature extraction, each initial sample will obtain 2n training features. Assume that for the initial sample X, the vector representations obtained after periodic decomposition and two-dimensional feature extraction are h i and h j , then the corresponding h i With h j is a positive sample pair, and the other 2n-2 samples constitute a negative sample pair.

[0098] Optionally, when training the load forecasting model, the formula of the preset contrastive learning loss function used is as follows:

[0099]

[0100] in, is the loss of a pair of positive samples. The loss function requires that the similarity between positive samples is as large as possible, while the similarity with other samples (negative samples) is as small as possible. τ is the temperature coefficient hyperparameter, which is set based on experience. The final total loss is composed of all positive pairs (i, j) and (j, i). k≠i is the indicative function, and k is the kth element in the 2n training features.

[0101] Through this embodiment, based on the contrastive learning training strategy, the load forecasting model can more effectively learn the complex changes and potential periodic patterns of different periods in the power data. The construction of positive sample pairs and negative sample pairs, and the application of the contrastive learning loss function, force the load forecasting model to form a more refined and accurate representation in the feature space, which helps the load forecasting model to more accurately capture the short-term fluctuations and long-term trends of the power load in the forecasting link, thereby significantly improving the prediction accuracy of the model.

[0102] The following is an explanation of the method for processing training data in the embodiments of the present application in conjunction with optional examples.

[0103] Figure 5 is a flowchart of another optional training data processing method in this optional example, such as Figure 5 As shown, the process of the training data processing method may include the following steps:

[0104] Step S502: data preparation.

[0105] Specifically, historical data is obtained, outlier processing and missing value processing are performed on the historical data to obtain preliminary historical time series data; random sampling is performed on the historical time series data to obtain an initial sample set, wherein the initial sample set includes a group of initial samples.

[0106] Step S504, cycle decomposition.

[0107] Specifically, the time series data is transformed into the frequency domain using the Fast Fourier Transform (FFT) to extract the amplitude and phase of different frequency components. The most significant period is determined by analyzing the amplitude of each frequency component.

[0108] Step S506: two-dimensional time series conversion.

[0109] Specifically, the period matrix is ​​converted into a two-dimensional tensor, which is the feature representation of each period.

[0110] Step S508: two-dimensional feature extraction.

[0111] Specifically, the two-dimensional time series data is input into the feature extraction model, which contains at least two convolutional modules and one fully connected module. Each convolutional module extracts the features of the periodic matrix through a convolutional layer, an activation function layer (such as ReLU) and a pooling layer (such as MaxPooling), and outputs preliminary training features. All preliminary training features are integrated using the fully connected module to form the final training features.

[0112] Step S510: constructing positive and negative sample pairs.

[0113] Step S512: model training.

[0114] Specifically, the preset contrastive learning loss function is used to maximize the similarity between positive sample pairs and minimize the similarity between negative sample pairs. In each training iteration, positive and negative sample pairs are input, the loss is calculated, and the model parameters are updated until the model achieves the desired prediction performance.

[0115] Step S514: Use the trained load forecasting model to perform forecasting.

[0116] For example, the power load data for the forecast day is input into the trained model, and the model uses the learned periodic features and comparative learning strategy to output the load value for the forecast day. This forecast result is based on the multi-period change trend and local fluctuation pattern captured in the historical data, and has a high forecast accuracy.

[0117] Through this optional example, through periodic analysis and periodic matrix construction, it is possible to capture both short-term fluctuations and long-term trends of power load data, and enhance the ability to handle complex periodic changes. By performing feature extraction processing on the periodic matrix of each initial sample, the training features of each initial sample are obtained to construct a positive sample pair corresponding to each initial sample and a negative sample pair corresponding to each initial sample as the input of the load forecasting model, which can more accurately reflect the dynamic changes of the power load, thereby improving the prediction accuracy and stability, and solving the problem of low accuracy in predicting power load in related technologies. In addition, through periodic analysis and comparative learning, it is possible to more effectively capture and utilize multi-periodic information in power load data, so that even when sample data is limited, the generalization ability of the power load forecasting model can be improved.

[0118] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0119] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM (Read-Only Memory) / RAM (Random Access Memory), a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0120] According to another aspect of the embodiments of the present application, a training data processing device is also provided, which can be used to implement the training data processing method provided in the above embodiments, which has been described and will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0121] Figure 6 is a structural block diagram of an optional training data processing device according to an embodiment of the present application, such as Figure 6 As shown in , the training data processing device includes:

[0122] An acquisition unit 602 is used to acquire an initial sample set, wherein each initial sample in the initial sample set includes time series data of historical power load;

[0123] The parsing unit 604 is used to perform period parsing on each initial sample to obtain a period component of each initial sample, wherein the period component of each initial sample includes N specified periods corresponding to each initial sample, where N is a positive integer greater than or equal to 2;

[0124] A first construction unit 606 is used to construct a period matrix of each initial sample based on the period component of each initial sample, wherein the period matrix of each initial sample includes load values ​​recorded at preset time points in N specified periods corresponding to each initial sample;

[0125] An extraction unit 608 is used to perform feature extraction processing on the periodic matrix of each initial sample to obtain a training feature of each initial sample;

[0126] A second construction unit 610 is used to construct a positive sample pair corresponding to each initial sample and a negative sample pair corresponding to each initial sample according to the training features of each initial sample, wherein the positive sample pair corresponding to each initial sample is constructed based on different periodic features in the training features of each initial sample, and the negative sample pair corresponding to each initial sample is constructed based on different periodic features in the training features of other initial samples except the initial sample;

[0127] The positive sample pairs corresponding to each initial sample and the negative sample pairs corresponding to each initial sample are used to train a load prediction model, and the load prediction model is a model used to perform power load prediction.

[0128] It should be noted that the acquisition unit 602 in this embodiment can be used to execute the above step S202, the parsing unit 604 in this embodiment can be used to execute the above step S204, the first construction unit 606 in this embodiment can be used to execute the above step S206, the extraction unit 608 in this embodiment can be used to execute the above step S208, and the second construction unit 610 in this embodiment can be used to execute the above step S210.

[0129] Through the embodiments provided by the present application, each initial sample is periodically analyzed to obtain the periodic components of each initial sample, wherein the periodic components of each initial sample include N specified periods corresponding to each initial sample, and N is a positive integer greater than or equal to 2; based on the periodic components of each initial sample, a periodic matrix of each initial sample is constructed, wherein the periodic matrix of each initial sample includes the load values ​​recorded at preset time points in the N specified periods corresponding to each initial sample. Through periodic analysis and periodic matrix construction, both short-term fluctuations and long-term trends of power load data can be captured simultaneously, thereby enhancing the ability to handle complex periodic changes. By performing feature extraction processing on the periodic matrix of each initial sample, the training features of each initial sample are obtained to construct a positive sample pair corresponding to each initial sample and a negative sample pair corresponding to each initial sample as the input of the load forecasting model. This can more accurately reflect the dynamic changes of the power load, thereby improving the prediction accuracy and stability, and solving the problem of low accuracy in predicting power load in related technologies. In addition, through periodic analysis and comparative learning, the multi-periodic information in the power load data can be more effectively captured and utilized, so that even when the sample data is limited, the generalization ability of the power load forecasting model can be improved.

[0130] In an exemplary embodiment, the analysis unit 604 is also used to perform fast Fourier transform processing on each initial sample to obtain a frequency domain signal of each initial sample; perform amplitude calculation on the frequency domain signal of each initial sample to obtain amplitude information of each initial sample at different frequency components; determine N specified periods corresponding to each initial sample based on the amplitude information of each initial sample at different frequency components to obtain the periodic component of each initial sample, wherein the N specified periods corresponding to each initial sample include the periods corresponding to the largest first N frequencies in the amplitude information of each initial sample at different frequency components.

[0131] In an exemplary embodiment, the first construction unit 606 is further used to: perform periodic reconstruction on each initial sample according to the periodic component of each initial sample to obtain N periodic subsequences corresponding to each initial sample;

[0132] The N periodic subsequences corresponding to each initial sample are arranged in time order to form a period matrix of N specified periods corresponding to each initial sample, wherein the period matrix of each initial sample includes the period matrix of N specified periods corresponding to each initial sample.

[0133] In an exemplary embodiment, the feature extraction processing of the periodic matrix of each initial sample is performed based on a feature extraction model, wherein the feature extraction model includes at least two convolution modules and at least one fully connected module; the at least two convolution modules and the at least one fully connected module are connected in sequence; the extraction unit 608 is further used to: input the periodic matrix of each initial sample into the feature extraction model, so that the feature extraction model performs the following processing operations on the periodic matrix of each initial sample:

[0134] The periodic matrix of each initial sample is subjected to feature extraction through at least two convolution modules to obtain a set of preliminary training features corresponding to each initial sample; the set of preliminary training features corresponding to each initial sample is integrated and connected through at least one fully connected module to obtain the training features of each initial sample, wherein the training features of each initial sample are used to represent the changing trend of the data in the initial sample within different specified periods.

[0135] In an exemplary embodiment, each of the at least two convolution modules includes a convolution layer, an activation function layer, and a pooling layer;

[0136] The extraction unit 608 is also used for: in each of the at least two convolution modules, performing a convolution operation on the input features of each convolution module through the convolution layer of each convolution module, wherein, in the at least two convolution modules, the input features of the first convolution module are the periodic matrix of each initial sample, and the input features of the other convolution modules except the first convolution module are the output features of the previous convolution modules of the other convolution modules; through the activation function layer of each convolution module and the pooling layer of each convolution module, performing nonlinear transformation processing and pooling operation processing on the output features of the convolution layer of each convolution module to obtain a set of preliminary training features corresponding to each initial sample.

[0137] In an exemplary embodiment, the acquisition unit 602 is also used to: acquire historical data, wherein the historical data includes historical load values ​​and historical record times; perform outlier processing and missing value processing on the historical data to obtain preliminary historical time series data; perform random sampling processing on the historical time series data to obtain an initial sample set.

[0138] In an exemplary embodiment, the training data processing device also includes: a calculation unit, which is used to calculate the loss value corresponding to each initial sample through the positive sample pair of each initial sample, the negative sample pair of each initial sample and the preset contrast learning loss function during the training of the load forecasting model, wherein the loss value corresponding to each initial sample is used to indicate the update of the model parameters of the load forecasting model.

[0139] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0140] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein the steps of any of the above method embodiments are executed when the program is run.

[0141] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, a ROM, a RAM, a mobile hard disk, a magnetic disk, or an optical disk.

[0142] According to another aspect of the embodiments of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor is configured to execute the steps in any of the above method embodiments through the computer program. In an exemplary embodiment, the electronic device may further comprise a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0143] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0144] According to another aspect of the embodiment of the present application, a computer program product is also provided, which includes a computer program / instruction, and the computer program / instruction contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit 701, various functions provided by the embodiment of the present application are executed. The above-mentioned serial numbers of the embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments.

[0145] Figure 7 The computer system structure block diagram of the electronic device used to implement the embodiment of the present application is schematically shown. Figure 7 As shown, the computer system 700 includes a CPU (Central Processing Unit) 701, which can perform various appropriate actions and processes according to the program stored in the ROM 702 or the program loaded from the storage part 708 to the RAM 703. Various programs and data required for system operation are also stored in the random access memory 703. The central processing unit 701, the read-only memory 702 and the random access memory 703 are connected to each other through a bus 704. An I / O (Input / Output) interface 705 is also connected to the bus 704.

[0146] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a CRT (Cathode Ray Tube), an LCD (Liquid Crystal Display), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the input / output interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed so that a computer program read therefrom is installed into the storage section 708 as needed.

[0147] In particular, according to an embodiment of the present application, the process described in each method flow chart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program contains a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processor 701, various functions defined in the system of the present application are executed.

[0148] It should be noted that Figure 7 The computer system 700 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0149] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0150] The above are only preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for processing training data, characterized in that: include: An initial sample set is obtained, wherein each initial sample in the initial sample set includes time series data of historical power load: Performing period analysis on each of the initial samples to obtain a period component of each of the initial samples, wherein the period component of each of the initial samples includes N specified periods corresponding to each of the initial samples, where N is a positive integer greater than or equal to 2; Based on the periodic components of each initial sample, construct a periodic matrix of each initial sample, wherein the periodic matrix of each initial sample includes load values ​​recorded at preset time points in N specified periods corresponding to each initial sample; Performing feature extraction processing on the periodic matrix of each initial sample to obtain training features of each initial sample; According to the training features of each initial sample, construct a positive sample pair corresponding to each initial sample and a negative sample pair corresponding to each initial sample, wherein the positive sample pair corresponding to each initial sample is constructed based on different periodic features in the training features of each initial sample, and the negative sample pair corresponding to each initial sample is constructed based on different periodic features in the training features of other initial samples except the initial sample; The positive sample pairs corresponding to each of the initial samples and the negative sample pairs corresponding to each of the initial samples are used to train a load prediction model, and the load prediction model is a model for performing power load prediction.

2. The method according to claim 1, characterized in that The performing periodic analysis on each of the initial samples to obtain the periodic component of each of the initial samples includes: Performing fast Fourier transform processing on each of the initial samples to obtain a frequency domain signal of each of the initial samples; Performing amplitude calculation on the frequency domain signal of each initial sample to obtain amplitude information of each initial sample at different frequency components; According to the amplitude information of each initial sample at different frequency components, N specified periods corresponding to each initial sample are determined to obtain the periodic component of each initial sample, wherein the N specified periods corresponding to each initial sample include the periods corresponding to the largest first N frequencies in the amplitude information of each initial sample at different frequency components.

3. The method according to claim 2, characterized in that The step of constructing a periodic matrix of each initial sample based on the periodic component of each initial sample comprises: According to the periodic component of each initial sample, periodically reconstruct each initial sample to obtain N periodic subsequences corresponding to each initial sample; The N periodic subsequences corresponding to each of the initial samples are arranged in time order to form a period matrix of N specified periods corresponding to each of the initial samples, wherein the period matrix of each of the initial samples includes the period matrix of N specified periods corresponding to each of the initial samples.

4. The method according to claim 1, characterized in that The feature extraction processing of the periodic matrix of each initial sample is performed based on a feature extraction model, wherein the feature extraction model includes at least two convolution modules and at least one fully connected module; the at least two convolution modules and the at least one fully connected module are connected in sequence; The step of performing feature extraction processing on the periodic matrix of each initial sample to obtain the training features of each initial sample includes: The periodic matrix of each initial sample is input into the feature extraction model, so that the feature extraction model performs the following processing operations on the periodic matrix of each initial sample: Performing feature extraction on the periodic matrix of each initial sample through the at least two convolution modules to obtain a set of preliminary training features corresponding to each initial sample; A set of preliminary training features corresponding to each initial sample is integrated and connected through the at least one fully connected module to obtain the training features of each initial sample, wherein the training features of each initial sample are used to represent the changing trend of the data in the initial sample within different specified periods.

5. The method according to claim 4, characterized in that Each of the at least two convolution modules comprises a convolution layer, an activation function layer and a pooling layer; The step of extracting features from the periodic matrix of each initial sample by using the at least two convolution modules to obtain a set of preliminary training features corresponding to each initial sample includes: In each of the at least two convolution modules, a convolution operation is performed on the input features of each convolution module through the convolution layer of each convolution module, wherein, among the at least two convolution modules, the input features of the first convolution module are the periodic matrix of each initial sample, and the input features of the other convolution modules except the first convolution module are the output features of the previous convolution modules of the other convolution modules; Through the activation function layer of each convolution module and the pooling layer of each convolution module, the output features of the convolution layer of each convolution module are processed by nonlinear transformation and pooling operation to obtain a set of preliminary training features corresponding to each initial sample.

6. The method according to claim 1, characterized in that The obtaining of the initial sample set comprises: Acquiring historical data, wherein the historical data includes historical load values ​​and historical record times; Perform outlier processing and missing value processing on the historical data to obtain preliminary historical time series data; The historical time series data is randomly sampled to obtain the initial sample set.

7. The method according to claim 1, characterized in that The method further comprises: During the training of the load forecasting model, the loss value corresponding to each initial sample is calculated through the positive sample pair of each initial sample, the negative sample pair of each initial sample and the preset contrast learning loss function, wherein the loss value corresponding to each initial sample is used to indicate the update of the model parameters of the load forecasting model.

8. A training data processing device, characterized in that: include: An acquisition unit, configured to acquire an initial sample set, wherein each initial sample in the initial sample set includes time series data of historical power load; A parsing unit, configured to perform period parsing on each of the initial samples to obtain a period component of each of the initial samples, wherein the period component of each of the initial samples includes N specified periods corresponding to each of the initial samples, where N is a positive integer greater than or equal to 2; A first construction unit is configured to construct a period matrix of each initial sample based on the period component of each initial sample, wherein the period matrix of each initial sample includes load values ​​recorded at preset time points in N specified periods corresponding to each initial sample; An extraction unit, used for performing feature extraction processing on the periodic matrix of each initial sample to obtain a training feature of each initial sample; A second construction unit is used to construct a positive sample pair corresponding to each initial sample and a negative sample pair corresponding to each initial sample according to the training features of each initial sample, wherein the positive sample pair corresponding to each initial sample is constructed based on different periodic features in the training features of each initial sample, and the negative sample pair corresponding to each initial sample is constructed based on different periodic features in the training features of other initial samples except the initial sample; The positive sample pairs corresponding to each of the initial samples and the negative sample pairs corresponding to each of the initial samples are used to train a load prediction model, and the load prediction model is a model for performing power load prediction.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of any one of the methods of claims 1 to 7 when executed by a processor.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.