基于CatBoost算法的电力短期负荷预测研究 *
1.
2.
3.
Short-term Load Forecasting Based on CatBoost Algorithm
1.
2.
3.
通讯作者: 武文成,男,1995年生,硕士研究生。主要研究方向为配网自动化。E-mail:huanghepijiu@vip.qq.com
收稿日期: 2019-12-23 网络出版日期: 2020-03-25
| 基金资助: |
|
Received: 2019-12-23 Online: 2020-03-25
作者简介 About authors
党存禄,男,1964年生,教授。主要研究方向为新能源发电技术,电力电子与电力传动。E-mail:dcl_1964@163.com
针对传统电力系统负荷预测算法数据预处理过程中大量的超参数调节以及数值强行代替标签时容易发生条件偏移的问题,为进一步提高电力系统短期负荷预测的精度,将CatBoost算法应用于电力短期负荷预测,较传统负荷预测深度神经网络算法而言,CatBoost算法在数据预处理过程当中无需进行数值强行代替标签,同时减小对超参数依赖的情况下得到较优的预测结果。首先选取了两地区20天的数据用于训练CatBoost模型,其次将预测结果与其他常见智能算法进行分析和对比,最后仿真结果表明CatBoost算法具备预测电力系统短期负荷的能力。
关键词:
In order to improve the accuracy of short-term load forecasting in power systems, CatBoost algorithm is applied to short-term power load for prediction. Compared with the traditional load prediction deep neural network algorithm, the CatBoost algorithm does not need to perform numerical forced substitution in the data preprocessing process, and at the same time reduces the dependence on hyperparameters to obtain better prediction results. Firstly, 20 days of data from two regions are used to train the CatBoost model. Secondly, analyze the prediction results and compared with other common intelligent algorithms. Finally, the simulation results showed that the CatBoost algorithm has the ability to predict short-term load of the power system.
Keywords:
本文引用格式
党存禄, 武文成, 李超锋, 李永强.
DANG Cunlu, WU Wencheng, LI Chaofeng, LI Yongqiang.
1 引言
负荷预测作为电力系统调度的重要手段之一,对电网调度、可靠运作以及提高企业的利润有着非常积极的作用,因此也在电力系统领域与负荷预测相关的预测算法层见叠出[1,2]。时间序列法是传统负在预测中过分倚重时间因素,而忽略了其他影响因素[3]。事实上,短期负荷曲线变化中影响最大的是气象因素[4]。如果进行短期负荷预测时不考虑气象因素会致使预测误差较大[5]。人工神经网络、专家系统方法、灰色数据理论以及模糊负荷预测理论等是现代负荷预测理论的典型代表[6]。这些预测方法虽然可以达到较好的预测效果,但是过多的超参数调优、数据预处理过程中标签信息偏移和对计算机性能的要求过高,限制了其在短期负荷预测中的应用[7]。
随着计算机以及人工智能等技术的发展,涌现出大量以神经网络为代表的智能算法,并在预测领域得以应用[8]。在种类繁多的预测方法中人工神经网络(Artificial neural network,ANN)以及它的优化算法已经被应用于各个行业的预测中。文献[9]提出由于ANN算法的自学习能力可以较好地解决复杂非线性回归问题,因此ANN也能应用于同属非线性回归问题的电力负荷预测。但训练速度慢、模型训练过程中需要人为设置以及大量超参的调整是ANN算法不可忽视的缺点[10]。除此之外,文献[11]提出陷入局部最优解甚至无法收敛得到最优解,从而导致预测结果偏差过大是ANN面临的最大问题。深度学习(Deep learning,DL)概念出现后,深度神经网络(Deep neural network,DNN)及其优化算法得到了广泛应用[12]。文献[13]中提出DNN在处理复杂模型的过程中对超参数的依赖程度比ANN略低。但是,DNN的训练通常需要大量的训练数据,这使得DNN无法直接应用于具有小规模数据的任务。DNN的模型特别复杂,训练的过程中对计算机的配置要求很高。除此之外,DNN的超参数过多,模型训练过程中需要对大量的超参数进行调节,且DNN要求对数据进行预处理,无法处理文字标签。
CatBoost是俄罗斯Yandex公司在2017年开源的基于GBDT机器学习框架的机器学习库[14]。该库结构简单,对于类别型特征有较好的识别能力,而且降低了对超参数的要求。本文尝试采用CatBoost算法进行电力系统短期负荷预测,验证CatBoost算法的预测能力并加以应用。
2 短期负荷预测
在电力系统短期负荷预测中,常选择具有代表性和高影响力的历史数据。主要有以下几种数据:① 历史负荷数据;② 日期类型数据;③ 天气情况数据等[19]。
电力系统短期负荷预测的核心是:① 获取真实可靠的历史数据;② 搭建有效的负荷预测模型。随着科技的发展,电力系统的信息管理系统逐步建立、气象数据精确度不断提高,用户可以随时获取可靠的历史负荷数据和气象数据。因此,在未来建立有效的负荷预测模型是提高短期负荷预测能力的主要任务[20]。
3 CatBoost预测算法分析
3.1 Boosting算法
图1
3.2 梯度提升算法
梯度提升算法(Gradient descend boosting)是基于Boosting的很有代表性的算法之一,它的第m个基学习器建立都是在第m-1次基学习器损失函数的梯度下降方向[21]。损失函数(Loss function)可以衡量上一轮基学习器的出错程度。如果基学习器能够让损失函数不断下降,则说明我们的基学习器一直在改进。而要实现基学习器不断改进的方法就是让损失函数空间的梯度下降。
假设函数的参数是$P=~\{{{p}_{0}},{{p}_{1}},{{p}_{2}},\cdots \}$,$F(x;P)$是参数为P的x的函数,即预测函数。预测函数由多个基学习器加权结合,如式(2)所示
式中 $\beta $——每个基学习器的权重;
$\alpha $——基学习器中的参数。
通过优化$\{\beta ,\alpha \}$也就是P,可以达到优化F的目的[22]。
(1) 可加的参数P的梯度表示。
P的likelihood函数$\Phi (P)$,也就是$F(x;P)$的损失函数如式(3)~(4)所示
由于$F(x;P)$的可加性,所以对于P有
式中 ${{p}_{0}}$——一个初始猜测。
因此,可以通过对$\Phi (P)$求导,将P的优化过程转化为一个梯度下降的过程,假设现有m-1个基学习器(前m-1个基学习器都固定),若要得到第m个基学习器的参数${{p}_{m}}$,首先需要对前m-1个基学习器求参数${{P}_{m-1}}$梯度,得到损失函数最快下降的方向${{g}_{m}}$,如式(6)~(7)所示
可得第m个基学习器的参数${{p}_{m}}$
式中 $\rho $——常数。
(2) 可加的函数的梯度表示。
将参数P的可加性推广至函数空间,可以得到式(10)
式中 ${{f}_{i}}(x)$——基学习器。
同样,我们可以得到函数F(x)的梯度下降方向g(x),如式(11)所示
最终可以得到第m个模型${{f}_{m}}(x)$的表达式,如式(12)所示
(3) 通用的Gradient descent Boosting的框架。
对于模型式(2)中的参数$\{{{\beta }_{m}},{{\alpha }_{m}}\}_{1}^{M}$,我们可以用式(13)来表示。
式中 $({{x}_{i}},{{y}_{i}})$——样本点。
计算其在模型$F(x;\beta ,\alpha )$下的损失函数,使得这个损失函数最小的$\{\beta ,\alpha \}$,就是最优的$\{\beta ,\alpha \}$。
式中 ${{\beta }_{m}}$,${{\alpha }_{m}}$——两个m维的参数。
对于数据点${{x}_{i}}$都可以得到一个${{g}_{m}}({{x}_{i}})$,可得完整梯度下降方向,如式(15)~(16)所示
通过最小二乘法,使得${{f}_{m}}(x)$能够在${{g}_{m}}(x)$方向上。
在${{\alpha }_{m}}$的基础上,可以得到${{\beta }_{m}}$。
最终得到通用的Gradient descent Boosting的框架,如式(19)所示
3.3 梯度提升树算法
在Gradient descend Boosting算法中最常用的基学习器是决策树(一般是CART),梯度提升树 (Gradient boosting decision tree,GBDT)算法。决策树对数值特征有很好的识别能力,但是实际应用中,许多数据集包含分类特征,分类特征对预测也很重要。分类特性是一种具有离散值集的特性,这些值彼此之间没有必要进行比较(例如,负荷预测中工作日和非工作日)。在GBDT算法中在训练前将它们转换为数字是处理分类特征最常用的方法。
GBDT算法在处理类别型特征(Categorical features)时,常用Categorical features对应的标签的平均值来替代。因此标签平均值常作为决策树中节点分裂的标准。这种方法被称为Greedy target-based statistics,简称Greedy TBS,如式(20)所示
但是,这种方法会使得特征中比标签包含更多的信息。所以一旦用标签的平均值来代替特征,在训练集和测试集数据结构和分布不同的情况下就容易出现条件偏移的情况。
3.4 CatBoost算法
CatBoost算法在GBDT的基础上能够更优地处理Categorical features[23]。CatBoost通过添加先验分布项的方式改进Greedy TBS,减少了噪声和低频数据对于数据分布的影响,如式(21)所示
式中 P——先验项;
a——权重系数。
对于类别数较少的特征,先验项的添加有利于噪音数据的减少。在解决回归问题中,通常取数据集的均值作为先验项。也可以采用多个数据集排列,但是直接计算会增加模型过拟合的几率。CatBoost利用oblivious树作为基学习器,oblivious树中每个叶子节点的索引被编码为长度与树深度相等的二进制矢量。这种计算节点值的方式避免了直接计算过拟合的问题,而且oblivious树的整个级别上使用相同的分割准则,因此oblivious树能达到平衡,不易过拟合。
用数字替换Categorical features的另一种方法是计算该Categorical features在数据集出现的频率。这是一种简单但强大的技术,在CatBoost算法中也有实现。它自动采用特殊的方式处理Categorical features。首先对Categorical features进行统计,计算某个类别特征出现的频率,之后加上超参数,生成新的数值型特征。这样在数据的预处理过程中就不需要人为处理Categorical features。
4 模型搭建和应用
选取两地区电力负荷值(间隔15 min采样一次,每天96点)、该时间段的气象数据(最高最低温度、平均温度、相对湿度以及降雨量)以及日期类型(工作日与非工作日分别量化为0和1,在CatBoost算法中不做量化,作为标签列)进行负荷预测。历史数据取2014年12月23日前20天数据,对2014年12月23日当天的负荷进行预测。为了对CatBoost算法的预测能力进行评估,本文选取了BP神经网络(Back propagation neural network)、决策树算法(Decision tree)、梯度提升树算法(GBDT)、K最近邻分类算法(K-Nearest neighbor,KNN)等算法做负荷预测,与CatBoost算法预测结果比较。本文中算法程序的编程环境为Python 3.6(64位),数据可视化采用Excel,数据取自“中国电机工程学会杯”全国大学生电工数学建模竞赛的标准数据集。
4.1 样本数据预处理
在电力负荷数据建模过程中,都要进行数据预处理。针对负荷数据的预处理方式有很多,根据不同算法的需求,主要有数据变量转换、缺失值处理、数据标准化等。然后根据建立的模型的需要,划分出训练样本集合。取前N天的数据作为训练集和测试集,进行模型训练。
4.2 预测算法模型
预测模型如图2所示(N=20)。
图2
4.3 算法性能评估指标
为了能有效判断一个预测模型的性能,需要在输出数据集上评价预测模型的准确率。模型的预测效果评价方法很多,衡量的指标有绝对误差(Absolute error)、相对误差(Relative error)平均绝对误差(Mean absolute error,MAE)、均方误差(Mean squared error,MSE)、均方根误差(Root mean squared error,RMSE)和平均绝对百分误差(Mean absolute percentage error,MAPE)等。本文中选用的评估方式是MAE、MAPE和RMSE。
4.4 CatBoost算法中参数设置
CatBoost算法的优势在于它降低了模型对许多超参数的需求。因此本文中试验大多采用默认的超参数设置,而且在数据的前期处理中不再需要将数据的文本特征转换成数字。
4.5 试验结果分析
利用对2014年12月23日前20天的两个地区历史数据进行负荷预测的结果如图3~4所示。
图3
图4
表1是上述几种预测算法对2014年12月23日地区1和地区2负荷预测结果的误差数据统计。
表1 两地负荷预测误差指标
| 算法 | 地区1负荷预测误差指标 | 地区2负荷预测误差指标 | ||||
|---|---|---|---|---|---|---|
| RMSE | MAE | MAPE | RMSE | MAE | MAPE | |
| KNN算法 | 348.12 | 293.90 | 3.679 | 517.88 | 485.69 | 6.51 |
| BP神经网络 | 423.30 | 322.44 | 5.650 | 497.51 | 466.21 | 6.77 |
| 决策树算法 | 510.52 | 452.72 | 5.860 | 403.65 | 348.12 | 4.37 |
| GBDT算法 | 436.62 | 285.12 | 5.330 | 996.94 | 879.56 | 11.29 |
| CatBoost算法 | 308.02 | 199.56 | 2.880 | 321.56 | 274.97 | 4.14 |
从表1中可以看出,CatBoost算法相对其他几种算法预测的误差最低,能够进行有效的短期负荷预测。
5 结论
针对传统电力系统负荷预测算法数据预处理过程当中大量的超参数调节以及数值强行代替标签时容易发生条件偏移的问题,首先选取两地区20天的数据用于训练CatBoost模型,其次将预测结果与其他常见智能算法进行分析和对比,最后根据仿真可得出如下结论。
(1) 将CatBoost算法应用于电力系统负荷预测可减小模型训练过程中对超参数的依赖,降低了模型过拟合的机率,增强了算法的通用性;在数据预处理过程中无需用数值强行代替标签,能有效防止特征标签条件偏移,有助于在数据集中存在更具描述性的类别特征标签时提高预测的精度。
(2) 在采用了真实数据的情况下,CatBoost算法能够胜任小数据量情况下的回归问题。仿真结果也显示其预测结果能够有效地显示负荷变化的趋势和具体的负荷值,且通过对预测结果的分析显示具有较低的误差。
参考文献
考虑分布式光伏和电动汽车接入的配电网空间负荷预测方法
[J].
Distribution network spatial load forecasting method considering distributed photovoltaic and electric vehicle access
[J].
基于柔性负荷响应特性的超短期预测方法
[J].
Ultra-short term prediction method based on flexible load response characteristics
[J].
基于改进倍比平滑法的节假日短期负荷预测方法
[J].
DOI:10.3969/j.issn.1000-7229.2014.10.005
URL
[本文引用: 1]
To improve the prediction accuracy of short-term load in holidays, this paper proposed a load prediction method based on the combination of base value and normalized curve, as well as the grey correlation degree of meteorological correction. The principle of “near greater far smaller” was also taken into account in the base value prediction, and the index smoothing method was improved and used for the load forecasting in holidays. The smoothing factor was determined using 0.618 optimization methods, and the samples in correlation days were processed with using index smoothing method. It was suggested that the similarity of load fluctuation in same holidays should be considered and the meteorological correlation should be analyzed with using grey correlation degree, during the prediction of normalized curve. According to 96 points holidays load forecasting for a city in Guangdong province, the accuracy of the prediction method was better, which verified the feasibility of this method. In this model, the base values of normal days and the short-term load forecasting method of normalized curve were used for the load prediction in holidays, which could overcome the problem of poor prediction accuracy caused by poor samples, and could be a reference for the power company to forecast holiday loads.
Prediction method of short term load in holidays based on improved multiple proportions smoothing method
[J].
DOI:10.3969/j.issn.1000-7229.2014.10.005
URL
[本文引用: 1]
To improve the prediction accuracy of short-term load in holidays, this paper proposed a load prediction method based on the combination of base value and normalized curve, as well as the grey correlation degree of meteorological correction. The principle of “near greater far smaller” was also taken into account in the base value prediction, and the index smoothing method was improved and used for the load forecasting in holidays. The smoothing factor was determined using 0.618 optimization methods, and the samples in correlation days were processed with using index smoothing method. It was suggested that the similarity of load fluctuation in same holidays should be considered and the meteorological correlation should be analyzed with using grey correlation degree, during the prediction of normalized curve. According to 96 points holidays load forecasting for a city in Guangdong province, the accuracy of the prediction method was better, which verified the feasibility of this method. In this model, the base values of normal days and the short-term load forecasting method of normalized curve were used for the load prediction in holidays, which could overcome the problem of poor prediction accuracy caused by poor samples, and could be a reference for the power company to forecast holiday loads.
电力系统负荷预测研究综述与发展方向的探讨
[J].
Review of power system load forecasting and its development
[J].
基于多层聚类和改进BP神经网络的短期负荷预测
[J].
Short term load forecasting based on multi-layer clustering and improved BP neural network
[J].
区分待预测日的城市电网短期负荷预测方法研究
[J].
Research on short term load forecasting method for urban power grid on the forecast day
[J].
基于改进灰色关联分析与蝙蝠优化神经网络的短期负荷预测
[J].
Short term load forecasting based on improved grey correlation analysis and bat optimization neural network
[J].
基于粗糙集和BP网络的微网短期负荷预测
[J].
Short term load forecasting of microgrid based on rough set and BP network
[J].
电网短期负荷预测的BP-ANN方法及应用
[J].
DOI:10.3969/j.issn.1000-7229.2014.03.010
URL
[本文引用: 1]
Aimed at the problem of low accuracy of traditional method for power system short-term load forecast, this paper presents a method for short-term load forecasting based on BP-ANN(back-propagation artificial neural network). The multiscale entropy method was used to analyze the short-term load data, whose results showed that the forecast points were related to both the prophase adjacent data and the periodical long-term historical load data. Meanwhile, with using autocorrelation analysis method, the suitable method for short-term load forecasting of Shaanxi power grid was presented based on BP-ANN, and applied in practical power system load. The results have shown that this method is simple, feasible, more practical, and with high precision.
BP-ANN method for power grid short term load forecasting and its application
[J].
DOI:10.3969/j.issn.1000-7229.2014.03.010
URL
[本文引用: 1]
Aimed at the problem of low accuracy of traditional method for power system short-term load forecast, this paper presents a method for short-term load forecasting based on BP-ANN(back-propagation artificial neural network). The multiscale entropy method was used to analyze the short-term load data, whose results showed that the forecast points were related to both the prophase adjacent data and the periodical long-term historical load data. Meanwhile, with using autocorrelation analysis method, the suitable method for short-term load forecasting of Shaanxi power grid was presented based on BP-ANN, and applied in practical power system load. The results have shown that this method is simple, feasible, more practical, and with high precision.
基于EEMD-BP神经网络的含电采暖的配电变压器短期负荷预测
[J].
Short term load forecasting of distribution transformer with electric heating based on EEMD-BP neural network
[J].
大数据分析的无限深度神经网络方法
[J].
DOI:DOI:10.7544/issn1000-1239.2016.20150663
URL
[本文引用: 1]
深度神经网络(deep neural networks, DNNs)及其学习算法,作为成功的大数据分析方法,已为学术界和工业界所熟知.与传统方法相比,深度学习方法以数据驱动、能自动地从数据中提取特征(知识),对于分析非结构化、模式不明多变、跨领域的大数据具有显著优势.目前,在大数据分析中使用的深度神经网络主要是前馈神经网络(feedforward neural networks, FNNs),这种网络擅长提取静态数据的相关关系,适用于基于分类的数据应用场景.但是受到自身结构本质的限制,它提取数据时序特征的能力有限.无限深度神经网络(infinite deep neural networks)是一种具有反馈连接的回复式神经网络(recurrent neural networks, RNNs),本质上是一个动力学系统,网络状态随时间演化是这种网络的本质属性,它耦合了“时间参数”,更加适用于提取数据的时序特征,从而进行大数据的预测.将这种网络的反馈结构在时间维度展开,随着时间的运行,这种网络可以“无限深”,故称之为无限深度神经网络.重点介绍这种网络的拓扑结构和若干学习算法及其在语音识别和图像理解领域的成功实例.
Infinite depth neural network method for big data analysis
[J].
DOI:DOI:10.7544/issn1000-1239.2016.20150663
URL
[本文引用: 1]
深度神经网络(deep neural networks, DNNs)及其学习算法,作为成功的大数据分析方法,已为学术界和工业界所熟知.与传统方法相比,深度学习方法以数据驱动、能自动地从数据中提取特征(知识),对于分析非结构化、模式不明多变、跨领域的大数据具有显著优势.目前,在大数据分析中使用的深度神经网络主要是前馈神经网络(feedforward neural networks, FNNs),这种网络擅长提取静态数据的相关关系,适用于基于分类的数据应用场景.但是受到自身结构本质的限制,它提取数据时序特征的能力有限.无限深度神经网络(infinite deep neural networks)是一种具有反馈连接的回复式神经网络(recurrent neural networks, RNNs),本质上是一个动力学系统,网络状态随时间演化是这种网络的本质属性,它耦合了“时间参数”,更加适用于提取数据的时序特征,从而进行大数据的预测.将这种网络的反馈结构在时间维度展开,随着时间的运行,这种网络可以“无限深”,故称之为无限深度神经网络.重点介绍这种网络的拓扑结构和若干学习算法及其在语音识别和图像理解领域的成功实例.
基于人工神经网络的负荷模型预测
[J].
Prediction of load model based on artificial neural network
[J].
加权多分位鲁棒ELM的短期负荷预测方法
[J/OL].
Weighted multi-component robust ELM short term load forecasting method
[J/OL].
大数据背景下的充电站负荷预测方法
[J].
Load forecasting method for electric vehicle charging station based on big data
[J].
采用长短期记忆深度学习模型的工业负荷短期预测方法
[J].
A long short term memory based deep learning method for industrial load forecasting
[J].
电力系统短期负荷预测方法综述
[J].DOI:10.7667/j.issn.1674-3415.2011.01.028 URL [本文引用: 1]
Review of the short term load forecasting methods of electric power system
[J].DOI:10.7667/j.issn.1674-3415.2011.01.028 URL [本文引用: 1]
夏季日最大降温负荷的估算和预测方法
[J].DOI:10.7667/PSPC150822 URL [本文引用: 1]
An estimating and forecasting method for daily maximum cooling load in summer
[J].DOI:10.7667/PSPC150822 URL [本文引用: 1]
基于细粒度特征的BOA- GBDT光伏出力预测
[J/OL].
Prediction of PVoutput based on fine-grained features of BOA-GBDT
[J/OL].
CatBoost:Gradient boosting with categorical features support
[M].
Potential of kernel-based nonlinear extension of ARPS decline model and gradient boosting with categorical features support for predicting daily global solar radiation in humid regions
[J].
/
| 〈 |
|
〉 |
