Model training method, electric load prediction method, equipment and storage medium
By extracting the local and global characteristics of the electric load data, and integrating meteorological, date and economic data, and using deep learning network to generate electric load prediction data, the problem of insufficient accuracy and robustness of electric load prediction in the existing technology is solved, and a higher precision electric load prediction is achieved.
Patent Information
- Application Number
- CN202510849439.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-24
- Publication Date
- 2025-07-22
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing deep learning-based electric load prediction methods have problems of low prediction accuracy and low robustness in dealing with different users and variable external environments.
By extracting the local and global dependency characteristics of the sample electrical load data, we integrate meteorological data, date data and economic data, and use the nonlinear timing prediction network and the linear timing prediction network to generate electrical load prediction data, and optimize the prediction accuracy through iterative training model.
It improves the prediction accuracy and robustness of the electric load prediction model, can adapt to electric load prediction scenarios with changes in various external factors, and provides accurate electric load prediction data.
Smart Images

Figure CN120354380A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a model training method, an electric load prediction method, a device and a storage medium. Background Art
[0002] With the continuous development of the power market, more and more power generation methods have gradually been connected to the power system, putting certain pressure on the calculation of the electricity load in the power grid. Therefore, accurate electric load prediction can enable the power grid to operate more stably and safely, and play an important role in the power division in the power grid.
[0003] In the related art, there is an electric load prediction method based on deep learning, which obtains corresponding electric load prediction results through means such as segmented processing, local feature extraction, input attention mechanism, and meteorological data fusion. However, the current electric load prediction method based on deep learning still has many limitations, and has defects of low prediction accuracy and low robustness when dealing with different users and changing external environments. Summary of the Invention
[0004] The purpose of the present application is to provide a model training method, an electric load prediction method, a device and a storage medium, aiming to improve the prediction accuracy and robustness of the electric load prediction model.
[0005] An embodiment of the present application provides a model training method, including: Obtaining sample electric load data, sample meteorological data, sample date data, and sample economic data; Extracting local features and global dependency features of the sample electric load data to obtain sample electric load feature data; Fusing the sample meteorological data, the sample date data, the sample economic data, and the sample electric load feature data to obtain sample fusion data; Inputting the sample fusion data into a model to be trained to generate sample electric load prediction data; Iteratively training the model to be trained according to the sample electric load prediction data and preset real electric load data to obtain an electric load prediction model.
[0006] In some embodiments, before the extracting local features and global dependency features of the sample electric load data, it further includes: Performing data cleaning, normalization, feature encoding, and difference processing on the sample electric load data, the sample meteorological data, the sample date data, and the sample economic data to obtain preprocessed sample electric load data, sample meteorological data, sample date data, and sample economic data.
[0007] In some embodiments, extracting the local features and global dependency features of the sample electrical load data includes: Dividing the sample electrical load data into multiple sample electrical load segment data; Performing a continuous convolution operation on the sample electrical load segment data to obtain sample local feature data; Based on the multi-head self-attention mechanism, performing self-attention operation on the sample local feature data to obtain sample global dependency feature data; Concatenating the sample local feature data and the sample global dependency feature data to obtain the sample electrical load feature data.
[0008] In some embodiments, dividing the sample electrical load data into multiple sample electrical load segment data includes: Dividing the sample electrical load data into multiple sample initial segment data with arbitrary lengths; Extracting the temporal fluctuation features of the sample initial segment data to determine the sample fluctuation data points in the sample initial segment data that meet the preset data fluctuation conditions; Re-dividing the sample electrical load data according to the sample fluctuation data points to obtain multiple sample electrical load segment data.
[0009] In some embodiments, fusing the sample meteorological data, the sample date data, the sample economic data, and the sample electrical load feature data includes: Performing gated fusion on each of the sample meteorological data, the sample date data, the sample economic data, and the sample electrical load feature data respectively to obtain sample gated fusion data; Generating a query vector from the sample gated fusion data of the sample electrical load feature data, and generating a key vector and a value vector from the concatenated data of the sample gated fusion data of the sample meteorological data, the sample date data, and the sample economic data, and performing cross-attention fusion to obtain sample attention fusion data; Concatenating the sample gated fusion data of the sample electrical load feature data and the sample attention fusion data to obtain the sample fusion data.
[0010] In some embodiments, the model to be trained includes a non-linear time series prediction network and a linear time series prediction network. Inputting the sample fusion data into the model to be trained to generate sample electrical load prediction data includes: Based on the non-linear time series prediction network, extracting the non-linear time series features in the sample fusion data to obtain sample non-linear time series feature data; Based on the linear time series prediction network, extract the linear time series features in the sample fusion data to obtain sample linear time series feature data; Fuse the sample non-linear time series feature data and the sample linear time series feature data to obtain the sample electric load prediction data.
[0011] In some embodiments, the iterative training of the model to be trained based on the sample electric load prediction data and the preset real electric load data includes: Determine the model loss information corresponding to the sample electric load prediction data; the model loss information characterizes the deviation between the sample electric load prediction data and the real electric load data; Iteratively adjust the network parameters in the model to be trained according to the model loss information until the training end condition is met, and obtain the electric load prediction model.
[0012] An embodiment of the present application further provides an electric load prediction method, including: Obtain electric load data, meteorological data, date data, and economic data; Extract the local features and global dependence features of the electric load data to obtain electric load feature data; Fuse the meteorological data, the date data, the economic data, and the electric load feature data to obtain fusion data; Input the fusion data into the electric load prediction model to generate electric load prediction data; the electric load prediction model is trained by the above model training method.
[0013] An embodiment of the present application further provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the above method is implemented.
[0014] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the above method is implemented.
[0015] Advantages of the present application: After extracting the local features and global dependence features of the sample electrical load data and generating the sample electrical load feature data, the sample meteorological data, sample date data, sample economic data, and sample electrical load feature data are fused to generate sample fusion data. Then, the generated sample fusion data is input into the model to be trained to generate sample electrical load prediction data. Furthermore, the generated sample electrical load prediction data and the preset real electrical load data are used to iteratively train the model to be trained, and finally an electrical load prediction model is obtained. Since the local features and global dependence features of the sample electrical load data are extracted first, the minute-level electrical load mutation features and the electrical load difference features varying with time series in the sample electrical load data can be captured. After fusing the sample meteorological data, sample date data, sample economic data, and sample electrical load feature data, the model to be trained is used to generate sample electrical load prediction data based on the fused sample fusion data, and the generated sample electrical load prediction data and the preset real electrical load data are used to iteratively train the model to be trained, so that the trained electrical load prediction model can learn the accurate mapping relationship between the electrical load features, meteorological features, date features, and economic features, and can adapt to the electrical load prediction scenarios with various external factor changes, having good prediction accuracy and robustness. When using the trained electrical load prediction model for electrical load prediction, relatively accurate electrical load prediction data can be obtained based on the electrical load data, meteorological data, date data, and economic data. Description of the Drawings
[0016] Figure 1 It is an application environment diagram of the model training method provided by an embodiment of the present application.
[0017] Figure 2 It is a flowchart of the model training method provided by an embodiment of the present application.
[0018] Figure 3 It is a flowchart of the specific method of step S202 provided by an embodiment of the present application.
[0019] Figure 4 It is a flowchart of the specific method of step S203 provided by an embodiment of the present application.
[0020] Figure 5 It is a flowchart of the specific method of step S204 provided by an embodiment of the present application.
[0021] Figure 6 It is a flowchart of the electrical load prediction method provided by an embodiment of the present application.
[0022] Figure 7 It is a schematic diagram of the hardware structure of the electronic device provided by an embodiment of the present application. Detailed Embodiments
[0023] In order to make the objectives, technical solutions and advantages of the present application more clear and understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0024] It should be noted that although the functional modules are divided in the device schematic diagram and the logical sequence is shown in the flowchart, in some cases, the steps shown can be executed in a different module division in the device or a different order in the flowchart. Terms such as "first" and "second" in the description, claims and drawings are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0025] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0026] The model training method and the electric load prediction method provided in the embodiments of this application can be executed by a computer device, which can be a terminal device or a server. Among them, the terminal device includes, but is not limited to, mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, aircraft, etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server.
[0027] In addition, the information, data and signals involved in the embodiments of this application are all authorized by the relevant objects or fully authorized by all parties, and the collection, use and processing of the relevant data all comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0028] To facilitate the understanding of the model training method provided in the embodiments of this application, the application scenario of the model training method will be exemplarily introduced below with the server as the execution subject of the model training method.
[0029] Figure 1 This is the application environment diagram of the model training method provided in the embodiments of this application. Refer to Figure 1, the model training method is applied to a model training system. The model training system includes a terminal 110 and a server 120. The terminal 110 and the server 120 are connected through a network. The terminal 110 can be a desktop terminal or a mobile terminal, and the mobile terminal can be at least one of a mobile phone, a tablet computer, a laptop computer, etc. The server 120 can be implemented by an independent server or a server cluster composed of multiple servers. The terminal 110 is used to send sample electric load data, sample meteorological data, sample date data, and sample economic data to the server 120. The server 120 is used to obtain the sample electric load data, sample meteorological data, sample date data, and sample economic data, extract local features and global dependency features of the sample electric load data to obtain sample electric load feature data, fuse the sample meteorological data, sample date data, sample economic data, and sample electric load feature data to obtain sample fusion data, input the sample fusion data into the model to be trained to generate sample electric load prediction data, and iteratively train the model to be trained based on the sample electric load prediction data and preset real electric load data to obtain an electric load prediction model.
[0030] It should be understood that Figure 1 the application scenarios shown are only examples. In actual applications, the model training method provided by the embodiments of the present application can also be applied to other scenarios. For example, the above model training method can be directly applied to the terminal 110. The terminal 110 is used to obtain sample electric load data, sample meteorological data, sample date data, and sample economic data, extract local features and global dependency features of the sample electric load data to obtain sample electric load feature data, fuse the sample meteorological data, sample date data, sample economic data, and sample electric load feature data to obtain sample fusion data, input the sample fusion data into the model to be trained to generate sample electric load prediction data, and iteratively train the model to be trained based on the sample electric load prediction data and preset real electric load data to obtain an electric load prediction model.
[0031] Figure 2 is a flowchart of a model training method provided by an embodiment of the present application. Refer to Figure 2 , in some embodiments, the method includes but is not limited to steps S201 to S205.
[0032] Step S201, obtain sample electric load data, sample meteorological data, sample date data, and sample economic data.
[0033] The sample electric load data can be obtained by retrieving historical electric load data of the power grid system. The sample meteorological data, sample date data, and sample economic data can be obtained from the Internet through web scraping technology. After obtaining the sample electric load data, sample meteorological data, sample date data, and sample economic data, they are sorted separately in chronological order.
[0034] Sample electrical load data is used to describe the electrical load intensity of the power grid system. The sample electrical load data can include sample electrical load data, sample power supply load data, sample power generation load data, etc. Sample meteorological data is used to describe the meteorological information of the area where the power grid system is located. The sample meteorological data can include sample climate data and sample weather data, etc. Sample date data is used to describe the date information of the area where the power grid system is located. The sample date data can be data including corresponding year, month, and date information. Sample economic data is used to describe the social structure, economic activities, population characteristics, and economic development information of the area where the power grid system is located. The sample economic data can include sample population and labor force data, sample economic output and growth data, sample income and consumption data, sample price and inflation data, etc.
[0035] In step S202, extract the local features and global dependency features of the sample electrical load data to obtain sample electrical load feature data.
[0036] The local features of the sample electrical load data refer to the correlation patterns between adjacent time points in the sample electrical load data. Specifically, a convolutional neural network can be used to extract features from the local time window. For example, a three-layer convolutional layer can be used to capture the hourly electrical load fluctuation pattern. The global dependency features of the sample electrical load data refer to the long-term correlation relationships across time periods in the sample electrical load data. Specifically, a multi-head self-attention mechanism can be used to model the electrical load change trend at the weekly or monthly dimension. For example, calculate the electrical load correlation at the same time period on different dates. The sample fusion data refers to the joint representation of the local features and global dependency features of the sample electrical load data. Specifically, it can be obtained by dynamically adjusting the contribution degrees of the local features and global dependency features of the sample electrical load data through a gating mechanism. For example, use the sigmoid function to control the influence weight of the sample meteorological data on the electrical load prediction.
[0037] In step S203, fuse the sample meteorological data, sample date data, sample economic data, and sample electrical load feature data to obtain sample fusion data.
[0038] In step S204, input the sample fusion data into the model to be trained to generate sample electrical load prediction data.
[0039] In step S205, iteratively train the model to be trained based on the sample electrical load prediction data and the preset true electrical load data to obtain an electrical load prediction model.
[0040] After obtaining the sample electric load data, sample meteorological data, sample date data, and sample economic data, extract the local features and global dependence features of the sample electric load data to capture the minute-level electric load mutation features and the electric load difference features varying with time series in the sample electric load data, and generate the corresponding sample electric load feature data. Integrate the generated sample electric load feature data with the sample meteorological data, sample date data, sample economic data, and sample electric load feature data to generate sample integration data, so that the sample integration data includes the sample electric load feature data and the corresponding sample meteorological data, sample date data, and sample economic data of the sample electric load feature data. Input the generated sample integration data into the model to be trained and generate sample electric load prediction data, and use the generated sample electric load prediction data and the preset real electric load data to iteratively train the model to be trained. Correct the network parameters of the model to be trained through the deviation between the sample electric load prediction data output by the model to be trained and the preset real electric load data, so that the model to be trained gradually learns the mapping relationship between the electric load features, meteorological features, date features, and economic features until the training end condition is met, and obtain an electric load prediction model that has learned the accurate mapping relationship between the electric load features, meteorological features, date features, and economic features.
[0041] Compared with the prior art, in the model training method provided by the embodiment of the present application, after extracting the local features and global dependence features of the sample electric load data and generating the sample electric load feature data, integrate the sample meteorological data, sample date data, sample economic data, and sample electric load feature data to generate sample integration data, and then input the generated sample integration data into the model to be trained and generate sample electric load prediction data. Furthermore, use the generated sample electric load prediction data and the preset real electric load data to iteratively train the model to be trained, and finally obtain an electric load prediction model. Since the local features and global dependence features of the sample electric load data are extracted first, the minute-level electric load mutation features and the electric load difference features varying with time series in the sample electric load data can be captured. After integrating the sample meteorological data, sample date data, sample economic data, and sample electric load feature data, use the model to be trained to generate sample electric load prediction data based on the integrated sample integration data, and use the generated sample electric load prediction data and the preset real electric load data to iteratively train the model to be trained, so that the trained electric load prediction model can learn the accurate mapping relationship between the electric load features, meteorological features, date features, and economic features, and can adapt to the electric load prediction scenarios with various external factor changes, and has good prediction accuracy and robustness. When using the trained electric load prediction model to perform electric load prediction, relatively accurate electric load prediction data can be obtained based on the electric load data, meteorological data, date data, and economic data.
[0042] In some embodiments, before step S202, it further includes: Perform data cleaning, normalization, feature encoding, and differencing on the sample electric load data, sample meteorological data, sample date data, and sample economic data to obtain the preprocessed sample electric load data, sample meteorological data, sample date data, and sample economic data.
[0043] Data cleaning refers to identifying and removing outliers or noise data, which can be specifically implemented using statistical thresholds or clustering algorithms to ensure data reliability and reduce interference in model training. Normalization refers to converting data with different dimensions into a unified numerical range, which can be specifically implemented using min-max scaling or standardization methods to eliminate scale differences between multi-source data. Feature encoding refers to converting unstructured data into a numerical form, which can be specifically implemented using one-hot encoding or embedding vectors to retain semantic information in date and economic data. Differencing refers to calculating the differences between adjacent time steps of time series data, which can be specifically implemented using first-order or higher-order differencing operations to enhance the model's ability to capture time series dynamic trends.
[0044] For the sample electric load data, data cleaning can be implemented using a self-supervised anomaly detection algorithm. By using a change point detection model based on the Transformer architecture, identify mutation points and abnormal fluctuations in the data, locate abnormal moments, and repair outliers. For the sample meteorological data, data cleaning can be to use the STL decomposition method to decompose the data into trend, seasonal, and residual components, and identify and repair the abnormal residual part. For the sample date data and sample economic data, data cleaning can be to repair missing values and outliers in the data using simple logical filling or mean filling methods to ensure the integrity of data features.
[0045] In some embodiments, normalization is implemented using the Z-Score standardization method.
[0046] In some embodiments, feature encoding is to use one-hot encoding to represent the sample electric load data, sample meteorological data, sample date data, and sample economic data.
[0047] In some embodiments, differencing is implemented using a first-order differencing operation.
[0048] Figure 3 It is a flowchart of the specific method of step S202 provided by the embodiments of the present application. Refer to Figure 3 In some embodiments, the method includes but is not limited to steps S301 to S304.
[0049] Step S301, divide the sample electric load data into multiple sample electric load segment data.
[0050] The sample electric load segment data refers to a data sequence with variable length generated by dynamically dividing the sample electric load data. It can be achieved by using a data point segmentation method based on time series fluctuation feature detection. For example, segment segmentation is triggered by calculating the change rate threshold between adjacent data points, thereby realizing the adaptive division of the electric load fluctuation pattern.
[0051] In some embodiments, step S301 includes: dividing the sample electric load data into multiple sample initial segment data with arbitrary lengths; extracting the time series fluctuation features of the sample initial segment data to determine the sample fluctuation data points in the sample initial segment data that meet the preset data fluctuation conditions; and re-dividing the sample electric load data based on the sample fluctuation data points to obtain multiple sample electric load segment data.
[0052] The sample initial segment data refers to a data sequence generated by segmenting the sample electric load data, which can be specifically achieved by using a sliding window or fixed step length division method. The time series fluctuation feature refers to a quantitative index measuring the dynamic change degree of the data sequence, which can be specifically achieved by using standard deviation, coefficient of variation or approximate entropy algorithm, and is used to identify the mutation points or inflection point regions of the electric load change. The preset data fluctuation condition refers to the threshold rule for screening fluctuation data points, which can be specifically achieved by using dynamic quantile threshold or local outlier factor detection method, and is used to filter out the abnormal fluctuation positions that have a significant impact on the electric load trend. The sample fluctuation data points refer to the time series positions that meet the fluctuation intensity condition, which can be specifically determined by calculating the absolute value of the first-order difference between adjacent time points, and are used to guide the boundary setting for re-dividing the sample electric load data.
[0053] After obtaining multiple sample initial segment data, a self-supervised change point detection algorithm is used to perform dynamic change recognition on each sample initial segment data. Through a self-supervised model based on the Transformer architecture, the time series pattern and abnormal fluctuation in the sample initial segment data are learned to identify the moments that significantly deviate from the normal data distribution. Specifically, first, the encoder based on the Transformer architecture is used to perform feature embedding on the sample initial segment data to obtain the feature embedding representation of the sample initial segment data. Then, the similarity between the feature embedding representations of the current sample initial segment data and the historical sample initial segment data is calculated to obtain the corresponding feature similarity score. Next, the calculated feature similarity score is compared with the preset similarity score threshold. When the feature similarity score is greater than the similarity score threshold, it is determined that there are sample fluctuation data points. After determining the sample fluctuation data points in each sample initial segment data, the sample electric load data is re-divided to obtain multiple sample electric load segment data with the sample fluctuation data points as the boundaries. The similarity score threshold is dynamically set according to the mean and standard deviation of the feature similarity score, and the calculation formula of the similarity score threshold is: , wherein, is the similarity score threshold, is the mean of the feature similarity scores, is the standard deviation of the feature similarity scores, and is a hyperparameter.
[0054] Step S302: Perform a continuous convolution operation on the sample electric load segment data to obtain sample local feature data.
[0055] The continuous convolution operation refers to the process of extracting multi-scale sliding window features from the sample electric load segment data. Specifically, it can be implemented using a deep neural network layer with a dilated convolution structure. For example, three stacked dilated convolution kernels are used to capture local correlations at different time spans, thereby enhancing the response ability to sudden changes in electric load.
[0056] In some embodiments, to fully capture the local features in the sample electric load segment data, a multi-scale convolutional neural network (MS-CNN) is used to extract multi-level feature information using different convolution kernel sizes. The process of performing a continuous convolution operation on the sample electric load segment data is as follows: , wherein, is the i-th sample electric load segment data, is the th convolutional layer to extract local features, and are the weight and bias of the convolution kernel respectively, is the convolution operation, is the activation operation. To be compatible with different time scales, multiple convolution kernel sizes (such as 3×1, 5×1, and 7×1) are used for parallel convolution extraction, and finally the multi-scale local features are concatenated into sample local feature data.
[0057] Step S303: Based on the multi-head self-attention mechanism, perform a self-attention operation on the sample local feature data to obtain sample global dependency feature data.
[0058] The multi-head self-attention mechanism refers to a feature interaction method for parallelly calculating temporal dependency relationships in multiple dimensions. Specifically, it can be implemented using a multi-branch attention head structure controlled by a learnable parameter matrix to perform a self-attention operation on the sample local feature data. For example, eight attention heads are set to capture the global association patterns of the sample local feature data at different time granularities, thereby revealing the periodic patterns of changes in the sample electric load data.
[0059] In some embodiments, to capture the long-term global dependence information among the local feature data of each sample, a multi-head self-attention mechanism based on the Transformer architecture is adopted. The local feature data of each sample are concatenated into a matrix to obtain a sample local feature data matrix. The sample local feature data matrix is linearly transformed to generate corresponding query vectors, key vectors, and value vectors. The correlation between each feature is calculated through self-attention, and then the correlation between the query vectors, key vectors, and value vectors is calculated through self-attention to obtain the sample global dependence feature data. The calculation formula for the sample global dependence feature data is: , , , , where, is the sample global dependence feature data, is the sample local feature data matrix, , and are the query vector, key vector, and value vector of the sample local feature data matrix respectively, , and are trainable parameter matrices respectively, is the dimension of, T is the transpose, is the normalization process.
[0060] Step S304, concatenate the sample local feature data and the sample global dependence feature data to obtain the sample electrical load feature data.
[0061] In some embodiments, to retain the original feature information of the sample electrical load data and enhance the stability of the model, the sample local feature data and the sample global dependence feature data are subjected to residual connection and layer normalization processing to obtain the sample electrical load feature data. The expression for the sample electrical load feature data is: , where, is the sample electrical load feature data, is the layer normalization process.
[0062] Figure 4 is the flowchart of the specific method of step S203 provided in the embodiments of the present application. Refer to Figure 4 , in some embodiments, the method includes but is not limited to steps S401 to S403.
[0063] Step S401: Perform gated fusion on each of the sample meteorological data, sample date data, sample economic data, and sample electrical load characteristic data to obtain sample gated fusion data.
[0064] Gated fusion refers to dynamically adjusting the weights of different features in each data source through a gating mechanism. Specifically, it can be implemented using a fully connected layer with a sigmoid activation function, and the original features are weighted and screened by generating weight values between 0 and 1. Specifically, gated fusion first independently processes the sample meteorological data, sample date data, sample economic data, and sample electrical load characteristic data, and filters out noise and retains key features in each group of data through a gating unit. For example, features such as temperature and humidity in the sample meteorological data may have different degrees of influence on the electrical load at different times, and the gating mechanism can adaptively adjust their weights.
[0065] In some embodiments, before performing gated fusion, first align the time of the sample meteorological data, sample date data, sample economic data, and sample electrical load characteristic data. For data with different sampling frequencies, use linear interpolation or forward filling methods to fill in the missing time steps. To dynamically adjust the weights of each data source in gated fusion, calculate the gated weights corresponding to the sample meteorological data, sample date data, sample economic data, and sample electrical load characteristic data respectively, and then use the calculated gated weights to weight the sample meteorological data, sample date data, sample economic data, and sample electrical load characteristic data. The specific formula is as follows: , , Among them, is the gated weight, is the sigmoid activation operation, is the sample meteorological data, sample date data, sample economic data, or sample electrical load characteristic data, and are trainable parameters, is the sample gated fusion data of the sample meteorological data, sample date data, sample economic data, or sample electrical load characteristic data, is element-wise multiplication.
[0066] Step S402: Generate a query vector from the sample gated fusion data of the sample electrical load characteristic data, and generate a key vector and a value vector from the concatenated data of the sample gated fusion data of the sample meteorological data, sample date data, and sample economic data, and perform cross-attention fusion to obtain sample attention fusion data.
[0067] Cross-attention fusion refers to using the electrical load characteristics as the query vector and the data obtained by concatenating external factors as the key-value vector for attention calculation. Specifically, it can be implemented using the multi-head attention mechanism. By calculating the similarity between the query and the key, attention weights are generated, and then the value vectors are weighted and summed. Specifically, in the cross-attention fusion stage, the sample electrical load characteristic data is used as the query vector to find the feature combination with the highest correlation in the external factor data (sample meteorological data, sample date data, and sample economic data). For example, the combination of holidays and economic indicators may have a specific impact on the electrical load in the commercial area. Through staged fusion, the sample electrical load characteristic data not only retains its own time series characteristics but also establishes a dynamic association with external factors, avoiding the disorderly superposition of features.
[0068] In some embodiments, to capture the interaction information between the sample meteorological data, sample date data, sample economic data, and sample electrical load characteristic data, the cross-attention mechanism is used to fuse the sample gated fusion data. The sample gated fusion data of the sample electrical load characteristic data is used to generate the query vector, and the data obtained by concatenating the sample gated fusion data of the sample meteorological data, sample date data, and sample economic data is used to generate the key vector and the value vector. The fusion features are obtained through cross-attention calculation to get the sample attention fusion data. The calculation formula for the sample attention fusion data is: , , , , Among them, is the sample attention fusion data, is the sample gated fusion data of the sample electrical load characteristic data, is the data obtained by concatenating the sample gated fusion data of the sample meteorological data, sample date data, and sample economic data, is the sample gated fusion data of the sample meteorological data, is the sample gated fusion data of the sample date data, is the sample gated fusion data of the sample economic data, is the query vector generated by, is the key vector generated by, is the value vector generated by, 、 and are respectively trainable parameter matrices, is the dimension of.
[0069] Step S403: Concatenate the sample gated fusion data and the sample attention fusion data of the sample electrical load characteristic data to obtain the sample fusion data.
[0070] In some embodiments, to retain the original feature information of the sample electrical load characteristic data and alleviate the problem of gradient disappearance, the sample gated fusion data and the sample attention fusion data of the sample electrical load characteristic data are subjected to residual connection and layer normalization processing to obtain the sample fusion data. The expression of the sample fusion data is: , where, is the sample fusion data.
[0071] Figure 5 is the flowchart of the specific method of step S204 provided by the embodiments of the present application. Refer to Figure 5 , in some embodiments, the method includes but is not limited to steps S501 to S503.
[0072] In this embodiment, the model to be trained includes a non-linear time series prediction network and a linear time series prediction network.
[0073] Step S501: Based on the non-linear time series prediction network, extract the non-linear time series features in the sample fusion data to obtain the sample non-linear time series feature data.
[0074] The non-linear time series prediction network refers to using a deep neural network structure to model the complex dynamic changes in time series data. Specifically, it can be implemented using a long short-term memory network or a time series convolutional network with a multi-layer perceptron structure. The role of the non-linear time series prediction network is to capture the electrical load fluctuations in the sample fusion data caused by date factors, socio-economic factors, and / or meteorological factors.
[0075] In some embodiments, the non-linear time series prediction network selects a deep neural network based on the Transformer architecture. To extract the non-linear time series features in the sample fusion data, first, the sample fusion data is input into the encoder of the non-linear time series prediction network to extract the global time dependence relationship in the sample fusion data, and then the encoded result is input into the fully connected layer of the non-linear time series prediction network to map the encoded result to a non-linear prediction value, that is, the sample non-linear time series feature data. The expression for generating the sample non-linear time series feature data is: , where, is the sample non-linear time series feature data, is the encoded result obtained by encoding the sample fusion data by the encoder of the non-linear time series prediction network, is the mapping weight learned by the non-linear time series prediction network, is the offset parameter.
[0076] Step S502: Based on the linear time series prediction network, extract the linear time series features in the sample fusion data to obtain the sample linear time series feature data.
[0077] The linear time series prediction network refers to using a model with an explicit linear relationship to model the periodic and trend features in time series data. Specifically, it can be implemented using an autoregressive moving average model or a lightweight linear projection layer. The role of the linear time series prediction network is to extract the electric load change cycle features and the electric load linear trend features of the sample electric load data.
[0078] In some embodiments, the linear time series prediction network selects a deep neural network based on the neural autoregressive architecture (NAR). To extract the linear time series features in the sample fusion data, specifically, input the sample fusion data into the linear time series prediction network to extract the linear time series features of the data related to the electric load features in the sample fusion data, and map the extracted linear time series features to linear prediction values, that is, the sample linear time series feature data. The linear time series prediction network can be obtained by learning the linear time series features of the sample electric load data. Specifically, construct the corresponding autoregressive feature data based on the sample electric load data, input the constructed autoregressive feature data into the linear time series prediction network to generate the corresponding linear prediction values, and iteratively adjust the network parameters of the linear time series prediction network until the linear prediction values meet the convergence conditions, so that the linear time series prediction network can learn the linear time series features of the sample electric load data. The expression for generating the sample linear time series feature data is: , where, is the sample linear time series feature data, is the autoregressive weight learned by the linear time series prediction network, is the offset parameter, is the autoregressive feature data constructed based on the data related to the electric load features in the sample fusion data, is the time lag order selected by the linear time series prediction network.
[0079] Step S503: Fuse the sample non-linear time series feature data and the sample linear time series feature data to obtain the sample electric load prediction data.
[0080] The fusion operation refers to weighted splicing or gated addition of the feature vectors output by the two networks. Specifically, it can be implemented by generating weight coefficients using a fully connected layer and then performing weighted summation. The role of the fusion operation is to balance the contribution degrees of the sample non-linear time series feature data and the sample linear time series feature data to the sample electric load prediction data.
[0081] In some embodiments, the sample non-linear time-series feature data and the sample linear time-series feature data are fused in a weighted fusion manner, and the fusion expression is:
[0082] Wherein, is the sample electric load prediction data, is the learnable dynamic fusion weight.
[0083] In some embodiments, step S205 includes: determining the model loss information corresponding to the sample electric load prediction data; iteratively adjusting the network parameters in the model to be trained according to the model loss information until the training end condition is met, and obtaining the electric load prediction model. Wherein, the model loss information characterizes the deviation between the sample electric load prediction data and the real electric load data.
[0084] The model loss information refers to an evaluation index used to quantify the difference degree between the sample electric load prediction data and the real electric load data. Specifically, it can be implemented by mean square error, mean absolute error or symmetric mean absolute percentage error, and the correlation relationship between the predicted value and the real value is established through mathematical operations. The training end condition refers to the convergence criterion for determining whether the training of the model to be trained terminates. Specifically, it can be implemented by the validation set loss not decreasing for several consecutive rounds, the training loss reaching a preset threshold or an early stopping strategy, and dynamically judging whether the model parameters are in the optimal state.
[0085] In some embodiments, after each forward propagation generates a prediction result, the current model loss information is calculated through a loss function. The model loss information is transmitted to each layer of the model to be trained through the backpropagation algorithm, driving the update of the network parameter gradient. During the training process, the change trend of the model loss information is continuously monitored. When the model loss information does not show a significant decrease within a predetermined number of rounds, the training is automatically terminated to obtain the electric load prediction model. This process dynamically adjusts the training process through a real-time feedback mechanism, and stops the parameter optimization in time before the model to be trained is about to enter the overfitting stage, avoiding the degradation of the generalization performance caused by overtraining. The calculation formula of the model loss information is: , Wherein, is the model loss information, is the s-th real electric load data, is the s-th sample electric load prediction data, s is a positive integer, s ∈ [1, S], and S is the total number of sample electric load prediction data.
[0086] Figure 6 is the flowchart of an electric load prediction method provided by an embodiment of the present application. Refer to Figure 6 , in some embodiments, the method includes but is not limited to steps S601 to S604.
[0087] Step S601: Obtain electrical load data, meteorological data, date data, and economic data.
[0088] Step S602: Extract local features and global dependency features of the electrical load data to obtain electrical load feature data.
[0089] Step S603: Integrate meteorological data, date data, economic data, and electrical load feature data to obtain integrated data.
[0090] Step S604: Input the integrated data into an electrical load prediction model to generate electrical load prediction data.
[0091] Among them, the electrical load prediction model is trained by the above-mentioned model training method.
[0092] The driving right allocation method provided by the embodiment of the present application, by obtaining real-time electrical load data, meteorological data, date data, and economic data, after extracting local features and global dependency features of the electrical load data and generating electrical load feature data, integrates meteorological data, date data, economic data, and electrical load feature data to generate integrated data, and then inputs the generated integrated data into an electrical load prediction model trained by the above-mentioned model training method to generate electrical load prediction data. Since this electrical load prediction model learns the accurate mapping relationship between electrical load features and meteorological features, date features, and economic features, it can adapt to electrical load prediction scenarios with various external factor changes, has good prediction accuracy and robustness, and enables the generated electrical load prediction data to have a relatively high prediction accuracy.
[0093] Figure 7 It is a block diagram of an electronic device shown according to an exemplary embodiment.
[0094] Next, refer to Figure 7 to describe the electronic device 700 according to this embodiment of the present disclosure. Figure 7 The shown electronic device 700 is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present disclosure.
[0095] As Figure 7 shown, the electronic device 700 is presented in the form of a general-purpose computing device. The components of the electronic device 700 may include, but are not limited to: at least one processing unit 710, at least one storage unit 720, a bus 730 connecting different system components (including the storage unit 720 and the processing unit 710), a display unit 740, etc.
[0096] Among them, the storage unit stores program code that can be executed by the processing unit 710, so that the processing unit 710 executes the steps according to various exemplary embodiments of the present disclosure described in the method section of this specification.
[0097] The storage unit 720 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 7201 and / or a cache storage unit 7202, and may further include a read-only storage unit (ROM) 7203.
[0098] The storage unit 720 may also include a program / utilities 7204 having a set (at least one) of program modules 7205. Such program modules 7205 include, but are not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment.
[0099] The bus 730 may represent one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus structures.
[0100] The electronic device 700 may also communicate with one or more external devices 700' (such as a keyboard, a pointing device, a Bluetooth device, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 700, and / or may communicate with any device that enables the electronic device 700 to communicate with one or more other computing devices (such as a router, a modem, etc.). Such communication may be carried out through an input / output (I / O) interface 750. Moreover, the electronic device 700 may also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 760. The network adapter 760 may communicate with other modules of the electronic device 700 through the bus 730. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0101] The embodiment of the present application also provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the above method is implemented.
[0102] The model training method, electric load prediction method, device and storage medium provided by the embodiments of the present application, after extracting the local features and global dependence features of the sample electric load data and generating the sample electric load feature data, fuse the sample meteorological data, sample date data, sample economic data and sample electric load feature data to generate the sample fusion data, then input the generated sample fusion data into the model to be trained and generate the sample electric load prediction data, and further use the generated sample electric load prediction data and the preset real electric load data to iteratively train the model to be trained, and finally obtain the electric load prediction model. Since the local features and global dependence features of the sample electric load data are extracted first, the minute-level electric load mutation features and the electric load difference features varying with the time series in the sample electric load data can be captured. After fusing the sample meteorological data, sample date data, sample economic data and sample electric load feature data, the model to be trained is used to generate the sample electric load prediction data based on the fused sample fusion data, and the generated sample electric load prediction data and the preset real electric load data are used to iteratively train the model to be trained, so that the trained electric load prediction model can learn the accurate mapping relationship between the electric load features, meteorological features, date features and economic features, and can adapt to the electric load prediction scenarios with various external factor changes, and has good prediction accuracy and robustness. When using the trained electric load prediction model for electric load prediction, relatively accurate electric load prediction data can be obtained based on the electric load data, meteorological data, date data and economic data.
[0103] From the description of the above embodiments, those skilled in the art can easily understand that the example embodiments described herein can be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solutions according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, or a network device, etc.) to execute the above method according to the embodiments of the present disclosure.
[0104] The program product can adopt any combination of one or more readable media. The readable media can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive list) of the readable storage medium include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0105] A computer-readable storage medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a readable program code is carried. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. The readable storage medium may also be any readable medium other than the readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0106] Those skilled in the art can understand that the above-mentioned modules can be distributed in the device according to the description of the embodiments, or can be correspondingly changed and distributed in one or more devices that are uniquely different from the present embodiment. The modules of the above embodiments can be combined into one module, or further split into multiple sub-modules.
[0107] The exemplary embodiments of the present disclosure have been specifically shown and described above. It should be understood that the present disclosure is not limited to the detailed structures, arrangements, or implementation methods described herein; on the contrary, the present disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
Claims
1. A model training method, characterized in that, Including: Obtaining sample electric load data, sample meteorological data, sample date data, and sample economic data; Extracting local features and global dependence features of the sample electric load data to obtain sample electric load feature data; Fusing the sample meteorological data, the sample date data, the sample economic data, and the sample electric load feature data to obtain sample fusion data; Inputting the sample fusion data into a model to be trained to generate sample electric load prediction data; Iteratively training the model to be trained based on the sample electric load prediction data and preset true electric load data to obtain an electric load prediction model.
2. The model training method according to claim 1, wherein Before extracting the local features and global dependence features of the sample electric load data, it further includes: Performing data cleaning, normalization, feature encoding, and differencing on the sample electric load data, the sample meteorological data, the sample date data, and the sample economic data to obtain preprocessed sample electric load data, sample meteorological data, sample date data, and sample economic data.
3. The model training method according to claim 1, wherein The extracting of the local features and global dependence features of the sample electric load data includes: Dividing the sample electric load data into multiple sample electric load segment data; Performing continuous convolution operations on the sample electric load segment data to obtain sample local feature data; Based on a multi-head self-attention mechanism, performing self-attention operations on the sample local feature data to obtain sample global dependence feature data; Concatenating the sample local feature data and the sample global dependence feature data to obtain the sample electric load feature data.
4. The model training method according to claim 3, wherein The dividing of the sample electric load data into multiple sample electric load segment data includes: Dividing the sample electric load data into multiple sample initial segment data of arbitrary lengths; Extracting the time series fluctuation features of the sample initial segment data to determine sample fluctuation data points in the sample initial segment data that meet preset data fluctuation conditions; Redividing the sample electric load data according to the sample fluctuation data points to obtain multiple pieces of the sample electric load segment data.
5. The model training method according to claim 1, wherein The fusing of the sample meteorological data, the sample date data, the sample economic data, and the sample electric load feature data includes: Performing gated fusion on each of the sample meteorological data, the sample date data, the sample economic data, and the sample electric load feature data to obtain sample gated fusion data; Generating a query vector from the sample gated fusion data of the sample electric load feature data, and generating a key vector and a value vector from the concatenated data of the sample gated fusion data of the sample meteorological data, the sample date data, and the sample economic data, and performing cross-attention fusion to obtain sample attention fusion data; Concatenating the sample gated fusion data of the sample electric load feature data and the sample attention fusion data to obtain the sample fusion data.
6. The model training method according to claim 1, wherein The model to be trained includes a non-linear time series prediction network and a linear time series prediction network. The inputting of the sample fusion data into the model to be trained to generate sample electric load prediction data includes: Based on the non-linear time series prediction network, extract the non-linear time series features in the sample fusion data to obtain sample non-linear time series feature data; Based on the linear time series prediction network, extract the linear time series features in the sample fusion data to obtain sample linear time series feature data; Fuse the sample non-linear time series feature data and the sample linear time series feature data to obtain the sample electric load prediction data.
7. The model training method according to claim 1, characterized in that The iterative training of the model to be trained according to the sample electric load prediction data and the preset true electric load data includes: Determine the model loss information corresponding to the sample electric load prediction data; the model loss information characterizes the deviation between the sample electric load prediction data and the true electric load data; Iteratively adjust the network parameters in the model to be trained according to the model loss information until the training end condition is met, and obtain the electric load prediction model.
8. An electric load forecasting method, characterized in that, It includes: Obtain electric load data, meteorological data, date data, and economic data; Extract the local features and global dependence features of the electric load data to obtain electric load feature data; Fuse the meteorological data, the date data, the economic data, and the electric load feature data to obtain fusion data; Input the fusion data into the electric load prediction model to generate electric load prediction data; The electric load prediction model is trained by the model training method according to any one of claims 1 to 7.
9. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 8 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that, The computer program implements the method according to any one of claims 1 to 8 when executed by the processor.
Citation Information
Patent Citations
Whole-network electrical load classification proportion analysis method and device and computer equipment
CN118535950A
Power load prediction method considering physical social economic factors and terminal
CN118539411A
Electricity market user load prediction method, system, equipment and medium
CN119940665A
Power supply device and method for smart home equipment power supply
CN119966012A
TCN-Transformer-based renewable energy power grid load prediction method and device
CN119994847A
Cited By
Training method and device of load prediction model, prediction method and device and electronic equipment
CN120744514A