Electricity price prediction method and device, terminal equipment and computer program product
By using graph attention network and cyclic neural network model in electricity price prediction, combined with gated cyclic units and self-attention mechanism, the problem that existing technology is difficult to capture complex dynamic changes in the power market is solved, and higher accuracy of electricity price prediction is achieved and adaptability.
Patent Information
- Application Number
- CN202510059951.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-02-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is difficult to effectively capture complex dynamic changes in the power market, resulting in a decrease in the accuracy of electricity price prediction.
A cyclic neural network model combining a gated cyclic unit and a self-attention mechanism is used to generate an accurate electricity price prediction vector by integrating and processing historical data.
It improves the accuracy and robustness of electricity price forecasts and can better adapt to complex electricity market changes.
Smart Images

Figure CN119477389A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of artificial intelligence technology, and in particular, relates to an electricity price prediction method, apparatus, terminal equipment and computer program product. Background Art
[0002] At present, electricity prices in the power market often have highly nonlinear and non-stationary characteristics. Especially under extreme weather, policy changes or emergencies, the volatility of electricity prices increases significantly. Traditional models often cannot capture these dynamic changes, resulting in a significant increase in prediction errors.
[0003] Existing technologies usually use long short-term memory networks (LSTM) to capture long-term dependencies in time series data to deal with nonlinear and non-stationary problems in electricity price forecasting. However, existing technologies cannot adapt to complex electricity markets, thus reducing the accuracy of electricity price forecasting. Summary of the invention
[0004] The embodiments of the present application provide an electricity price prediction method, apparatus, terminal device and computer program product to improve the accuracy of electricity price prediction.
[0005] In a first aspect, an embodiment of the present application provides a method for predicting electricity prices, comprising: Acquire a historical data set related to electricity prices in a target area within a historical time period; the historical data set includes multiple historical data at different historical times; the multiple historical data include historical actual electricity prices; According to the multiple historical data at different historical times and the graph attention network, initial electricity price vectors at different historical times are obtained; The initial electricity price vectors at different historical times are sequentially input into a recurrent neural network model for processing to obtain an electricity price prediction vector; the recurrent neural network model is trained by a pre-constructed gated recurrent unit and a self-attention mechanism; Based on the electricity price prediction vector, a predicted electricity price value of the target area at the target time is predicted.
[0006] An electricity price prediction method provided in an embodiment of the present application, since the graph attention network can realize the extraction of the intrinsic relationship between the electricity price and its different influencing parameters, therefore, the present application can realize the effective integration of different historical data through the graph attention network, so as to obtain accurate initial electricity price vectors at different historical times; then, since the recurrent neural network model trained by the gated recurrent unit and the self-attention mechanism can enhance the processing ability of nonlinearity and non-stationarity in complex time series data, effectively capture the time information contained in the long sequence, and improve its own robustness and accuracy, therefore, the initial electricity price vectors at different historical times are input into the trained recurrent neural network model for processing in turn, and an accurate electricity price prediction vector can be obtained; finally, the present application can adapt to the complex electricity market in combination with the graph attention network, the gated recurrent unit and the self-attention mechanism, so that the electricity price prediction value of the target area at the target time can be accurately predicted based on the electricity price prediction vector obtained above, thereby improving the prediction accuracy of the electricity price.
[0007] Optionally, before obtaining the initial electricity price vectors at different historical times according to the multiple historical data at different historical times and the graph attention network, the method further includes: For any historical time, the remaining historical data at the historical time are divided based on the historical actual electricity price at the historical time to obtain a static graph at the historical time; the remaining historical data refers to data other than the historical actual electricity price among the multiple historical data; the static graph includes a central node and at least one other node, the central node is the historical actual electricity price, and the other nodes are the remaining historical data at the same historical time as the historical actual electricity price; Correspondingly, the initial electricity price vectors at different historical times are obtained according to the multiple historical data at different historical times and the graph attention network, including: The static graphs at different historical times are sequentially input into the graph attention network for processing to obtain the initial electricity price vectors at different historical times.
[0008] In the above implementation, the terminal device can divide different historical data including electricity prices into corresponding history according to different historical times, and abstract the relationship between electricity prices and other historical data into static graphs at respective historical times, so that the subsequent graph attention network can process the static graphs at each historical time, thereby obtaining accurate initial electricity price vectors at different historical times.
[0009] Optionally, the graph attention network includes a node embedding layer; the step of sequentially inputting the static graphs at different historical times into the graph attention network for processing to obtain initial electricity price vectors at different historical times includes: For any historical time, the static graph at the historical time is input into the node embedding layer for transformation processing to obtain a high-dimensional feature vector corresponding to multiple historical data corresponding to the historical time; Using the attention mechanism to calculate the weight of each of the high-dimensional feature vectors, to obtain the attention weight corresponding to each of the high-dimensional feature vectors; the attention weight is used to describe the strength of the relationship between each of the high-dimensional feature vectors and the central node of the static graph; The attention weights of the high-dimensional feature vectors and the high-dimensional feature vectors are aggregated to obtain an initial electricity price vector at the historical time.
[0010] In the above implementation, the terminal device can utilize the graph attention network to obtain the characteristics of the relationship between other nodes in the graph and the central node, and effectively aggregate the remaining historical data with the electricity price according to a certain weight ratio at the same time, thereby obtaining an accurate initial electricity price vector at different historical times.
[0011] Optionally, the recurrent neural network model includes a target gated recurrent unit; the initial electricity price vectors at different historical times are sequentially input into the trained recurrent neural network model for processing to obtain an electricity price prediction vector, including: For any historical time, the initial electricity price vector at the historical time and the hidden state at the previous time before the historical time are input into the target gated recurrent unit for calculation to obtain the hidden state at the historical time; Use the attention mechanism to calculate the weights of hidden states at different historical times to obtain weight vectors at different historical times; The weight vectors and hidden states at different historical times are weighted and summed to obtain the electricity price prediction vector.
[0012] In the above implementation, the recurrent neural network model trained by the gated recurrent unit and the self-attention mechanism can enhance the ability to handle nonlinearity and non-stationarity in complex time series data, effectively capture the time information contained in long sequences, improve its own robustness and accuracy, and thus improve the accuracy of the obtained electricity price prediction vector.
[0013] Optionally, the predicting, based on the electricity price prediction vector, to obtain a predicted electricity price value for the target area at a target time includes: The electricity price prediction vector is input into a multi-layer perceptron for processing to obtain the electricity price prediction value.
[0014] In the above implementation, the prediction accuracy of the final electricity price prediction value is improved by using a multi-layer perceptron.
[0015] Optionally, the target time is the start time of a target time period; after predicting the electricity price forecast value of the target area at the target time based on the electricity price forecast vector, the method further includes: Based on the sliding window algorithm, a prediction operation is performed on the data sets in each data window to obtain the prediction data at different prediction times in the target time period; the size of each data window is determined by the total number of all historical times in the historical time period; the start time of the Nth data set is the K-(N-1)th historical time in the historical time period, and the end time of the Nth data set is the N-1th prediction time in the target time period; K is the total number; the various historical times in the historical time period are sorted in order from late to early; the Nth data set includes the remaining historical data from the K-(N-1)th historical time to the prediction data of the N-1th prediction time; the remaining historical data refers to any data in the historical data set except the historical actual electricity price; the prediction data corresponds to the remaining historical data; Based on the sliding window algorithm, the data to be predicted in each prediction window is returned in turn to execute the step of inputting the multiple historical data at different historical times into the graph attention network for processing, and obtaining the initial electricity price vector at different historical times and the subsequent steps, so as to obtain the electricity price prediction value at different prediction times after the target time; the size of each prediction window is determined by the total number of historical times in the historical time period; the Nth group of data to be predicted includes multiple historical data from the K-(N-1)th historical time to each prediction data at the N-1th prediction time, and the electricity price prediction value from the target time to the N-1th prediction time.
[0016] In the above implementation, through the sliding window algorithm, the terminal device can use the predicted electricity price value at the previous moment as one of the historical data for predicting the electricity price prediction value at the next moment, thereby achieving accurate prediction of the electricity price prediction value in the future period of time.
[0017] Optionally, before sequentially inputting the initial electricity price vectors at different historical times into the trained recurrent neural network model for processing to obtain the electricity price prediction vector, the method further includes: Acquire a characteristic data set related to electricity prices in the target area within a set time period; the characteristic data set includes a plurality of characteristic data at each time point within the set time period; The feature data set is divided into a training set, a validation set and a test set based on a set ratio; each sample data in the training set, the validation set and the test set includes a plurality of feature data within a set time period; the set time period is determined by the length of the historical time period; The pre-constructed gated recurrent unit and self-attention mechanism are trained and tested based on the training set, the validation set and the test set to obtain the recurrent neural network model.
[0018] In the above implementation, the training accuracy of the recurrent neural network model is improved through the training set, the validation set and the test set, thereby improving the prediction accuracy of the recurrent neural network model.
[0019] Optionally, the multiple historical data also include: historical loads and historical power generation corresponding to various power generation methods.
[0020] In the above implementation, since the historical data may include historical load, historical photovoltaic power generation and historical wind power generation, the prediction accuracy of the electricity price prediction value is improved.
[0021] In a second aspect, an embodiment of the present application provides an electricity price prediction device, comprising: A first acquisition unit is used to acquire a historical data set related to electricity prices in a target area within a historical time period; the historical data set includes multiple historical data at different historical times; the multiple historical data include historical actual electricity prices; A first processing unit, configured to obtain initial electricity price vectors at different historical times according to the plurality of historical data at different historical times and a graph attention network; A second processing unit is used to sequentially input the initial electricity price vectors at different historical times into the trained recurrent neural network model for processing to obtain an electricity price prediction vector; the recurrent neural network model is trained by a pre-constructed gated recurrent unit and a self-attention mechanism; The first prediction unit is used to predict the electricity price prediction value of the target area at the target time based on the electricity price prediction vector.
[0022] In a third aspect, an embodiment of the present application provides a terminal device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, an electricity price prediction method as described in any one of the first aspects above is implemented.
[0023] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the electricity price prediction method as described in any one of the above-mentioned first aspects is implemented.
[0024] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is executed on a terminal device, the terminal device can execute the electricity price prediction method described in any one of the above-mentioned first aspects. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0026] Figure 1 is a flowchart of an implementation method of an electricity price prediction method provided in an embodiment of the present application; Figure 2 is a flowchart of an implementation method of an electricity price prediction method provided by another embodiment of the present application; Figure 3 This is a schematic diagram of generating an initial electricity price vector at a certain historical time provided by an embodiment of the present application; Figure 4 This is a schematic diagram of generating an electricity price prediction vector provided by an embodiment of the present application; Figure 5 is a flow chart of an implementation of an electricity price prediction method provided in yet another embodiment of the present application; Figure 6 This is a schematic diagram of the model training phase provided by an embodiment of the present application; Figure 7 This is a schematic diagram of a model testing phase provided by an embodiment of the present application; Figure 8 is a flow chart of an implementation of an electricity price prediction method provided by another embodiment of the present application; Fig. 9 It is a structural schematic diagram of an electricity price prediction device provided in one embodiment of the present application; Fig.10 It is a structural diagram of a terminal device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0027] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0028] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0029] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0030] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0031] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0032] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0033] At present, electricity price forecasting usually requires the integration of multiple data sources, such as historical electricity price data, weather data, electricity demand forecasts, market transaction data, etc. However, these data may come from different sources, in different formats, and have poor time synchronization, which makes data preprocessing and feature extraction complicated. When fusing multi-source data, existing technologies find it difficult to effectively handle the correlation and complex interactions between different data sources, especially when faced with unstructured and heterogeneous data. Traditional methods often find it difficult to ensure the accuracy of data fusion, which limits the performance of electricity price forecasting models.
[0034] On the other hand, electricity prices in the power market often have highly nonlinear and non-stationary characteristics. Especially under extreme weather, policy changes or emergencies, the volatility of electricity prices increases significantly. Traditional models often cannot capture these dynamic changes, resulting in a significant increase in prediction errors. Therefore, how to better capture the nonlinearity and non-stationarity in electricity prices remains a technical difficulty.
[0035] At present, in order to solve the problem of multi-source data fusion in electricity price forecasting, commonly used technical means include feature engineering and data preprocessing, ensemble learning algorithms, and deep learning models. However, these methods have their own shortcomings. Feature engineering relies on manual experience and it is difficult to fully explore the deep correlation of data; ensemble learning algorithms have limited prediction accuracy when processing extremely nonlinear and high-dimensional data; and deep learning models such as LSTM and RNN can learn the time information between data, but ignore the intrinsic relationship between different data sources, so they cannot effectively integrate information from different data sources to predict electricity prices.
[0036] In order to deal with the nonlinear and non-stationary problems in electricity price forecasting, machine learning and deep learning methods have been widely used in recent years. These methods, including long short-term memory networks (LSTM) and recurrent neural networks (RNN), can capture long-term dependencies in time series data to a certain extent. However, using only a single model is prone to overfitting problems when the data volume is insufficient or the data quality is not high, and in the complex electricity market, it is difficult to fully capture and utilize these long-term dependencies, resulting in reduced prediction accuracy.
[0037] Based on this, this application proposes a method for electricity price prediction, which can achieve effective integration of data from different sources, thereby improving the accuracy of electricity price prediction. At the same time, the model in this application can also enhance the ability to handle nonlinearity and non-stationarity in complex time series data, effectively capture the time information contained in long sequences, and thus improve the robustness and accuracy of the prediction model.
[0038] See also Figure 1 , Figure 1 This is a flowchart of an implementation of an electricity price prediction method provided in an embodiment of the present application. In the embodiment of the present application, the execution subject of the electricity price prediction method is a terminal device. The terminal device includes but is not limited to: a notebook, a desktop computer or a computer.
[0039] like Figure 1 As shown, the electricity price prediction method provided in the embodiment of the present application includes S101 to S104, which are described in detail as follows: In S101, a historical data set related to electricity prices in a target area within a historical time period is obtained; the historical data set includes a plurality of historical data at different historical times; the plurality of historical data includes historical actual electricity prices.
[0040] In actual applications, when a user needs to predict the electricity price in a target area, the user can make an electricity price prediction request to the terminal device.
[0041] In an embodiment of the present application, the terminal device detecting that the electricity price prediction request sent by the user may include: detecting a preset operation for the terminal device. The preset operation can be set according to actual needs and is not limited here. Exemplarily, the preset operation may be clicking on a preset control of the terminal device or clicking on a preset APP of the terminal device. Based on this, when the terminal device detects that its preset control is clicked, or its preset APP is clicked, it indicates that the preset operation is detected, that is, the above-mentioned electricity price prediction request is detected.
[0042] After receiving the electricity price prediction request, the terminal device can obtain a historical data set related to electricity prices in the target area within a historical time period. The historical time period can be determined according to actual needs and is not limited here.
[0043] In some possible embodiments, since data that is too early is usually not very useful, it does not have much benefit in improving the accuracy of electricity price prediction. At the same time, too much data is likely to lead to a longer time spent on electricity price prediction. Therefore, in order to improve the accuracy of electricity price prediction and improve the prediction efficiency, the start time of the historical time period can be the start time of the date corresponding to the first day of the seven days before the date of the current moment, and the end time of the historical time period can be the end time of the date corresponding to the seventh day of the seven days before the date of the current moment. Among them, the current moment specifically refers to the moment when the terminal device detects the electricity price prediction request.
[0044] For example, assuming that the current date is December 8, 2024, the start time of the historical time period is 00:00:00 on December 1, 2024, and the end time of the historical time period is 23:59:59 on December 7, 2024.
[0045] In an embodiment of the present application, the historical data set includes multiple historical data at different historical times. Among them, the multiple historical data include but are not limited to: historical actual electricity prices and historical power generation corresponding to various different power generation methods and other parameters. Among them, different power generation methods include but are not limited to: wind power generation, photovoltaic power generation (Photovoltaic, PV), thermal power generation and hydropower generation. Correspondingly, the historical power generation corresponding to various different power generation methods includes but is not limited to: historical wind power generation, historical photovoltaic power generation, historical thermal power generation and historical hydropower generation.
[0046] It should be noted that the above-mentioned different historical times may be times in hours, such as midnight, two o'clock, ten o'clock, etc.
[0047] In S102, initial electricity price vectors at different historical times are obtained based on the multiple historical data at different historical times and the graph attention network.
[0048] In an embodiment of the present application, after obtaining the above-mentioned historical data set, the terminal device can input multiple historical data of any historical time into the graph attention network for processing, so as to obtain the initial electricity price vector of the historical time.
[0049] Based on this, the terminal device can obtain the initial electricity price vector at different historical times.
[0050] In practical applications, the Graph Attention Network (GAT) is a deep learning model based on graph structured data. When processing graph structured data, the Graph Attention Network can automatically learn the weights of the edges between nodes, that is, the attention mechanism between nodes. Compared with traditional graph neural networks, GAT can aggregate the information of neighboring nodes more specifically, by assigning different attention weights to each neighboring node, focusing on information that is more valuable to the current node.
[0051] In one embodiment of the present application, since different historical data have different sources and formats, in order to improve the accuracy of the graph attention network in processing multiple historical data at different historical times, the terminal device can specifically perform the following steps: Figure 2 The steps S201-S202 shown in the figure obtain the initial electricity price vectors at different historical times, which are described in detail as follows: In S201, for any historical time, the remaining historical data at the historical time are divided based on the historical actual electricity price at the historical time to obtain a static graph at the historical time; the remaining historical data refers to the data in the multiple historical data except the historical actual electricity price; the static graph includes a central node and at least one other node, the central node is the historical actual electricity price, and the other nodes are the remaining historical data at the same historical time as the historical actual electricity price.
[0052] In S202, the static graphs at different historical times are sequentially input into the graph attention network for processing to obtain initial electricity price vectors at different historical times.
[0053] In this embodiment, for any historical time, the terminal device can divide the remaining historical data at the historical time according to the historical actual electricity price at the historical time, that is, divide all the historical data at the historical time into one place, and generate a static graph at the historical time through the relationship between the various historical data at the historical time. Among them, the remaining historical data refers to the data other than the historical actual electricity price in the multiple historical data.
[0054] In this embodiment, the static graph specifically refers to a static graph structure.
[0055] In practical applications, a static graph structure is a representation of a data structure, which is a graph form that is fixed at a specific moment. In this structure, the relationship between nodes (also called vertices) and edges is predefined and will not change during the observation period due to time or other dynamic factors. For example, a simple company organizational chart, in which departments are nodes and the reporting relationships between departments are edges, is a static graph structure when there is no organizational change.
[0056] In this embodiment, the static graph at any historical time includes a central node and at least one other node. The central node is the historical actual electricity price at the historical time, and the other nodes are the remaining historical data at the same historical time as the historical actual electricity price.
[0057] It should be noted that the specific method for generating a static graph can refer to the existing static graph structure generation method, which will not be described in detail here.
[0058] In this embodiment, after obtaining the static graphs at different historical times, the terminal device can sequentially input the static graphs at different historical times into the graph attention network for processing, thereby obtaining the initial electricity price vectors at different historical times.
[0059] For example, see Figure 3 , Figure 3 Schematic diagram of generating an initial electricity price vector at a certain historical time provided by an embodiment of the present application. Figure 3 As shown, the plurality of historical data includes electricity price, load, PV power generation, and weather.
[0060] In one embodiment of the present application, the graph attention network includes a node embedding layer. In order to obtain an accurate initial electricity price vector, the terminal device can implement step S202 by the following steps, which are described in detail as follows: For any historical time, the static graph at the historical time is input into the node embedding layer for transformation processing to obtain a high-dimensional feature vector corresponding to multiple historical data corresponding to the historical time; Using the attention mechanism to calculate the weight of each of the high-dimensional feature vectors, to obtain the attention weight corresponding to each of the high-dimensional feature vectors; the attention weight is used to describe the strength of the relationship between each of the high-dimensional feature vectors and the central node of the static graph; The attention weights of the high-dimensional feature vectors and the high-dimensional feature vectors are aggregated to obtain an initial electricity price vector at the historical time.
[0061] In this embodiment, for any historical time, the terminal device can input the static graph at the historical time into the node embedding layer for conversion processing, that is, prepare a corresponding feature vector for each node in the static graph in the node embedding layer, thereby obtaining a high-dimensional feature vector corresponding to multiple historical data corresponding to the historical time.
[0062] It should be noted that the above high-dimensional feature vectors may contain various information related to the corresponding nodes. For example, in an academic citation network, node features may include the subject category of the paper, the year of publication, the number of citations, etc.
[0063] After that, the terminal device can use the attention mechanism of the graph attention network to calculate the weights of each high-dimensional feature vector under the above historical time and obtain the attention weights corresponding to each high-dimensional feature vector. Among them, the attention weights are used to describe the strength of the relationship between each high-dimensional feature vector and the central node of the corresponding static graph.
[0064] In this embodiment, the terminal device can aggregate the attention weights and each high-dimensional feature vector of the above-mentioned historical time to achieve effective aggregation between the historical actual electricity price at the historical time and the remaining historical data, thereby obtaining the initial electricity price vector at the historical time.
[0065] In S103, the initial electricity price vectors at different historical times are input into the trained recurrent neural network model for processing in turn to obtain an electricity price prediction vector; the recurrent neural network model is trained by a pre-constructed gated recurrent unit and a self-attention mechanism.
[0066] In the embodiment of the present application, after obtaining the initial electricity price vectors at different historical times, the terminal device can sequentially input the initial electricity price vectors at different historical times into the trained recurrent neural network model for processing, thereby obtaining an electricity price prediction vector. The recurrent neural network model is trained by a pre-built gated recurrent unit and a self-attention mechanism.
[0067] In practical applications, the Gated Recurrent Unit (GRU) is a variant of the Recurrent Neural Network (RNN). RNN is mainly used to process sequence data, such as text, speech, time series, etc. However, traditional RNNs face the problem of gradient vanishing or gradient exploding when processing long sequence data, making it difficult to effectively learn long-distance dependencies. The emergence of GRU is to alleviate these problems. It introduces a gating mechanism to better control the flow and update of information.
[0068] For example, see Figure 4 , Figure 4 FIG. 1 is a schematic diagram of generating an electricity price prediction vector provided by an embodiment of the present application. Figure 4 As shown in the figure, assuming that the length of the historical time period is 7 days, and different historical times are all in hours, the total number of different times is 168. Therefore, the terminal device can sequentially , ... Input into the trained recurrent neural network model for processing to obtain the final electricity price prediction vector.
[0069] In one embodiment of the present application, when the recurrent neural network model includes a target gated recurrent unit, in order to obtain an accurate electricity price prediction vector, the terminal device can specifically implement step S103 according to the following steps, which are described in detail as follows: For any historical time, the initial electricity price vector at the historical time and the hidden state at the previous time before the historical time are input into the target gated recurrent unit for calculation to obtain the hidden state at the historical time; Use the attention mechanism to calculate the weights of hidden states at different historical times to obtain weight vectors at different historical times; The weight vectors and hidden states at different historical times are weighted and summed to obtain the electricity price prediction vector.
[0070] In this embodiment, for any historical time, the terminal device can input the initial electricity price vector at the historical time and the hidden state at the previous time before the historical time into the target gated recurrent unit for calculation to obtain the hidden state at the historical time.
[0071] Exemplary, combined Figure 4 , the terminal device can record the start time of the historical time period, i.e. The initial electricity price vector at time Input the target gated recurrent unit to get the hidden state , then The initial electricity price vector at time and hidden state Input the target gated recurrent unit to get the Hidden state at the moment , and so on, until we get Hidden state at the moment .
[0072] Based on this, the terminal device can use the target gated recurrent unit to extract the change information of multiple historical data at different times, so as to obtain the hidden states at different historical times.
[0073] In this embodiment, the terminal device can use the attention mechanism to calculate the weights of hidden states at different historical times to obtain weight vectors at different historical times.
[0074] Afterwards, the terminal device can perform weighted summation on the weight vectors and hidden states at different historical times to obtain the final electricity price prediction vector.
[0075] In S104, based on the electricity price prediction vector, a predicted electricity price value of the target area at the target time is predicted. In the embodiment of the present application, after obtaining the final electricity price prediction vector, the terminal device can input the electricity price prediction vector into the electricity price prediction model for prediction, thereby predicting the electricity price prediction value of the target area at the target time. The electricity price prediction model can be trained by a pre-built neural network model.
[0076] In one embodiment of the present application, in order to further improve the prediction accuracy of electricity prices, the terminal device may input the electricity price prediction vector into a multi-layer perceptron for processing to obtain a final electricity price prediction value.
[0077] In practical applications, a multilayer perceptron (MLP) is a feedforward neural network consisting of multiple neurons arranged in layers, including an input layer, one or more hidden layers, and an output layer.
[0078] In some possible embodiments, when the historical time period is 7 days and the different historical times are in hours, the target time may be the first moment after the end moment of the historical time period. For example, assuming that the end moment of the historical time period is 24:00:00 on December 7, 2024, the target time may be 01:00:00 on December 8, 2024.
[0079] From the above, it can be seen that the electricity price prediction method provided by the embodiment of the present application, since the graph attention network can realize the extraction of the intrinsic relationship between the electricity price and its different influencing parameters, therefore, the present application can realize the effective integration of different historical data through the graph attention network, thereby obtaining accurate initial electricity price vectors at different historical times; then, since the recurrent neural network model trained by the gated recurrent unit and the self-attention mechanism can enhance the processing ability of nonlinearity and non-stationarity in complex time series data, effectively capture the time information contained in the long sequence, and improve its own robustness and accuracy, therefore, the initial electricity price vectors at different historical times are input into the trained recurrent neural network model for processing in turn, and an accurate electricity price prediction vector can be obtained; finally, the present application, in combination with the graph attention network, the gated recurrent unit and the self-attention mechanism, can adapt to the complex electricity market, so that the electricity price prediction value of the target area at the target time can be accurately predicted based on the electricity price prediction vector obtained above, thereby improving the prediction accuracy of the electricity price.
[0080] See also Figure 5 , Figure 5 FIG. 1 is a flowchart of an implementation method of an electricity price prediction method provided by another embodiment of the present application. Figure 5 As shown, relative to Figure 1 Corresponding to the embodiment, the electricity price prediction method provided in this embodiment may further include S301 to S303 before step S104, as detailed below: In S301, a characteristic data set related to electricity prices in the target area within a set time period is obtained; the characteristic data set includes a plurality of characteristic data at various time points within the set time period.
[0081] In S302, the feature data set is divided into a training set, a validation set and a test set based on a set ratio; each sample data in the training set, the validation set and the test set includes multiple feature data within a set time length; the set time length is determined by the length of the historical time period.
[0082] In S303, the pre-constructed gated recurrent unit and self-attention mechanism are trained and tested based on the training set, the validation set and the test set to obtain the recurrent neural network model.
[0083] In this embodiment, the terminal device can also obtain the electricity price of the target area at each time point within a set time period.
[0084] The time period can be set according to actual needs and is not limited here.
[0085] It should be noted that the end time of the set time period is before the start time of the historical time period. The duration of the set time period may include the durations of multiple historical time periods.
[0086] In this embodiment, the time point is a time in hours, such as two o'clock, twelve o'clock, etc.
[0087] The characteristic data set includes a plurality of characteristic data at each time point within a set time period, and the plurality of characteristic data includes load, photovoltaic power generation, wind power generation, and the like.
[0088] In this embodiment, after obtaining the characteristic data set related to the electricity price, the terminal device can divide the characteristic data set into a training set, a validation set, and a test set according to a set ratio. Each sample data in the training set, the validation set, and the test set includes multiple characteristic data within a set time period. The set time period is determined by the length of the historical time period.
[0089] Each sample data in the training set, validation set and test set may also include the electricity price within the prediction time period corresponding to the set time period, wherein the prediction time period may be one day.
[0090] It should be noted that the training set is used to train the model so that the model can learn the patterns in the data; the validation set is used to adjust the model's hyperparameters during the training process, such as the learning rate, the number of hidden layer nodes, etc., to prevent overfitting; the test set is used to evaluate the final performance of the model.
[0091] In this embodiment, the terminal device can train and test the pre-built gated recurrent unit and self-attention mechanism based on the training set, the verification set and the test set to obtain a recurrent neural network model.
[0092] For example, taking the setting time period as seven days, and the corresponding prediction time period as one day, as an example, using the multiple feature data corresponding to different time points of the setting time period, that is, 168 time points, to predict the electricity prices of the corresponding 24 time points in the next day, in the training stage of the recurrent neural network model, the input of each prediction of the model is the data of 168 time points of different features including electricity prices in the historical seven days, and the output can predict the electricity price at a future time point; then, the sliding window is used to gradually predict the electricity prices at different time points in the future day, for example, using arrive data to predict The data at the time point is then used arrive data to predict Data at a point in time.
[0093] For example, see Figure 6 , Figure 6 Schematic diagram of the model training phase provided by an embodiment of the present application. Figure 6As shown in the figure, other influencing factors are used to describe the characteristic data related to the electricity price. The figure shows that the learning module is used to combine the above multiple characteristic data and electricity price according to Figure 2 The steps S201-S202 shown in the figure obtain the corresponding initial electricity price vector. The time series information learning module is used to Figure 1 The step S103 shown obtains the electricity price prediction vector.
[0094] In the test phase, since there is no multiple feature data for the next 24 time points, the sliding window algorithm is used to control the sliding window to move backward continuously, and the predicted different feature data are added to the sliding window as the actual feature data. For example, for any other feature data V excluding electricity price, first use arrive The value of gets the predicted value for the first time point in the future day , and then the predicted value Move into the sliding window and Move out of the sliding window, that is, use arrive The actual value and the predicted value of the move-in To predict , and then gradually predict the characteristic data of the next day in this way; for the electricity price P, use arrive The real value including electricity price is used to predict The electricity price at the time, and then use different feature data including electricity price to arrive The true value of The predicted value at the time The electricity price at the moment can then be gradually predicted in this way for the next day. Based on this, the terminal device can obtain the final recurrent neural network model.
[0095] For example, see Figure 7 , Figure 7 Schematic diagram of the model testing phase provided by an embodiment of the present application. Figure 7 As shown in the figure, other influencing factors are used to describe the characteristic data related to the electricity price. The figure shows that the learning module is used to combine the above multiple characteristic data and electricity price according to Figure 2 The steps S201-S202 shown in the figure obtain the corresponding initial electricity price vector. The time series information learning module is used to Figure 1 The step S103 shown obtains the electricity price prediction vector. The multi-layer perceptron MLP is used to process the electricity price prediction vector to obtain the electricity price prediction value at a certain time in the future day.
[0096] It can be seen from the above that the electricity price prediction method provided in this embodiment improves the training accuracy of the recurrent neural network model through the training set, the validation set and the test set, thereby improving the prediction accuracy of the recurrent neural network model.
[0097] In one embodiment of the present application, when the target time is the start time of the target time period, in order to achieve accurate prediction of the electricity price at different prediction times within the target time period and improve the prediction accuracy of the electricity price prediction values at different prediction times, the terminal device may also perform the following operations: Figure 8 Steps S401~S402 shown.
[0098] Based on this, see Figure 8 , Figure 8 FIG. 1 is a flowchart of an implementation method of an electricity price prediction method provided by another embodiment of the present application. Figure 8 As shown, relative to Figure 1 Corresponding to the embodiment, the electricity price prediction method provided in this embodiment may further include S401 to S402 after step S104, as detailed below: In S401, a prediction operation is performed on the data sets in each data window based on the sliding window algorithm to obtain prediction data at different prediction times in the target time period; the size of each data window is determined by the total number of all historical times in the historical time period; the start time of the Nth data set is the K-(N-1)th historical time in the historical time period, and the end time of the Nth data set is the N-1th prediction time in the target time period; K is the total number; the historical times in the historical time period are sorted in order from late to early; the Nth data set includes the remaining historical data from the K-(N-1)th historical time to the prediction data of the N-1th prediction time; the remaining historical data refers to any data in the historical data set except the historical actual electricity price; the prediction data corresponds to the remaining historical data.
[0099] In practical applications, the sliding window algorithm is an optimization technique for processing sequence data such as arrays and strings. It solves various problems by maintaining a window (usually a subsequence) and sliding this window over the sequence, such as finding subsequences that meet specific conditions, calculating certain statistics of subsequences, etc. For example, in an array of length n, we can define a window of size k. This window can initially be placed at the beginning of the array, covering the first k elements. Then, by gradually moving this window (moving the position of one element each time), subarrays at different positions can be examined.
[0100] In this embodiment, the terminal device may use a sliding window algorithm to perform a prediction operation on a data set in each data window, thereby obtaining prediction data at different prediction times in a target time period.
[0101] It should be noted that each time the window is slid, a new data window can be obtained.
[0102] In this embodiment, the size of each data window is determined by the total number of all historical times in the historical time period. For example, assuming that the total number of all historical times in the historical time period is 168, the size of each data window is 168, that is, it is used to accommodate data at 168 time points.
[0103] It should be noted that the start time of the Nth data set is the K-(N-1)th historical time in the historical time period, the end time of the Nth data set is the N-1th predicted time in the target time period, K is the total number, and each historical time in the historical time period is sorted from late to early.
[0104] In this embodiment, the Nth data set includes the remaining historical data from the K-(N-1)th historical time to the predicted data of the N-1th predicted time. The remaining historical data refers to any data in the historical data set except the historical actual electricity price, and the predicted data corresponds to the remaining historical data.
[0105] For example, taking the total number of all historical times in the historical time period as 168 and the length of the historical time period as seven days, the start time of the first data set is the 168th historical time in the historical time period, that is, the first time point of the first day (such as 01:00:00), and the end time of the first data set is the 0th prediction time in the target time period, that is, the 1st historical time in the historical time period, that is, the last time point of the seventh day (such as 24:00:00).
[0106] For example, for any other historical data H excluding electricity prices, first use arrive The value of gets the predicted value of the first prediction time in the target time period corresponding to the remaining historical data H , and then the predicted value Move into the sliding window and Move out of the sliding window, that is, use arrive The actual value and the predicted value of the move-in To predict , and then gradually predict the forecast data for the remaining forecast times within the target time period in this way.
[0107] In S402, based on the sliding window algorithm, the data to be predicted in each prediction window is returned in turn to execute the step of inputting the multiple historical data at different historical times into the graph attention network for processing, and obtaining the initial electricity price vector at different historical times and the subsequent steps to obtain the electricity price prediction value at different prediction times after the target time; the size of each prediction window is determined by the total number of historical times in the historical time period; the Nth group of data to be predicted includes multiple historical data from the K-(N-1)th historical time to each prediction data at the N-1th prediction time, and the electricity price prediction value from the target time to the N-1th prediction time.
[0108] In this embodiment, the terminal device can use a sliding window algorithm to return to execute steps S102 to S104 in sequence for the data to be predicted in each prediction window, so as to obtain electricity price prediction values at different prediction times after the target time.
[0109] It should be noted that each time the window is slid, a new prediction window can be obtained.
[0110] In this embodiment, the size of each prediction window is determined by the total number of historical times in the historical time period.
[0111] The Nth group of data to be predicted includes multiple historical data from the K-(N-1)th historical time to each prediction data of the N-1th prediction time, and the electricity price prediction value from the target time to the N-1th prediction time.
[0112] It should be noted that the first predicted time is the target time.
[0113] Assuming N is two, the length of the historical time period is seven days, and the length of the corresponding target time period is one day, the electricity prices of the 24 time points corresponding to the prediction time period of the future day are predicted by using the multiple characteristic data corresponding to the different time points of the set time period, that is, 168 time points. For example, the first group of data to be predicted includes multiple historical data of the 167th historical time (i.e., the second time point of the first day), multiple historical data of the 166th historical time (i.e., the third time point of the first day)... The prediction data of the first prediction time (i.e., the first time point in the target time period, i.e., the target time), and the predicted value of the electricity price at the first prediction time. Based on this, the terminal device can perform steps S102~S104 according to the above first group of data to be predicted to obtain the predicted value of the electricity price at the second prediction time of the target time period.
[0114] By analogy, the electricity price forecast values corresponding to all forecast times within the target time period can be obtained.
[0115] For example, for the electricity price P, use arrive The real value including electricity price is used to predict The electricity price at the time, and then use different forecast data including electricity price (i.e. data to be predicted) to arrive The true value of The predicted value at the time The electricity price at the time is then gradually predicted in this way, and the electricity price forecast values of different forecast times other than the target time in the target time period are predicted.
[0116] From the above, it can be seen that the electricity price prediction method provided in this embodiment, through the sliding window algorithm, the terminal device can use the predicted electricity price forecast value of the previous moment as one of the historical data for predicting the electricity price forecast value of the next moment, thereby realizing accurate prediction of the electricity price forecast value in the future period of time.
[0117] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0118] Corresponding to the electricity price prediction method described in the above embodiment, Fig. 9 The schematic diagram of the structure of an electricity price prediction device provided by an embodiment of the present application is shown. For the convenience of explanation, only the part related to the embodiment of the present application is shown. Fig. 9 The electricity price prediction device 500 includes: a first acquisition unit 51, a first processing unit 52, a second processing unit 53 and a first prediction unit 54. Among them: The first acquisition unit 51 is used to acquire a historical data set related to electricity prices in a target area within a historical time period; the historical data set includes a plurality of historical data at different historical times; the plurality of historical data includes historical actual electricity prices.
[0119] The first processing unit 52 is used to obtain initial electricity price vectors at different historical times according to the multiple historical data at different historical times and the graph attention network.
[0120] The second processing unit 53 is used to input the initial electricity price vectors at different historical times into the trained recurrent neural network model for processing in turn to obtain an electricity price prediction vector; the recurrent neural network model is trained by a pre-constructed gated recurrent unit and a self-attention mechanism.
[0121] The first prediction unit 54 is used to predict the electricity price prediction value of the target area at the target time based on the electricity price prediction vector.
[0122] In one embodiment of the present application, the electricity price prediction device 500 further includes: a first division unit; correspondingly, the first processing unit 52 specifically includes: an input unit. Among them: The first division unit is used to divide the remaining historical data at any historical time based on the historical actual electricity price at the historical time to obtain a static graph at the historical time; the remaining historical data refers to the data in the multiple historical data except the historical actual electricity price; the static graph includes a central node and at least one other node, the central node is the historical actual electricity price, and the other nodes are the remaining historical data at the same historical time as the historical actual electricity price.
[0123] The input unit is used to sequentially input the static graphs at different historical times into the graph attention network for processing to obtain the initial electricity price vectors at different historical times.
[0124] In one embodiment of the present application, the graph attention network includes a node embedding layer; the input unit specifically includes: a conversion unit, a first calculation unit and an aggregation unit. Wherein: The conversion unit is used to input the static graph at any historical time into the node embedding layer for conversion processing, so as to obtain a high-dimensional feature vector corresponding to multiple historical data corresponding to the historical time.
[0125] The first calculation unit is used to use the attention mechanism to perform weight calculation on each of the high-dimensional feature vectors to obtain the attention weight corresponding to each of the high-dimensional feature vectors; the attention weight is used to describe the relationship strength between each of the high-dimensional feature vectors and the central node of the static graph.
[0126] The aggregation unit is used to perform aggregation processing on the attention weights of each of the high-dimensional feature vectors and each of the high-dimensional feature vectors to obtain an initial electricity price vector under the historical time.
[0127] In one embodiment of the present application, the recurrent neural network model includes a target gated recurrent unit; the second processing unit 53 specifically includes: a second calculation unit, a third calculation unit and a summing unit. Among them: The second calculation unit is used to input the initial electricity price vector at any historical time and the hidden state at a previous time before the historical time into the target gated loop unit for calculation to obtain the hidden state at the historical time.
[0128] The third computing unit is used to use the attention mechanism to perform weight calculations on hidden states at different historical times to obtain weight vectors at different historical times.
[0129] The summing unit is used to perform weighted summation on the weight vectors and hidden states at different historical times to obtain the electricity price prediction vector.
[0130] In one embodiment of the present application, the first prediction unit 54 specifically includes: a third processing unit.
[0131] The third processing unit is used to input the electricity price prediction vector into a multi-layer perceptron for processing to obtain the electricity price prediction value.
[0132] In one embodiment of the present application, the target time is the start time of the target time period; the electricity price prediction device 500 further includes: a second prediction unit and an execution unit. Among them: The second prediction unit is used to perform prediction operations on the data sets in each data window based on the sliding window algorithm to obtain prediction data at different prediction times in the target time period; the size of each data window is determined by the total number of all historical times in the historical time period; the start time of the Nth data set is the K-(N-1)th historical time in the historical time period, and the end time of the Nth data set is the N-1th prediction time in the target time period; K is the total number; the historical times in the historical time period are sorted from late to early; the Nth data set includes the remaining historical data from the K-(N-1)th historical time to the prediction data of the N-1th prediction time; the remaining historical data refers to any data in the historical data set except the historical actual electricity price; the prediction data corresponds to the remaining historical data.
[0133] The execution unit is used to return to execute the steps of inputting the multiple historical data at different historical times into the graph attention network for processing based on the sliding window algorithm, and obtaining the initial electricity price vectors at different historical times and the subsequent steps to obtain the electricity price prediction values at different prediction times after the target time for the data to be predicted in each prediction window; the size of each prediction window is determined by the total number of historical times in the historical time period; the Nth group of data to be predicted includes multiple historical data from the K-(N-1)th historical time to each prediction data at the N-1th prediction time, and the electricity price prediction values from the target time to the N-1th prediction time.
[0134] In one embodiment of the present application, the electricity price prediction device 500 further includes: a second acquisition unit, a second division unit and a training unit. The second acquisition unit is used to acquire a characteristic data set related to electricity prices in the target area within a set time period; the characteristic data set includes a plurality of characteristic data at each time point within the set time period.
[0135] The second division unit is used to divide the feature data set into a training set, a validation set and a test set based on a set ratio; each sample data in the training set, the validation set and the test set includes multiple feature data within a set time length; the set time length is determined by the length of the historical time period.
[0136] The training unit is used to train and test the pre-constructed gated recurrent unit and self-attention mechanism based on the training set, the verification set and the test set to obtain the recurrent neural network model.
[0137] In one embodiment of the present application, the plurality of historical data further includes: historical loads and historical power generation corresponding to various power generation modes.
[0138] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0139] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0140] Fig.10 This is a schematic diagram of the structure of a terminal device provided in an embodiment of the present application. Fig.10 As shown, the terminal device 6 of this embodiment includes: at least one processor 60 ( Fig.10 Only one is shown in the figure) a processor, a memory 61, and a computer program 62 stored in the memory 61 and executable on the at least one processor 60, and when the processor 60 executes the computer program 62, the steps in any of the above-mentioned electricity price prediction method embodiments are implemented.
[0141] The terminal device may include, but is not limited to, a processor 60 and a memory 61. Those skilled in the art will appreciate that Fig.10It is only an example of the terminal device 6 and does not constitute a limitation on the terminal device 6. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.
[0142] The processor 60 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0143] In some embodiments, the memory 61 may be an internal storage unit of the terminal device 6, such as a memory of the terminal device 6. In other embodiments, the memory 61 may also be an external storage device of the terminal device 6, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 6. Further, the memory 61 may include both an internal storage unit and an external storage device of the terminal device 6. The memory 61 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program. The memory 61 may also be used to temporarily store data that has been output or is to be output.
[0144] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0145] An embodiment of the present application provides a computer program product. When the computer program product runs on a terminal device, the terminal device can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0146] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the terminal device, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0147] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0148] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A method for predicting electricity prices, characterized in that: include: Acquire a historical data set related to electricity prices in a target area within a historical time period; the historical data set includes multiple historical data at different historical times; The plurality of historical data include historical actual electricity prices; According to the multiple historical data at different historical times and the graph attention network, initial electricity price vectors at different historical times are obtained; The initial electricity price vectors at different historical times are sequentially input into a recurrent neural network model for processing to obtain an electricity price prediction vector; the recurrent neural network model is trained by a pre-constructed gated recurrent unit and a self-attention mechanism; Based on the electricity price prediction vector, a predicted electricity price value of the target area at the target time is predicted.
2. The electricity price prediction method according to claim 1, characterized in that: Before obtaining the initial electricity price vectors at different historical times according to the multiple historical data at different historical times and the graph attention network, the method further includes: For any historical time, the remaining historical data at the historical time are divided based on the historical actual electricity price at the historical time to obtain a static graph at the historical time; the remaining historical data refers to data other than the historical actual electricity price among the multiple historical data; the static graph includes a central node and at least one other node, the central node is the historical actual electricity price, and the other nodes are the remaining historical data at the same historical time as the historical actual electricity price; Correspondingly, the initial electricity price vectors at different historical times are obtained according to the multiple historical data at different historical times and the graph attention network, including: The static graphs at different historical times are sequentially input into the graph attention network for processing to obtain the initial electricity price vectors at different historical times.
3. The electricity price prediction method according to claim 2, characterized in that: The graph attention network includes a node embedding layer; the static graphs at different historical times are sequentially input into the graph attention network for processing to obtain initial electricity price vectors at different historical times, including: For any historical time, the static graph at the historical time is input into the node embedding layer for transformation processing to obtain a high-dimensional feature vector corresponding to multiple historical data corresponding to the historical time; Using the attention mechanism to calculate the weight of each of the high-dimensional feature vectors, to obtain the attention weight corresponding to each of the high-dimensional feature vectors; the attention weight is used to describe the strength of the relationship between each of the high-dimensional feature vectors and the central node of the static graph; The attention weights of the high-dimensional feature vectors and the high-dimensional feature vectors are aggregated to obtain an initial electricity price vector at the historical time.
4. The electricity price prediction method according to claim 1, characterized in that: The recurrent neural network model includes a target gated recurrent unit; The initial electricity price vectors at different historical times are sequentially input into the trained recurrent neural network model for processing to obtain an electricity price prediction vector, including: For any historical time, the initial electricity price vector at the historical time and the hidden state at the previous time before the historical time are input into the target gated recurrent unit for calculation to obtain the hidden state at the historical time; Use the attention mechanism to calculate the weights of hidden states at different historical times to obtain weight vectors at different historical times; The weight vectors and hidden states at different historical times are weighted and summed to obtain the electricity price prediction vector.
5. The electricity price prediction method according to claim 1, characterized in that: The step of predicting the electricity price forecast value of the target area at the target time based on the electricity price forecast vector includes: The electricity price prediction vector is input into a multi-layer perceptron for processing to obtain the electricity price prediction value.
6. The electricity price prediction method according to any one of claims 1 to 5, characterized in that: The target time is the start time of the target time period; After predicting the electricity price forecast value of the target area at the target time based on the electricity price forecast vector, the method further includes: Based on the sliding window algorithm, a prediction operation is performed on the data sets in each data window to obtain the prediction data at different prediction times in the target time period; the size of each data window is determined by the total number of all historical times in the historical time period; the start time of the Nth data set is the K-(N-1)th historical time in the historical time period, and the end time of the Nth data set is the N-1th prediction time in the target time period; K is the total number; the various historical times in the historical time period are sorted in order from late to early; the Nth data set includes the remaining historical data from the K-(N-1)th historical time to the prediction data of the N-1th prediction time; the remaining historical data refers to any data in the historical data set except the historical actual electricity price; the prediction data corresponds to the remaining historical data; Based on the sliding window algorithm, the data to be predicted in each prediction window is returned in turn to execute the step of inputting the multiple historical data at different historical times into the graph attention network for processing, and obtaining the initial electricity price vector at different historical times and the subsequent steps, so as to obtain the electricity price prediction value at different prediction times after the target time; the size of each prediction window is determined by the total number of historical times in the historical time period; the Nth group of data to be predicted includes multiple historical data from the K-(N-1)th historical time to each prediction data at the N-1th prediction time, and the electricity price prediction value from the target time to the N-1th prediction time.
7. The electricity price prediction method according to any one of claims 1 to 5, characterized in that: Before sequentially inputting the initial electricity price vectors at different historical times into the trained recurrent neural network model for processing to obtain the electricity price prediction vector, the method further includes: Acquire a characteristic data set related to electricity prices in the target area within a set time period; the characteristic data set includes a plurality of characteristic data at each time point within the set time period; The feature data set is divided into a training set, a validation set and a test set based on a set ratio; each sample data in the training set, the validation set and the test set includes a plurality of feature data within a set time period; the set time period is determined by the length of the historical time period; The pre-constructed gated recurrent unit and self-attention mechanism are trained and tested based on the training set, the validation set and the test set to obtain the recurrent neural network model.
8. The electricity price prediction method according to any one of claims 1 to 5, characterized in that: The plurality of historical data also include: historical loads and historical power generation corresponding to various power generation modes.
9. An electricity price prediction device, characterized in that: include: A first acquisition unit is used to acquire a historical data set related to electricity prices in a target area within a historical time period; the historical data set includes multiple historical data at different historical times; the multiple historical data include historical actual electricity prices; A first processing unit, configured to obtain initial electricity price vectors at different historical times according to the plurality of historical data at different historical times and a graph attention network; A second processing unit is used to sequentially input the initial electricity price vectors at different historical times into the trained recurrent neural network model for processing to obtain an electricity price prediction vector; the recurrent neural network model is trained by a pre-constructed gated recurrent unit and a self-attention mechanism; The first prediction unit is used to predict the electricity price prediction value of the target area at the target time based on the electricity price prediction vector.
10. A terminal 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 electricity price prediction method according to any one of claims 1 to 8 is implemented.
11. A computer program product, characterized in that The invention comprises a computer program, which implements the electricity price prediction method according to any one of claims 1 to 8 when being executed.