+

CN116703644A - A short-term power load forecasting method based on Attention-RNN - Google Patents

A short-term power load forecasting method based on Attention-RNN Download PDF

Info

Publication number
CN116703644A
CN116703644A CN202310388456.9A CN202310388456A CN116703644A CN 116703644 A CN116703644 A CN 116703644A CN 202310388456 A CN202310388456 A CN 202310388456A CN 116703644 A CN116703644 A CN 116703644A
Authority
CN
China
Prior art keywords
rnn
power load
short
attention
forecasting
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310388456.9A
Other languages
Chinese (zh)
Inventor
杨玉强
卢峰
麻吕斌
郁春雷
戴昶
谢志铎
王峰
颜奔
陈婷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
State Grid Zhejiang Electric Power Co Ltd
Zhejiang Huayun Information Technology Co Ltd
Huzhou Power Supply Co of State Grid Zhejiang Electric Power Co Ltd
Anji Power Supply Co of State Grid Zhejiang Electric Power Co Ltd
Original Assignee
State Grid Zhejiang Electric Power Co Ltd
Zhejiang Huayun Information Technology Co Ltd
Huzhou Power Supply Co of State Grid Zhejiang Electric Power Co Ltd
Anji Power Supply Co of State Grid Zhejiang Electric Power Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by State Grid Zhejiang Electric Power Co Ltd, Zhejiang Huayun Information Technology Co Ltd, Huzhou Power Supply Co of State Grid Zhejiang Electric Power Co Ltd, Anji Power Supply Co of State Grid Zhejiang Electric Power Co Ltd filed Critical State Grid Zhejiang Electric Power Co Ltd
Priority to CN202310388456.9A priority Critical patent/CN116703644A/en
Publication of CN116703644A publication Critical patent/CN116703644A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/06Energy or water supply
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/048Activation functions
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/04Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/06Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
    • G06Q10/063Operations research, analysis or management
    • G06Q10/0639Performance analysis of employees; Performance analysis of enterprise or organisation operations
    • G06Q10/06393Score-carding, benchmarking or key performance indicator [KPI] analysis
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y04INFORMATION OR COMMUNICATION TECHNOLOGIES HAVING AN IMPACT ON OTHER TECHNOLOGY AREAS
    • Y04SSYSTEMS INTEGRATING TECHNOLOGIES RELATED TO POWER NETWORK OPERATION, COMMUNICATION OR INFORMATION TECHNOLOGIES FOR IMPROVING THE ELECTRICAL POWER GENERATION, TRANSMISSION, DISTRIBUTION, MANAGEMENT OR USAGE, i.e. SMART GRIDS
    • Y04S10/00Systems supporting electrical power generation, transmission or distribution
    • Y04S10/50Systems or methods supporting the power network operation or management, involving a certain degree of interaction with the load-side end user applications

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Human Resources & Organizations (AREA)
  • Theoretical Computer Science (AREA)
  • Economics (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Health & Medical Sciences (AREA)
  • Data Mining & Analysis (AREA)
  • Tourism & Hospitality (AREA)
  • Marketing (AREA)
  • General Business, Economics & Management (AREA)
  • Development Economics (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Game Theory and Decision Science (AREA)
  • Artificial Intelligence (AREA)
  • Operations Research (AREA)
  • Quality & Reliability (AREA)
  • Educational Administration (AREA)
  • General Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Primary Health Care (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Water Supply & Treatment (AREA)
  • Public Health (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses a short-term power load prediction method based on an Attention-RNN, and relates to the technical field of power system load prediction. The current power load prediction has the problem that nonlinear and non-stationary data cannot be processed; the method comprises the following steps: based on an Attention mechanism, quantifying the implicit time sequence correlation among time nodes in a load time sequence, and extracting cross-correlation characteristics; then, the memory characteristics of the RNN network are used to extract trend features and cycle features implicit in the load long-term sequence based on the RNN, and the time-series dependence of the load sequence is mined. And mining the time correlation and long-term dependence characteristics of the load time sequence from the historical data by using an attribute mechanism and RNN network characteristics to form a short-term power load prediction model based on the attribute-RNN, and carrying out short-term power load prediction according to the short-term power load prediction model. According to the method, the load time sequence characteristics and the external multidimensional influence factors are comprehensively considered, and compared with a traditional prediction method, the accuracy of short-term power load prediction is effectively improved.

Description

一种基于Attention-RNN的短期电力负荷预测方法A short-term power load forecasting method based on Attention-RNN

技术领域technical field

本发明涉及电力系统负荷预测技术领域,尤其涉及一种基于Attention-RNN的短期电力负荷预测方法。The invention relates to the technical field of power system load forecasting, in particular to an Attention-RNN-based short-term power load forecasting method.

背景技术Background technique

短期电力负荷预测是指对未来几个小时或几天内电网的电力负荷进行预测,以便电力公司能够合理规划电力生产和供应,从而保证电网稳定运行和满足用户用电需求。短期电力负荷预测通常采用基于历史数据的统计和机器学习方法,其背后涉及的技术主要包括数据采集、预处理、特征提取、模型构建和评估等。Short-term power load forecasting refers to the prediction of the power load of the power grid in the next few hours or days, so that the power company can reasonably plan power production and supply, so as to ensure the stable operation of the power grid and meet the electricity demand of users. Short-term power load forecasting usually adopts statistical and machine learning methods based on historical data, and the technologies involved mainly include data collection, preprocessing, feature extraction, model construction and evaluation, etc.

首先,对电力负荷进行预测需要收集大量的历史数据,包括天气、节假日、工作日/休息日等各种因素。这些数据通过传感器、天气预报、电表等手段进行采集,形成一个大数据集。接下来,对数据进行预处理,包括数据清洗、归一化、去噪等操作,以确保数据质量和可靠性。First of all, forecasting electric load needs to collect a large amount of historical data, including various factors such as weather, holidays, working days/rest days, etc. These data are collected through sensors, weather forecasts, electric meters and other means to form a large data set. Next, preprocess the data, including data cleaning, normalization, denoising, etc., to ensure data quality and reliability.

特征提取是构建预测模型的关键步骤之一,通常需要通过时间序列分析、频域分析、小波分析等方法从数据中提取有用的特征。例如,可以从历史数据中提取出一周内每天的平均负荷、最高负荷、最低负荷、负荷波动等特征。Feature extraction is one of the key steps in building a forecasting model, and it is usually necessary to extract useful features from data through methods such as time series analysis, frequency domain analysis, and wavelet analysis. For example, features such as the average load, the highest load, the lowest load, and load fluctuations of each day in a week can be extracted from historical data.

模型构建是短期电力负荷预测的核心部分,需要选择合适的模型并对其进行训练。常用的模型包括回归模型、时间序列模型、神经网络模型等。其中,神经网络模型在短期电力负荷预测中表现出色,特别是长短期记忆网络(RNN)等深度学习模型,可以自动学习特征并具有很好的预测能力。Model construction is the core part of short-term power load forecasting, and it is necessary to select an appropriate model and train it. Commonly used models include regression models, time series models, neural network models, etc. Among them, neural network models perform well in short-term power load forecasting, especially deep learning models such as long-term short-term memory networks (RNN), which can automatically learn features and have good predictive capabilities.

最后,为了评估预测模型的准确性和性能,需要使用一些指标来度量预测误差。例如,可以使用均方根误差(RMSE)来评估预测结果的误差大小,或者使用平均绝对误差(MAPE)来评估预测结果的偏差程度。Finally, in order to evaluate the accuracy and performance of a predictive model, some metrics are needed to measure the forecast error. For example, the root mean square error (RMSE) can be used to assess the error size of the forecast results, or the mean absolute error (MAPE) can be used to assess the degree of deviation of the forecast results.

当前的电力负荷预测算法虽然已经较为成熟,但仍存在一些不足,例如无法处理非线性问题、无法处理非平稳数据等问题。因此需要更加先进的算法来提高预测准确度。Although the current power load forecasting algorithm is relatively mature, there are still some shortcomings, such as the inability to deal with nonlinear problems and the inability to deal with non-stationary data. Therefore, more advanced algorithms are needed to improve the prediction accuracy.

发明内容Contents of the invention

本发明要解决的技术问题和提出的技术任务是对现有技术方案进行完善与改进,提供一种基于Attention-RNN的短期电力负荷预测方法,以提高短期电力负荷预测精度的目的。为此,本发明采取以下技术方案。The technical problem to be solved and the technical task proposed by the present invention are to improve and improve the existing technical solutions, and provide a short-term power load forecasting method based on Attention-RNN, in order to improve the accuracy of short-term power load forecasting. For this reason, the present invention takes the following technical solutions.

一种基于Attention-RNN的短期电力负荷预测方法,包括以下步骤:A short-term power load forecasting method based on Attention-RNN, comprising the following steps:

1)确定包括气温、节假日信息的多元异构数据的特征化表示方法,定义考虑多种负荷影响因素的短期负荷预测的数据集格式,构建日前电力负荷预测的单步预测与多步预测基本框架;1) Determine the characteristic representation method of multivariate heterogeneous data including temperature and holiday information, define the data set format for short-term load forecasting considering multiple load influencing factors, and construct the basic framework of single-step forecasting and multi-step forecasting for day-ahead power load forecasting ;

2)根据步骤1)形成的日前电力负荷预测基本框架,基于Attention机制量化负荷时间序列中各时间节点间所隐含的时序相关性,形成日前电力负荷预测Attention模块;2) According to the basic framework of day-ahead power load forecasting formed in step 1), based on the Attention mechanism, quantify the time-series correlation implied between each time node in the load time series, and form the day-ahead power load forecasting Attention module;

3)根据步骤1)形成的日前电力负荷预测基本框架,基于RNN提取负荷长期序列中所隐含的趋势特征以及周期特征,挖掘负荷序列的时序依赖性,形成日前电力负荷预测RNN模块;3) According to the basic framework of the day-ahead power load forecasting formed in step 1), based on the RNN, the hidden trend features and cycle features in the long-term load sequence are extracted, and the timing dependence of the load sequence is mined to form the RNN module of the day-ahead power load forecasting;

4)基于步骤2)与步骤3)形成的Attention模块和RNN模块,构建串行与并行两种模型集成框架,利用Attention机制及RNN网络特性,从历史数据中挖掘负荷时序的时间相关性与长期依赖特征,形成基于Attention-RNN的短期电力负荷预测模型,根据短期电力负荷预测模型进行短期电力负荷预测。4) Based on the Attention module and RNN module formed in step 2) and step 3), build a serial and parallel model integration framework, and use the Attention mechanism and RNN network characteristics to mine the time correlation and long-term load timing from historical data. Depending on the feature, a short-term power load forecasting model based on Attention-RNN is formed, and short-term power load forecasting is performed according to the short-term power load forecasting model.

本技术方案在RNN的基础上,通过引入Attention机制,可以在长序列数据中自适应地学习到关键信息,并且能够更加准确地捕捉序列中的变化和趋势。与传统的RNN模型相比,利用Attention机制的RNN模型能够更好地处理长时依赖问题,并且在对历史数据进行建模时能够自适应地调整权重,提高模型的预测精度。由于引入了注意力机制,可以自适应地捕捉时间序列数据中的关键信息。该方法通常采用门控循环单元和注意力机制相结合,能够提高长序列数据的建模能力,并且具有较强的泛化能力。能更好地处理长时序列数据,并且在输入特征不确定或数据噪声较大的情况下表现更加优异。Based on RNN, this technical solution can adaptively learn key information in long sequence data by introducing the Attention mechanism, and can more accurately capture changes and trends in the sequence. Compared with the traditional RNN model, the RNN model using the Attention mechanism can better deal with the long-term dependence problem, and can adaptively adjust the weight when modeling historical data to improve the prediction accuracy of the model. Due to the introduction of attention mechanism, key information in time series data can be adaptively captured. This method usually uses a combination of gated recurrent units and an attention mechanism, which can improve the modeling ability of long sequence data and has strong generalization ability. It can better handle long-term series data and perform better when the input characteristics are uncertain or the data is noisy.

作为优选技术手段:在步骤1)中,原始的数据集表示为:As a preferred technical means: in step 1), the original data set is expressed as:

式中:X为输入矩阵;xi为第i日的输入特征向量,由96点负荷特征向量li与外部因素特征向量fi构成;li∈R96为第i日的负荷向量,点数取决于采样频率;fi∈R26为第i日的外部因素特征向量,由工作日类型编码di∈R7,季节类型编码si∈R4,月度类型编码mi∈R12,节假日类型编码hi∈R2以及气象特征向量ni构成,fi表示为:In the formula: X is the input matrix; x i is the input feature vector of the i-th day, which is composed of the 96-point load feature vector l i and the external factor feature vector f i ; l i ∈ R 96 is the load vector of the i-th day, the number of points Depends on the sampling frequency; f i ∈ R 26 is the external factor feature vector of the i-th day, coded by weekday type d i ∈ R 7 , season type code s i ∈ R 4 , monthly type code m i ∈ R 12 , holiday The type code h i ∈ R 2 and the meteorological feature vector n i are composed, and f i is expressed as:

fi=[di si mi hi ni] (16)f i =[d i s i m i h i n i ] (16)

其中,时标特征编码方式采用one-hot编码;在确定了短期电力负荷预测的数据结构后,日前电力负荷预测的单步预测与多步预测基本框架表示为:Among them, the time-scale feature encoding method adopts one-hot encoding; after determining the data structure of short-term power load forecasting, the basic framework of single-step forecasting and multi-step forecasting of day-ahead power load forecasting is expressed as:

Xi+1:i+T=[xi+1 xi+2 … xi+T]T (19)X i+1:i+T =[x i+1 x i+2 ... x i+T ] T (19)

Fi+T+K:i+T+K+τ=[fi+T+K fi+T+K+1 … fi+T+K+τ]T (20)F i+T+K:i+T+K+τ =[f i+T+K f i+T+K+1 ... f i+T+K+τ ] T (20)

式中,为电力负荷预测矩阵;Xi+1:i+T为历史输入矩阵;Fi+T+K:i+T+K+τ为同步特征矩阵;T和τ分别为历史窗口宽度和预测窗口宽度;K为提前预测天数;Φ表示短期电力负荷预测模型;θ*为模型训练得到的参数。In the formula, is the power load forecasting matrix; X i+1:i+T is the historical input matrix; F i+T+K:i+T+K+τ is the synchronous feature matrix; T and τ are the historical window width and forecast window width ; K is the number of forecast days in advance; Φ is the short-term power load forecasting model; θ * is the parameters obtained from model training.

原始数据集采用日、季、月、节假日、气象来进行短期电力负荷预测,有利于提高预测精度、泛化能力和可靠性,对于实际应用具有重要意义。具体为:The original data set uses day, season, month, holidays, and weather for short-term power load forecasting, which is conducive to improving forecasting accuracy, generalization ability and reliability, and is of great significance for practical applications. Specifically:

1、考虑了多个方面的因素:通过引入多个特征,能够更全面地反映电力负荷变化的复杂性和不确定性,包括自然环境、社会文化、人口流动等多个方面的因素。这些特征可以提供更为准确地输入信息,从而提高预测的精度。1. Considering multiple factors: By introducing multiple features, it can more comprehensively reflect the complexity and uncertainty of power load changes, including natural environment, social culture, population flow and other factors. These features can provide more accurate input information, thereby improving the accuracy of prediction.

2、改善了数据分布的不均匀性:在考虑多种特征的情况下,能够改善数据分布的不均匀性,减小预测误差。例如,当遇到节假日或气象突变等重要事件时,能够更好地反映电力负荷的实际变化情况。2. Improve the inhomogeneity of data distribution: In the case of considering multiple features, it can improve the inhomogeneity of data distribution and reduce the prediction error. For example, when encountering important events such as holidays or sudden changes in weather, it can better reflect the actual changes in power loads.

3、增强了模型的泛化能力:通过考虑多个时间尺度和不同类型的特征,可以提高模型对于未知情况的适应能力,增强模型的泛化能力,从而使得模型更具有可靠性和鲁棒性。3. Enhance the generalization ability of the model: By considering multiple time scales and different types of features, the adaptability of the model to unknown situations can be improved, and the generalization ability of the model can be enhanced, thus making the model more reliable and robust .

另外,在本技术方案中,采用one-hot编码的时标特征和单步预测、多步预测的基本框架,也可以提高模型的灵活性、可扩展性和准确性,适用于各种短期电力负荷预测场景。In addition, in this technical solution, the time-scale features of one-hot encoding and the basic framework of single-step forecasting and multi-step forecasting can also improve the flexibility, scalability and accuracy of the model, and are suitable for various short-term power load forecasting scenarios.

将时标特征采用one-hot编码,方便模型处理:在神经网络中,使用数值形式的特征容易被误解,one-hot编码可以将分类变量转换为向量形式以便神经网络处理。这样,模型就可以更好地理解时间序列数据中的不同时间点之间的关系。另外可以避免误导模型的数值大小:数值形式的时标特征可能会误导模型,使得模型错误地认为某些时间点比其他时间点更重要。采用one-hot编码,则能够消除这种误导,确保每个时间点都被平等对待。Use one-hot encoding for time-scale features to facilitate model processing: In neural networks, features in numerical form are easily misunderstood, and one-hot encoding can convert categorical variables into vector forms for neural network processing. This way, the model can better understand the relationship between different points in time in the time series data. In addition, it can avoid misleading the numerical value of the model: the time scale feature in numerical form may mislead the model, making the model mistakenly think that some time points are more important than others. Using one-hot encoding can eliminate this misleading and ensure that each time point is treated equally.

而采用单步预测和多步预测的基本框架,可以提高灵活性:单步预测和多步预测的框架可以灵活地应用于不同的数据集和任务,满足不同的应用需求。例如,对于需要更加精细的预测任务,可以采用多步预测框架,提高预测精度和稳定性;对于简单的预测任务,可以选择单步预测框架来减少计算量。提高可扩展性:基于单步预测和多步预测的框架可以与其他模型结构进行组合,实现更为复杂的预测任务。例如,可以将这些框架与深度学习方法、统计模型、传统时间序列预测方法相结合,提高预测精度和鲁棒性。Using the basic framework of single-step forecasting and multi-step forecasting can improve flexibility: the framework of single-step forecasting and multi-step forecasting can be flexibly applied to different data sets and tasks to meet different application requirements. For example, for more detailed prediction tasks, a multi-step prediction framework can be used to improve prediction accuracy and stability; for simple prediction tasks, a single-step prediction framework can be selected to reduce the amount of calculation. Improve scalability: The framework based on single-step forecasting and multi-step forecasting can be combined with other model structures to achieve more complex forecasting tasks. For example, these frameworks can be combined with deep learning methods, statistical models, traditional time series forecasting methods to improve forecasting accuracy and robustness.

作为优选技术手段:在步骤2)中,基于Attention机制量化负荷时间序列中各时间节点间所隐含的时序相关性,提取互相关特征;为量化负荷时序各时步间的时间相关性,采用“键-值”机制;输入特征向量通过线性映射转化为查询向量qi,键向量ki以及值向量vi;不同时步间的相关性分数a通过计算查询向量与键向量的点积得到:As an optimal technical means: in step 2), based on the Attention mechanism, quantify the implicit time series correlation between each time node in the load time series, and extract the cross-correlation features; in order to quantify the time correlation between each time step of the load time series, use "Key-value"mechanism; the input feature vector is transformed into query vector q i , key vector ki and value vector v i through linear mapping; the correlation score a between different time steps is obtained by calculating the dot product of query vector and key vector :

a=q·k (21)a=q·k (21)

通过计算不同时步查询向量与键向量的点积得到不同时步间的时间相关性,基于Attention机制量化负荷时序相关性的整体流程表示为:The time correlation between different time steps is obtained by calculating the dot product of the query vector and the key vector at different time steps. The overall process of quantifying the time series correlation of loads based on the Attention mechanism is expressed as:

qi=Wqxi,ki=Wkxi,vi=Wvxi,ai,j=qi·kj (22)q i =W q x i , ki =W k x i ,v i =W v x i ,a i,j =q i k j (22)

A=softmax(KTQ),H=VA (24)A=softmax(K T Q), H=VA (24)

式中,Wq,Wk,Wv为查询映射矩阵,键映射矩阵以及值映射矩阵;ai,j为输入向量xi,xj之间的相关性分数;A矩阵由ai,j构成;K和Q为键矩阵以及查询矩阵,分别由ki和qi构成;H为Attention输出。In the formula, W q , W k , W v are the query mapping matrix, key mapping matrix and value mapping matrix; a i, j are the correlation scores between the input vectors x i and x j ; A matrix consists of a i, j Composition; K and Q are the key matrix and the query matrix, which are composed of ki and q i respectively; H is the Attention output.

采用“键-值”机制对负荷时序各时步间的时间相关性进行量化,具有明确时序关系、灵活性强、方便数据处理等多个优点。明确时序关系:采用“键-值”机制可以清晰地描述各个时间步之间的关系,即每个“键”表示一个时间步的特征,“值”则表示该时间步的具体数值或向量。这种机制使得模型能够更好地把握时序数据中不同时间步之间的依赖关系,从而更准确地预测未来的趋势。灵活性强:在使用“键-值”机制时,可以根据实际需要自定义各个时间步的“键”,例如采用季节、月份等不同的时间尺度,同时还可以针对不同的应用场景自定义多个“键”,进一步提高预测精度和泛化能力。方便数据处理:使用“键-值”机制可以将不同的信息以相同格式进行存储和处理,方便数据的批量读取和处理,并且方便与注意力机制相结合,进一步提升模型的表现能力。The "key-value" mechanism is used to quantify the time correlation between each time step of the load time series, which has many advantages such as clear time series relationship, strong flexibility, and convenient data processing. Clarify the timing relationship: The "key-value" mechanism can clearly describe the relationship between each time step, that is, each "key" represents the characteristics of a time step, and the "value" represents the specific value or vector of the time step. This mechanism enables the model to better grasp the dependencies between different time steps in the time-series data, thus predicting future trends more accurately. Strong flexibility: When using the "key-value" mechanism, you can customize the "key" of each time step according to actual needs, such as using different time scales such as seasons and months, and you can also customize multiple time scales for different application scenarios. A "key" to further improve the prediction accuracy and generalization ability. Convenient data processing: Using the "key-value" mechanism can store and process different information in the same format, which facilitates batch reading and processing of data, and facilitates the combination with the attention mechanism to further improve the performance of the model.

作为优选技术手段:在步骤3)中,基于RNN的负荷时序依赖特征形成日前电力负荷预测RNN模块的处理过程公式如(11)-(14)所示;As an optimal technical means: in step 3), the processing formula of the RNN module for power load forecasting based on the RNN-based load time-series dependent feature is shown in (11)-(14);

式中,为RNN第l层的权重矩阵;/>为RNN第l层的偏置;σ为sigmoid激活函数;Wo为线性映射矩阵;/>为第l层RNN网络提取得到的t时刻隐状态特征;/>为RNN输出层与待预测时刻最邻近时刻的隐状态特征;hRNN为RNN提取的特征向量;L为RNN网络层数;T为RNN输入窗口宽度。In the formula, is the weight matrix of the RNN layer l;/> is the bias of the first layer of RNN; σ is the sigmoid activation function; W o is the linear mapping matrix; /> The hidden state features at time t extracted for the l-layer RNN network; /> is the hidden state feature of the RNN output layer and the moment to be predicted; h RNN is the feature vector extracted by RNN; L is the number of RNN network layers; T is the width of the RNN input window.

作为优选技术手段:在步骤4)中:原始数据集通过滑动窗口处理生成历史窗口和预测窗口;As a preferred technical means: in step 4): the original data set is processed through a sliding window to generate a historical window and a forecast window;

在串行集成框架中:首先,将历史窗口内的数据输入RNN模块,通过RNN模块处理,提取负荷序列的时序依赖特征;然后,将RNN模块提取得到的特征向量组输入Attention模块,提取各时步间的相关性,最终,将H与预测窗口内的同步特征一起输入全连接层,输出得到短期电力负荷预测值;In the serial integration framework: firstly, input the data in the history window into the RNN module, process it through the RNN module, and extract the time series dependent features of the load sequence; then, extract the feature vector group obtained by the RNN module Input the Attention module to extract the correlation between each time step. Finally, input H and the synchronous features in the prediction window into the fully connected layer, and output the short-term power load prediction value;

在并行集成框架中:首先将历史窗口内的数据并行输入RNN模块以及Attention模块,挖掘负荷时序的时间相关性与长期依赖特征;然后,将RNN提取得到的特征向量组Attention输出H以及预测窗口内的同步特征一并输入全连接层,输出得到短期电力负荷预测值。In the parallel integration framework: first, input the data in the history window into the RNN module and the Attention module in parallel, and mine the time correlation and long-term dependence characteristics of the load sequence; then, the feature vector group extracted by the RNN The Attention output H and the synchronous features in the prediction window are input into the fully connected layer, and the output is the short-term power load forecast value.

使用历史窗口作为输入,在串行集成框架或并行集成框架中进行多模型融合,能够充分挖掘不同模型之间的互补性,有利于提高预测准确性。Using the history window as input and performing multi-model fusion in a serial ensemble framework or a parallel ensemble framework can fully exploit the complementarity between different models, which is beneficial to improve the prediction accuracy.

有益效果:本技术方案采用Attention模块和RNN模块,两模块采用串行与并行模型集成框架,串行集成框架能够提升预测模型的映射能力,通过降低模型预测方差来降低负荷预测误差,并行集成框架能够提升预测模型的容量,通过降低模型偏差来减小负荷预测误差。基于Attention机制及RNN网络特性考虑负荷时序特征及外部多维影响因素,利用Attention机制的RNN模型能够更好地处理长时依赖问题,并且在对历史数据进行建模时能够自适应地调整权重,提高模型的预测精度。由于引入了注意力机制,可以自适应地捕捉时间序列数据中的关键信息。相较于传统预测方案,如基于前馈神经网络、卷积神经网络以及循环神经网络等模型的短期负荷预测方法,本技术方案有效提高了短期电力负荷预测的精度。Beneficial effects: This technical solution adopts the Attention module and the RNN module. The two modules adopt the serial and parallel model integration framework. The serial integration framework can improve the mapping ability of the prediction model, and reduce the load prediction error by reducing the model prediction variance. The parallel integration framework It can improve the capacity of the forecasting model and reduce the load forecasting error by reducing the model deviation. Based on the Attention mechanism and RNN network characteristics, considering the load timing characteristics and external multi-dimensional influencing factors, the RNN model using the Attention mechanism can better deal with long-term dependence problems, and can adaptively adjust the weight when modeling historical data to improve The predictive accuracy of the model. Due to the introduction of attention mechanism, key information in time series data can be adaptively captured. Compared with traditional forecasting schemes, such as short-term load forecasting methods based on models such as feedforward neural network, convolutional neural network, and recurrent neural network, this technical scheme effectively improves the accuracy of short-term power load forecasting.

附图说明Description of drawings

图1是本发明整体流程示意图。Fig. 1 is a schematic diagram of the overall process of the present invention.

图2是本发明滑动窗口处理示意图。Fig. 2 is a schematic diagram of sliding window processing in the present invention.

图3是本发明Attention机制示意图。Fig. 3 is a schematic diagram of the Attention mechanism of the present invention.

图4是本发明RNN示意图。Fig. 4 is a schematic diagram of the RNN of the present invention.

图5是本发明串行集成框架示意图。Fig. 5 is a schematic diagram of the serial integration framework of the present invention.

图6是本发明并行集成框架示意图。Fig. 6 is a schematic diagram of the parallel integration framework of the present invention.

图7是本发明短期负荷预测曲线图。Fig. 7 is a short-term load forecast curve diagram of the present invention.

具体实施方式Detailed ways

为了更好地理解本发明的目的、技术方案以及技术效果,以下结合附图对本发明进行进一步的讲解说明。In order to better understand the purpose, technical solution and technical effect of the present invention, the present invention will be further explained below in conjunction with the accompanying drawings.

本实施例提出了一种基于Attention-RNN的短期电力负荷预测方法,其实施流程包括如下详细步骤:This embodiment proposes a short-term power load forecasting method based on Attention-RNN, and its implementation process includes the following detailed steps:

步骤1:提出气温、节假日信息等多元异构数据的特征化表示方法,定义考虑多种负荷影响因素的短期负荷预测的数据集格式,构建日前电力负荷预测的单步预测与多步预测基本框架;Step 1: Propose a characteristic representation method for multiple heterogeneous data such as temperature and holiday information, define the data set format for short-term load forecasting considering multiple load factors, and construct the basic framework of single-step forecasting and multi-step forecasting for day-ahead power load forecasting ;

短期电力负荷预测的原始数据集可表示为The original data set of short-term power load forecasting can be expressed as

式中:X为输入矩阵;xi为第i日的输入特征向量,由96点负荷特征向量li与外部因素特征向量fi构成;li∈R96为第i日的负荷向量,点数取决于采样频率;fi∈R26为第i日的外部因素特征向量,由工作日类型编码di∈R7,季节类型编码si∈R4,月度类型编码mi∈R12,节假日类型编码hi∈R2以及气象特征向量ni构成,fi可表示为In the formula: X is the input matrix; x i is the input feature vector of the i-th day, which is composed of the 96-point load feature vector l i and the external factor feature vector f i ; l i ∈ R 96 is the load vector of the i-th day, the number of points Depends on the sampling frequency; f i ∈ R 26 is the external factor feature vector of the i-th day, coded by weekday type d i ∈ R 7 , season type code s i ∈ R 4 , monthly type code m i ∈ R 12 , holiday type coding h i ∈ R 2 and meteorological feature vector n i , f i can be expressed as

fi=[di si mi hi ni] (2)f i =[d i s i m i h i n i ] (2)

其中,时标特征编码(工作日类型编码、季节类型编码等)方式采用one-hot编码,即在当日所述类型的维度置1,其余维度置0。在确定了短期电力负荷预测的数据结构后,日前电力负荷预测的单步预测与多步预测基本框架可表示为Among them, one-hot coding is adopted for time-scale feature coding (weekday type coding, season type coding, etc.), that is, the dimension of the type of the day is set to 1, and the other dimensions are set to 0. After determining the data structure of short-term power load forecasting, the basic framework of single-step forecasting and multi-step forecasting of day-ahead power load forecasting can be expressed as

式中,为电力负荷预测矩阵;Xi+1:i+T为历史输入矩阵;Fi+T+K:i+T+K+τ为同步特征矩阵;T和τ分别为历史窗口宽度和预测窗口宽度;K为提前预测天数;Φ表示短期电力负荷预测模型;θ*为模型训练得到的参数。In the formula, is the power load forecasting matrix; X i+1:i+T is the historical input matrix; F i+T+K:i+T+K+τ is the synchronous feature matrix; T and τ are the historical window width and forecast window width ; K is the number of forecast days in advance; Φ is the short-term power load forecasting model; θ * is the parameters obtained from model training.

短期电力负荷预测建模的关键在于构建合适的模型并确定模型的参数。本实施例中模型的参数通过最小化期望风险Rexp确定:The key to short-term power load forecasting modeling is to construct a suitable model and determine the parameters of the model. The parameters of the model in this embodiment are determined by minimizing the expected risk R exp :

式中,表示损失函数。最终模型的期望参数满足:In the formula, represents the loss function. The expected parameters of the final model satisfy:

在实际应用中,我们通过计算经验风险来近似估计期望风险,根据大数定律,当样本足够多时,经验风险将趋近于期望风险:In practical applications, we approximate the expected risk by calculating the empirical risk. According to the law of large numbers, when there are enough samples, the empirical risk will approach the expected risk:

为实现短期电力负荷的滚动预测,本实施例提出一种滑动窗口处理方法,如图2所示。滑动窗口内的历史负荷数据以及同步相关数据作为短期电力负荷预测模型的输入以考虑负荷变化的自相关特征以及负荷与其影响因素的互相关特征。随着滑动窗口滑动,预测模型逐步输出负荷预测值。In order to realize the rolling forecast of the short-term power load, this embodiment proposes a sliding window processing method, as shown in FIG. 2 . The historical load data and synchronous correlation data in the sliding window are used as the input of the short-term power load forecasting model to consider the autocorrelation characteristics of load changes and the cross-correlation characteristics of load and its influencing factors. As the sliding window slides, the forecasting model gradually outputs the load forecasting value.

步骤2:根据步骤1形成的日前电力负荷预测基本框架,基于Attention机制量化负荷时间序列中各时间节点间所隐含的时序相关性,形成日前电力负荷预测Attention模块;Step 2: According to the basic framework of the day-ahead power load forecasting formed in step 1, based on the Attention mechanism, quantify the time-series correlation implied between each time node in the load time series, and form the Attention module of the day-ahead power load forecasting;

根据步骤1形成的日前电力负荷预测基本框架,基于Attention机制量化负荷时间序列中各时间节点间所隐含的时序相关性,提取互相关特征,Attention的计算流程如图3所示。为了量化负荷时序各时步间的时间相关性,引入“键-值”机制。输入特征向量通过线性映射转化为查询向量qi,键向量ki以及值向量vi。不同时步间的相关性分数a通过计算键值向量间的点积得到:According to the basic framework of the day-ahead power load forecasting formed in step 1, based on the Attention mechanism, the implicit timing correlation between each time node in the load time series is quantified, and the cross-correlation features are extracted. The calculation process of Attention is shown in Figure 3. In order to quantify the time correlation between each time step of the load time series, a "key-value" mechanism is introduced. The input feature vector is transformed into query vector q i , key vector ki and value vector v i through linear mapping. The correlation score a between different time steps is obtained by calculating the dot product between the key-value vectors:

a=q·k (10)a=q·k (10)

通过计算不同时步键值向量间的点积得到不同时步间的时间相关性,基于Attention机制量化负荷时序相关性的整体流程可以表示为The time correlation between different time steps is obtained by calculating the dot product between key-value vectors at different time steps. The overall process of quantifying the time series correlation of loads based on the Attention mechanism can be expressed as

qi=Wqxi,ki=Wkxi,vi=Wvxi,ai,j=qi·kj (11)q i =W q x i , ki =W k x i ,v i =W v x i ,a i,j =q i k j (11)

A=softmax(KTQ),H=VA (13)A=softmax(K T Q), H=VA (13)

式中,Wq,Wk,Wv为查询映射矩阵,键映射矩阵以及值映射矩阵;ai,j为输入向量xi,xj之间的相关性分数;A矩阵由ai,j构成;K和Q为键矩阵以及查询矩阵,分别由ki和qi构成;H为以Attention分数权重对各时步值向量加权求和得到的输出。In the formula, W q , W k , W v are the query mapping matrix, key mapping matrix and value mapping matrix; a i, j are the correlation scores between the input vectors x i and x j ; A matrix consists of a i, j Composition; K and Q are the key matrix and query matrix, which are composed of ki and q i respectively; H is the output obtained by weighting and summing the value vectors of each time step with the Attention score weight.

步骤3:根据步骤1形成的日前电力负荷预测基本框架,基于RNN提取负荷长期序列中所隐含的趋势特征以及周期特征,挖掘负荷序列的时序依赖性,形成日前电力负荷预测RNN模块;Step 3: According to the basic framework of the day-ahead power load forecasting formed in step 1, based on the RNN to extract the implicit trend features and cycle features in the long-term load sequence, mining the time series dependence of the load sequence, and forming the RNN module of the day-ahead power load forecasting;

基于RNN的负荷时序依赖特征提取模块的处理流程如(14)-(17)所示。The processing flow of the load timing dependent feature extraction module based on RNN is shown in (14)-(17).

式中,为RNN第l层的权重矩阵;/>为RNN第l层的偏置;σ为sigmoid激活函数;Wo为线性映射矩阵;/>为第l层RNN网络提取得到的t时刻隐状态特征;/>为RNN输出层与待预测时刻最邻近时刻的隐状态特征。hRNN为RNN提取的特征向量;L为RNN网络层数;T为RNN输入窗口宽度。In the formula, is the weight matrix of the RNN layer l;/> is the bias of the first layer of RNN; σ is the sigmoid activation function; W o is the linear mapping matrix; /> The hidden state features at time t extracted for the l-layer RNN network; /> It is the hidden state feature of the RNN output layer and the moment closest to the moment to be predicted. h RNN is the feature vector extracted by RNN; L is the number of RNN network layers; T is the width of RNN input window.

多维RNN网络层由多个单元串联构成,不同时刻的负荷状态特征信息通过隐藏状态进行传递,RNN能够提取和记忆连续负荷序列各时间节点之间的依赖特征,将不同时间节点的负荷信息耦合。为了增强RNN网络对负荷时序特征信息的提取表示能力,本实施例将多层RNN进行堆叠以学习行业负荷与其影响因素间的复杂非线性关系。基于RNN的日前电力负荷预测RNN模块如图4所示。The multi-dimensional RNN network layer is composed of multiple units in series, and the load state feature information at different times is passed through the hidden state Through transmission, RNN can extract and memorize the dependency features between each time node of the continuous load sequence, and couple the load information of different time nodes. In order to enhance the ability of the RNN network to extract and represent the time-series feature information of the load, this embodiment stacks multiple RNNs to learn the complex nonlinear relationship between the industry load and its influencing factors. The RNN module of the day-ahead power load forecasting based on RNN is shown in Figure 4.

步骤4:基于步骤2与步骤3形成的Attention模块和RNN模块,构建串行与并行两种模型集成框架,利用Attention机制及RNN网络特性,从历史数据中挖掘负荷时序的时间相关性与长期依赖特征,形成基于Attention-RNN的短期电力负荷预测方法;Step 4: Based on the Attention module and RNN module formed in Step 2 and Step 3, build a serial and parallel model integration framework, and use the Attention mechanism and RNN network characteristics to mine the time correlation and long-term dependence of load timing from historical data Features, forming a short-term power load forecasting method based on Attention-RNN;

基于Attention模块和RNN模块,构建串行与并行两种模型集成框架。在串行集成框架中:首先,将历史窗口内的数据输入RNN模块,通过RNN模块处理,提取负荷序列的时序依赖特征;然后,将RNN模块提取得到的特征向量组输入Attention模块,提取各时步间的相关性得到考虑各时步关联性的输出矩阵H;最终,将H与预测窗口内的同步特征一起输入全连接层,输出得到短期电力负荷预测值,串行集成框架示意图如图5所示。在并行集成框架中:首先将历史窗口内的数据并行输入RNN模块以及Attention模块,挖掘负荷时序的时间相关性与长期依赖特征;然后,将RNN提取得到的特征向量组/>Attent ion输出H以及预测窗口内的同步特征一并输入全连接层,输出得到短期电力负荷预测值,并行集成框架示意图如图6所示。Based on the Attention module and the RNN module, two model integration frameworks, serial and parallel, are constructed. In the serial integration framework: firstly, input the data in the history window into the RNN module, process it through the RNN module, and extract the time series dependent features of the load sequence; then, extract the feature vector group obtained by the RNN module Input the Attention module, extract the correlation between each time step to obtain the output matrix H considering the correlation of each time step; finally, input H and the synchronous features in the prediction window into the fully connected layer, and output the short-term power load forecast value, serial The schematic diagram of the row integration framework is shown in Figure 5. In the parallel integration framework: first, input the data in the history window into the RNN module and the Attention module in parallel, and mine the time correlation and long-term dependence characteristics of the load sequence; then, extract the feature vector group obtained by the RNN /> The Attention output H and the synchronization features in the prediction window are input to the fully connected layer, and the output is the short-term power load forecast value. The schematic diagram of the parallel integration framework is shown in Figure 6.

为评估模型预测效果,采用均方根误差和平均绝对百分比误差作为预测评价指标,分别如(18)式和式(19)所示。In order to evaluate the prediction effect of the model, the root mean square error and the average absolute percentage error are used as the prediction evaluation indicators, as shown in formula (18) and formula (19), respectively.

为验证所提出的基于Attention-RNN的短期电力负荷预测方法的有效性和准确性,以某地市2021年的96点日负荷数据进行算例仿真。In order to verify the effectiveness and accuracy of the proposed short-term power load forecasting method based on Attention-RNN, an example simulation is carried out with 96 points of daily load data in a city in 2021.

首先,根据步骤1提出的多元异构数据的特征化表示方法以及日前电力负荷预测的单步预测与多步预测基本框架对原始96点日负荷数据进行预处理,包括数据的归一化、特征编码、数据塑形以及滑动窗口化处理。First, the original 96-point daily load data is preprocessed according to the characteristic representation method of multivariate heterogeneous data proposed in step 1 and the basic framework of single-step forecasting and multi-step forecasting of the day-ahead power load forecasting, including data normalization, feature Encoding, data shaping, and sliding windowing.

接着,基于滑动窗口数据,根据步骤2以及步骤3提到的RNN特征提取方法和Attention时序相关性量化方法,形成RNN模块以及Attention模块。Next, based on the sliding window data, the RNN module and the Attention module are formed according to the RNN feature extraction method and the Attention timing correlation quantification method mentioned in Step 2 and Step 3.

然后,根据步骤3提出的两种框架,对RNN模块以及Attention模块进行集成,同时考虑预测窗口内的同步相关特征影响,将其输入全连接层。为了在保证模型一定映射能力的同时提高模型的训练效率,GRU模块中隐藏层数量设为2,Attention层数为1,同步特征非线性映射层数为2,全连接层数为1,至此短期日负荷预测模型的建模工作完成。在模型结构确定的基础上,将滑动窗口化处理后的数据集划分为训练集以及测试集,训练集用于对所构建模型进行训练,确定模型参数;测试集用于对所构建模型进行效果验证。Then, according to the two frameworks proposed in step 3, integrate the RNN module and the Attention module, while considering the influence of synchronization-related features in the prediction window, and input it into the fully connected layer. In order to improve the training efficiency of the model while ensuring a certain mapping ability of the model, the number of hidden layers in the GRU module is set to 2, the number of Attention layers is 1, the number of synchronous feature nonlinear mapping layers is 2, and the number of fully connected layers is 1. The modeling work of the daily load forecasting model is completed. On the basis of the determination of the model structure, the data set after sliding window processing is divided into a training set and a test set. The training set is used to train the constructed model and determine the model parameters; verify.

在本实施例中采用Attention模块和RNN模块结合串行与并行模型集成框架,利用Attention机制及RNN网络特性考虑负荷时序特征及外部多维影响因素,相较于传统预测方法具有以下优点:In this embodiment, the Attention module and the RNN module are combined with the serial and parallel model integration framework, and the Attention mechanism and RNN network characteristics are used to consider the load timing characteristics and external multi-dimensional influencing factors. Compared with the traditional prediction method, it has the following advantages:

考虑外部多维影响因素:传统预测方法常常只考虑历史负荷数据本身,而本技术方案通过引入Attention机制,能够有效地考虑外部多维影响因素,如温度、湿度、节假日等,提高了预测精度。Consider external multi-dimensional influencing factors: Traditional forecasting methods often only consider historical load data itself, but this technical solution can effectively consider external multi-dimensional influencing factors, such as temperature, humidity, holidays, etc., by introducing the Attention mechanism, which improves the forecasting accuracy.

充分挖掘时间序列特征:通过采用RNN网络,能够对负荷数据的时间序列特征进行建模,从而更好地捕捉负荷数据中的周期性、趋势性等信息,进一步提高预测精度。Fully mine the time series features: By using the RNN network, the time series features of the load data can be modeled, so as to better capture the periodicity, trend and other information in the load data, and further improve the prediction accuracy.

模型融合提高鲁棒性:通过串行与并行模型集成框架,将Attention模块和RNN模块进行融合,充分挖掘不同模型之间的互补性,提高了预测的鲁棒性和稳定性。Model fusion improves robustness: Through the serial and parallel model integration framework, the Attention module and the RNN module are fused to fully tap the complementarity between different models and improve the robustness and stability of predictions.

可解释性强:由于采用了Attention机制,可以通过可视化方式展示每个外部影响因素在预测中的重要性,从而提高了模型的可解释性。Strong interpretability: Due to the adoption of the Attention mechanism, the importance of each external influencing factor in the prediction can be displayed visually, thereby improving the interpretability of the model.

为验证本发明所提方法的有效性与优越性,构建其他典型预测模型,如ANN,CNN,GRU,CNN-GRU等,与本发明的预测结果进行对比,各预测模型的评价指标对比如下表所示。In order to verify the effectiveness and superiority of the proposed method of the present invention, construct other typical prediction models, such as ANN, CNN, GRU, CNN-GRU, etc., and compare with the prediction results of the present invention, and the evaluation indexes of each prediction model are compared in the following table shown.

表1短期负荷预测模型评价指标对比Table 1 Comparison of short-term load forecasting model evaluation indicators

基于上述模型的短期负荷预测曲线如图7所示。根据图7和表1可知,相较于其他短期负荷预测模型,本发明所提出的基于Attention-RNN的短期负荷预测模型预测精度相对更高,其中串行架构的Attention-RNN短期负荷预测模型精度最高,误差最小,模型的泛化性能最佳。The short-term load forecasting curve based on the above model is shown in Fig. 7. According to Figure 7 and Table 1, compared with other short-term load forecasting models, the short-term load forecasting model based on Attention-RNN proposed by the present invention has relatively higher forecasting accuracy, and the Attention-RNN short-term load forecasting model accuracy of the serial architecture is The highest, the smallest error, and the best generalization performance of the model.

以上所示的一种基于Attention-RNN的短期电力负荷预测方法是本发明的具体实施例,已经体现出本发明实质性特点和进步,可根据实际的使用需要,在本发明的启示下,对其进行形状、结构等方面的等同修改,均在本方案的保护范围之列。The short-term power load forecasting method based on Attention-RNN shown above is a specific embodiment of the present invention, which has already reflected the substantive features and progress of the present invention, and can be used according to actual needs under the inspiration of the present invention. The equivalent modification of its shape, structure and other aspects are all within the scope of protection of this scheme.

Claims (5)

1.一种基于Attention-RNN的短期电力负荷预测方法,其特征在于,包括以下步骤:1. A short-term power load forecasting method based on Attention-RNN, is characterized in that, comprises the following steps: 1)确定包括气温、节假日信息的多元异构数据的特征化表示方法,定义考虑多种负荷影响因素的短期负荷预测的数据集格式,构建日前电力负荷预测的单步预测与多步预测基本框架;1) Determine the characteristic representation method of multivariate heterogeneous data including temperature and holiday information, define the data set format for short-term load forecasting considering multiple load influencing factors, and construct the basic framework of single-step forecasting and multi-step forecasting for day-ahead power load forecasting ; 2)根据步骤1)形成的日前电力负荷预测基本框架,基于Attention机制量化负荷时间序列中各时间节点间所隐含的时序相关性,形成日前电力负荷预测Attention模块;2) According to the basic framework of day-ahead power load forecasting formed in step 1), based on the Attention mechanism, quantify the time-series correlation implied between each time node in the load time series, and form the day-ahead power load forecasting Attention module; 3)根据步骤1)形成的日前电力负荷预测基本框架,基于RNN提取负荷长期序列中所隐含的趋势特征以及周期特征,挖掘负荷序列的时序依赖性,形成日前电力负荷预测RNN模块;3) According to the basic framework of the day-ahead power load forecasting formed in step 1), based on the RNN, the hidden trend features and cycle features in the long-term load sequence are extracted, and the timing dependence of the load sequence is mined to form the RNN module of the day-ahead power load forecasting; 4)基于步骤2)与步骤3)形成的Attention模块和RNN模块,构建串行与并行两种模型集成框架,利用Attention机制及RNN网络特性,从历史数据中挖掘负荷时序的时间相关性与长期依赖特征,形成基于Attention-RNN的短期电力负荷预测模型,根据短期电力负荷预测模型进行短期电力负荷预测。4) Based on the Attention module and RNN module formed in step 2) and step 3), build a serial and parallel model integration framework, and use the Attention mechanism and RNN network characteristics to mine the time correlation and long-term load timing from historical data. Depending on the feature, a short-term power load forecasting model based on Attention-RNN is formed, and short-term power load forecasting is performed according to the short-term power load forecasting model. 2.根据权利要求1所述的一种基于Attention-RNN的短期电力负荷预测方法,其特征在于:在步骤1)中,原始的数据集表示为:2. a kind of short-term power load forecasting method based on Attention-RNN according to claim 1, is characterized in that: in step 1), original data set is expressed as: 式中:X为输入矩阵;xi为第i日的输入特征向量,由96点负荷特征向量li与外部因素特征向量fi构成;li∈R96为第i日的负荷向量,点数取决于采样频率;fi∈R26为第i日的外部因素特征向量,由工作日类型编码di∈R7,季节类型编码si∈R4,月度类型编码mi∈R12,节假日类型编码hi∈R2以及气象特征向量ni构成,fi表示为:In the formula: X is the input matrix; x i is the input feature vector of the i-th day, which is composed of the 96-point load feature vector l i and the external factor feature vector f i ; l i ∈ R 96 is the load vector of the i-th day, the number of points Depends on the sampling frequency; f i ∈ R 26 is the external factor feature vector of the i-th day, coded by weekday type d i ∈ R 7 , season type code s i ∈ R 4 , monthly type code m i ∈ R 12 , holiday The type code h i ∈ R 2 and the meteorological feature vector n i are composed, and f i is expressed as: fi=[di si mi hi ni] (2)f i =[d i s i m i h i n i ] (2) 其中,时标特征编码方式采用one-hot编码;在确定了短期电力负荷预测的数据结构后,日前电力负荷预测的单步预测与多步预测基本框架表示为:Among them, the time-scale feature encoding method adopts one-hot encoding; after determining the data structure of short-term power load forecasting, the basic framework of single-step forecasting and multi-step forecasting of day-ahead power load forecasting is expressed as: Xi+1:i+T=[xi+1 xi+2 … xi+T]T (5)X i+1:i+T =[x i+1 x i+2 ... x i+T ] T (5) Fi+T+K:i+T+K+τ=[fi+T+K fi+T+K+1 … fi+T+K+τ]T (6)F i+T+K:i+T+K+τ =[f i+T+K f i+T+K+1 ... f i+T+K+τ ] T (6) 式中,为电力负荷预测矩阵;Xi+1:i+T为历史输入矩阵;Fi+T+K:i+T+K+τ为同步特征矩阵;T和τ分别为历史窗口宽度和预测窗口宽度;K为提前预测天数;Φ表示短期电力负荷预测模型;θ*为模型训练得到的参数。In the formula, is the power load forecasting matrix; X i+1:i+T is the historical input matrix; F i+T+K:i+T+K+τ is the synchronous feature matrix; T and τ are the historical window width and forecast window width ; K is the number of forecast days in advance; Φ is the short-term power load forecasting model; θ * is the parameters obtained from model training. 3.根据权利要求1所述的一种基于Attention-RNN的短期电力负荷预测方法,其特征在于:在步骤2)中,基于Attention机制量化负荷时间序列中各时间节点间所隐含的时序相关性,提取互相关特征;为量化负荷时序各时步间的时间相关性,采用“键-值”机制;输入特征向量通过线性映射转化为查询向量qi,键向量ki以及值向量vi;不同时步间的相关性分数a通过计算查询向量与键向量的点积得到:3. A short-term power load forecasting method based on Attention-RNN according to claim 1, characterized in that: in step 2), the implicit temporal correlation between each time node in the load time series is quantified based on the Attention mechanism to extract cross-correlation features; in order to quantify the time correlation between each time step of the load time series, the "key-value" mechanism is adopted; the input feature vector is transformed into query vector q i , key vector k i and value vector v i through linear mapping ; The correlation score a between different time steps is obtained by calculating the dot product of the query vector and the key vector: a=q·k (7)a=q·k (7) 通过计算不同时步查询向量与键向量的点积得到不同时步间的时间相关性,基于Attention机制量化负荷时序相关性的整体流程表示为:The time correlation between different time steps is obtained by calculating the dot product of the query vector and the key vector at different time steps. The overall process of quantifying the time series correlation of loads based on the Attention mechanism is expressed as: qi=Wqxi,ki=Wkxi,vi=Wvxi,ai,j=qi·kj (8)q i =W q x i , ki =W k x i ,v i =W v x i ,a i,j =q i k j (8) A=softmax(KTQ),H=VA (10)A=softmax(K T Q), H=VA (10) 式中,Wq,Wk,Wv为查询映射矩阵,键映射矩阵以及值映射矩阵;ai,j为输入向量xi,xj之间的相关性分数;A矩阵由ai,j构成;K和Q为键矩阵以及查询矩阵,分别由ki和qi构成;H为Attention输出。In the formula, W q , W k , W v are the query mapping matrix, key mapping matrix and value mapping matrix; a i, j are the correlation scores between the input vectors x i and x j ; A matrix consists of a i, j Composition; K and Q are the key matrix and the query matrix, which are composed of ki and q i respectively; H is the Attention output. 4.根据权利要求1所述的一种基于Attention-RNN的短期电力负荷预测方法,其特征在于:在步骤3)中,基于RNN的负荷时序依赖特征形成日前电力负荷预测RNN模块的处理过程公式如(11)-(14)所示;4. A short-term power load forecasting method based on Attention-RNN according to claim 1, characterized in that: in step 3), the processing formula of the day-ahead power load forecasting RNN module is formed based on the load time series dependence characteristics of RNN As shown in (11)-(14); 式中,为RNN第l层的权重矩阵;/>为RNN第l层的偏置;σ为sigmoid激活函数;Wo为线性映射矩阵;/>为第l层RNN网络提取得到的t时刻隐状态特征;/>为RNN输出层与待预测时刻最邻近时刻的隐状态特征;hRNN为RNN提取的特征向量;L为RNN网络层数;T为RNN输入窗口宽度。In the formula, is the weight matrix of the RNN layer l;/> is the bias of the first layer of RNN; σ is the sigmoid activation function; W o is the linear mapping matrix; /> The hidden state features at time t extracted for the l-layer RNN network; /> is the hidden state feature of the RNN output layer and the moment to be predicted; h RNN is the feature vector extracted by RNN; L is the number of RNN network layers; T is the width of the RNN input window. 5.根据权利要求1所述的一种基于Attention-RNN的短期电力负荷预测方法,其特征在于:在步骤4)中:原始数据集通过滑动窗口处理生成历史窗口和预测窗口;5. a kind of short-term power load forecasting method based on Attention-RNN according to claim 1, is characterized in that: in step 4): original data set generates history window and prediction window by sliding window processing; 在串行集成框架中:首先,将历史窗口内的数据输入RNN模块,通过RNN模块处理,提取负荷序列的时序依赖特征;然后,将RNN模块提取得到的特征向量组输入Attention模块,提取各时步间的相关性,最终,将H与预测窗口内的同步特征一起输入全连接层,输出得到短期电力负荷预测值;In the serial integration framework: firstly, input the data in the history window into the RNN module, process it through the RNN module, and extract the time series dependent features of the load sequence; then, extract the feature vector group obtained by the RNN module Input the Attention module to extract the correlation between each time step. Finally, input H and the synchronous features in the prediction window into the fully connected layer, and output the short-term power load prediction value; 在并行集成框架中:首先将历史窗口内的数据并行输入RNN模块以及Attention模块,挖掘负荷时序的时间相关性与长期依赖特征;然后,将RNN提取得到的特征向量组Attention输出H以及预测窗口内的同步特征一并输入全连接层,输出得到短期电力负荷预测值。In the parallel integration framework: first, input the data in the history window into the RNN module and the Attention module in parallel, and mine the time correlation and long-term dependence characteristics of the load sequence; then, the feature vector group extracted by the RNN The Attention output H and the synchronous features in the prediction window are input into the fully connected layer, and the output is the short-term power load forecast value.
CN202310388456.9A 2023-04-12 2023-04-12 A short-term power load forecasting method based on Attention-RNN Pending CN116703644A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310388456.9A CN116703644A (en) 2023-04-12 2023-04-12 A short-term power load forecasting method based on Attention-RNN

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310388456.9A CN116703644A (en) 2023-04-12 2023-04-12 A short-term power load forecasting method based on Attention-RNN

Publications (1)

Publication Number Publication Date
CN116703644A true CN116703644A (en) 2023-09-05

Family

ID=87839916

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310388456.9A Pending CN116703644A (en) 2023-04-12 2023-04-12 A short-term power load forecasting method based on Attention-RNN

Country Status (1)

Country Link
CN (1) CN116703644A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117113159A (en) * 2023-10-23 2023-11-24 国网山西省电力公司营销服务中心 Power user-side load classification method and system based on deep learning
CN117293803A (en) * 2023-09-25 2023-12-26 武汉大学 Multi-feature modeling and attention enhancement-based short-term energy consumption prediction method and system for power circuit
CN118137492A (en) * 2024-04-30 2024-06-04 国网山东省电力公司泗水县供电公司 Short-term power load prediction method and system
CN118863603A (en) * 2024-09-29 2024-10-29 国网浙江省电力有限公司舟山供电公司 Load probability forecasting method based on dual attention and quantile regression
CN119543154A (en) * 2025-01-21 2025-02-28 浙江大学 A short-term power load forecasting method based on image domain feature extraction
CN119599153A (en) * 2024-08-26 2025-03-11 无锡九方科技有限公司 A prediction method and device for a weather-climate integrated intelligent large model

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117293803A (en) * 2023-09-25 2023-12-26 武汉大学 Multi-feature modeling and attention enhancement-based short-term energy consumption prediction method and system for power circuit
CN117113159A (en) * 2023-10-23 2023-11-24 国网山西省电力公司营销服务中心 Power user-side load classification method and system based on deep learning
CN118137492A (en) * 2024-04-30 2024-06-04 国网山东省电力公司泗水县供电公司 Short-term power load prediction method and system
CN119599153A (en) * 2024-08-26 2025-03-11 无锡九方科技有限公司 A prediction method and device for a weather-climate integrated intelligent large model
CN118863603A (en) * 2024-09-29 2024-10-29 国网浙江省电力有限公司舟山供电公司 Load probability forecasting method based on dual attention and quantile regression
CN119543154A (en) * 2025-01-21 2025-02-28 浙江大学 A short-term power load forecasting method based on image domain feature extraction

Similar Documents

Publication Publication Date Title
CN113962364B (en) A Multi-factor Power Load Forecasting Method Based on Deep Learning
CN116703644A (en) A short-term power load forecasting method based on Attention-RNN
CN110705743B (en) New energy consumption electric quantity prediction method based on long-term and short-term memory neural network
CN111260136A (en) Building short-term load prediction method based on ARIMA-LSTM combined model
CN108009674A (en) Air PM2.5 concentration prediction methods based on CNN and LSTM fused neural networks
CN114862032B (en) XGBoost-LSTM-based power grid load prediction method and device
CN110443417A (en) Multi-model integrated load prediction method based on wavelet transformation
CN115660161A (en) Medium-term and small-term load probability prediction method based on time sequence fusion Transformer model
CN113554466A (en) Construction method, forecasting method and device for short-term electricity consumption forecasting model
CN107220851A (en) Electricity sales amount Forecasting Methodology and device based on X13 seasonal adjustments and Cox regression
CN111027775A (en) Step hydropower station generating capacity prediction method based on long-term and short-term memory network
CN114519471B (en) A method for predicting power load based on the periodicity of time series data
CN114399101A (en) TCN-BIGRU-based gas load prediction method and device
CN117526316B (en) Load prediction method based on GCN-CBAM-BiGRU combined model
CN115271161A (en) Short-term prediction method for multi-energy load
CN115688993A (en) Short-term power load prediction method suitable for power distribution station area
CN107977735A (en) A kind of municipal daily water consumption Forecasting Methodology based on deep learning
CN114091776A (en) K-means-based multi-branch AGCNN short-term power load prediction method
Wang et al. Load forecasting method based on CNN and extended LSTM
CN116011655A (en) Ultra-short-term load forecasting method and system based on two-stage intelligent feature engineering
CN118132948A (en) A method for predicting electric power
CN115577753A (en) Method and system for generating load forecasting model of electric vehicle charging network
CN115293406A (en) Photovoltaic power generation power prediction method based on Catboost and Radam-LSTM
Wang et al. Design of short-term load forecasting method considering user behavior
CN118446385A (en) Special day power load prediction method and system based on meteorological similar day

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载