CN112734135B - A power load forecasting method, intelligent terminal and computer-readable storage medium - Google Patents
A power load forecasting method, intelligent terminal and computer-readable storage medium Download PDFInfo
- Publication number
- CN112734135B CN112734135B CN202110102621.0A CN202110102621A CN112734135B CN 112734135 B CN112734135 B CN 112734135B CN 202110102621 A CN202110102621 A CN 202110102621A CN 112734135 B CN112734135 B CN 112734135B
- Authority
- CN
- China
- Prior art keywords
- load
- predicted
- historical
- data
- initial
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION 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/00—Administration; Management
- G06Q10/04—Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/01—Dynamic search techniques; Heuristics; Dynamic trees; Branch-and-bound
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION 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/00—Administration; Management
- G06Q10/06—Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
- G06Q10/067—Enterprise or organisation modelling
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION 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/00—Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
- G06Q50/06—Energy or water supply
Landscapes
- Engineering & Computer Science (AREA)
- Business, Economics & Management (AREA)
- Strategic Management (AREA)
- Human Resources & Organizations (AREA)
- Economics (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- Entrepreneurship & Innovation (AREA)
- General Business, Economics & Management (AREA)
- Tourism & Hospitality (AREA)
- Marketing (AREA)
- Development Economics (AREA)
- Operations Research (AREA)
- Health & Medical Sciences (AREA)
- Game Theory and Decision Science (AREA)
- Quality & Reliability (AREA)
- Artificial Intelligence (AREA)
- Data Mining & Analysis (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Computational Linguistics (AREA)
- Mathematical Physics (AREA)
- Computing Systems (AREA)
- Evolutionary Computation (AREA)
- Public Health (AREA)
- Water Supply & Treatment (AREA)
- General Health & Medical Sciences (AREA)
- Primary Health Care (AREA)
- Educational Administration (AREA)
- Supply And Distribution Of Alternating Current (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
Description
技术领域technical field
本发明涉及电力数据分析技术领域,尤其涉及一种电力负荷预测方法、智能终端及计算机可读存储介质。The present invention relates to the technical field of power data analysis, and in particular, to a power load prediction method, an intelligent terminal and a computer-readable storage medium.
背景技术Background technique
由于电力能源不可储存,电力系统为了维持电网频率,保证发电量与用电量之间平衡的供需关系,因此必须提前对电力负荷进行预测,并根据预测结果制定发电计划。电力系统负荷预测的研究目的就是提高预测精度,在尽可能低的运行成本下提供安全可靠的电力供应。由于用户侧,也就是用电端,存在诸多用电因素,在日常发电过程中,必须保证一部分火电机组处于旋转备用状态。如果用户侧用电负荷突然减小,火电机组将进行甩负荷,极大地影响电网安全,并将造成了巨大的能源浪费。因此短期负荷预测是电力系统的一项重要任务,预测结果的精确度直接影响电力系统的稳定性,也影响到电网企业的运行成本和电网安全。Since electric energy cannot be stored, in order to maintain the frequency of the grid and ensure a balanced supply and demand relationship between power generation and power consumption, the power system must forecast the power load in advance, and formulate a power generation plan based on the forecast results. The research purpose of power system load forecasting is to improve the forecasting accuracy and provide safe and reliable power supply at the lowest possible operating cost. Since there are many power consumption factors on the user side, that is, the power consumption end, in the daily power generation process, it is necessary to ensure that some thermal power units are in a rotating standby state. If the electricity load on the user side suddenly decreases, the thermal power unit will shed load, which will greatly affect the security of the power grid and cause huge energy waste. Therefore, short-term load forecasting is an important task of the power system. The accuracy of the forecast results directly affects the stability of the power system, as well as the operating cost and power grid security of power grid companies.
然而,由于气候变化、社会活动、居民生活习惯等诸多外部因素,使得电力负荷的预测具有高度的非线性和不可预测性,因此,精确的短期电力负荷预测一直是电力行业中的一个难题。因此,开发短期电力负荷高精度预测方法,对减少能源浪费、优化电力系统运行,具有十分重要的意义。However, due to many external factors such as climate change, social activities, and residents' living habits, the forecasting of power load is highly nonlinear and unpredictable. Therefore, accurate short-term power load forecasting has always been a difficult problem in the power industry. Therefore, it is of great significance to develop a short-term power load high-precision forecasting method for reducing energy waste and optimizing power system operation.
发明内容SUMMARY OF THE INVENTION
本发明的主要目的在于提供一种电力负荷预测方法、智能终端及计算机可读存储介质,旨在解决现有技术中短期用电预测精确度低的问题。The main purpose of the present invention is to provide a power load forecasting method, an intelligent terminal and a computer-readable storage medium, aiming to solve the problem of low accuracy of short-term power consumption forecasting in the prior art.
为实现上述目的,本发明提供一种电力负荷预测方法,所述电力负荷预测方法包括如下步骤:In order to achieve the above object, the present invention provides a power load prediction method, and the power load prediction method includes the following steps:
获取待预测时间对应的预测特征数据,其中,所述预测特征数据包括气象数据和时间类型;Obtaining prediction feature data corresponding to the time to be predicted, wherein the prediction feature data includes meteorological data and time type;
将所述预测特征数据输入已训练的分类模型并通过所述分类模型对所述待预测时间进行用电模式分类,得到所述待预测时间对应的预测用电模式;Inputting the predicted feature data into a trained classification model and classifying the electricity consumption pattern of the time to be predicted by the classification model, to obtain a predicted electricity consumption pattern corresponding to the time to be predicted;
将所述预测特征数据输入已训练的负荷预测模型并通过所述负荷预测模型对所述待预测时间进行用电负荷预测,得到所述待预测时间对应的初始用电负荷曲线预测用电负荷;Inputting the prediction feature data into a trained load prediction model and predicting the electricity load for the to-be-predicted time by using the load prediction model, to obtain an initial electricity-use load curve corresponding to the to-be-predicted time to predict the electricity load;
根据所述预测用电模式和所述初始用电负荷曲线预测用电负荷,确定所述待预测时间对应的预测用电负荷曲线。The power consumption load is predicted according to the predicted power consumption mode and the initial power consumption load curve, and the predicted power consumption load curve corresponding to the to-be-predicted time is determined.
可选地,所述的电力负荷预测方法,其中,所述分类模型包括基于随机森林算法训练得到的若干个分类决策树;所述分类决策树的训练过程具体包括:Optionally, in the power load forecasting method, the classification model includes several classification decision trees trained based on random forest algorithm; the training process of the classification decision tree specifically includes:
获取预设的各个历史时间对应的历史负荷数据和历史特征数据;Obtain historical load data and historical feature data corresponding to each preset historical time;
对所述历史负荷数据进行聚类处理,生成目标聚类集合,其中,所述目标聚类集合包括若干个用电模式集合,所述用电模式集合包括对应同一用电模式的历史负荷数据;Performing clustering processing on the historical load data to generate a target cluster set, wherein the target cluster set includes several sets of electricity consumption patterns, and the set of electricity consumption patterns includes historical load data corresponding to the same electricity consumption mode;
针对每一个所述用电模式集合,根据该用电模式集合中各个历史负荷数据对应的历史时间,对所述历史特征数据进行标注,得到各个所述历史特征数据对应的用电模式;For each of the set of power consumption patterns, according to the historical time corresponding to each historical load data in the set of power consumption patterns, the historical feature data is marked to obtain the power consumption pattern corresponding to each of the historical feature data;
针对每一个预设的决策树,选取所述历史特征数据中的训练特征数据输入该决策树并根据基尼指数对该决策树进行分裂,直至该决策树中各个节点的历史特征数据对应的用电模式相同,得到所述分类决策树。For each preset decision tree, select the training feature data in the historical feature data to input into the decision tree and split the decision tree according to the Gini index, until the power consumption corresponding to the historical feature data of each node in the decision tree The pattern is the same, and the classification decision tree is obtained.
可选地,所述的电力负荷预测方法,其中,所述对所述历史负荷数据进行聚类处理,生成目标聚类集合,具体包括:Optionally, in the power load forecasting method, the performing clustering processing on the historical load data to generate a target cluster set specifically includes:
根据当前的聚类个数,随机确定所述历史负荷数据中的初始聚类中心,其中,当初次进行聚类时,所述聚类个数为2;According to the current number of clusters, randomly determine the initial cluster center in the historical load data, wherein, when clustering is performed for the first time, the number of clusters is 2;
根据预设的模糊C均值聚类算法和所述初始聚类中心,计算所述历史负荷数据对应的第k中间隶属度矩阵,其中,k为聚类次数;According to the preset fuzzy C-means clustering algorithm and the initial clustering center, calculate the k-th intermediate membership degree matrix corresponding to the historical load data, wherein k is the number of times of clustering;
当所述聚类个数小于预设的聚类个数阈值时,将所述聚类个数加一,并重复确定第k中间隶属度矩阵;When the number of clusters is less than the preset number of clusters threshold, the number of clusters is increased by one, and the kth intermediate membership matrix is repeatedly determined;
当所述聚类个数大于等于所述聚类个数阈值时,确定第一中间隶属度矩阵至第(K-1)中间隶属度矩阵中的目标隶属度矩阵,其中,K为所述聚类个数阈值;When the number of clusters is greater than or equal to the threshold of the number of clusters, determine the target membership degree matrix from the first intermediate membership degree matrix to the (K-1)th intermediate membership degree matrix, where K is the clustering degree matrix. class number threshold;
根据所述目标隶属度矩阵和所述目标隶属度矩阵对应的聚类中心,对所述历史负荷数据进行聚类,得到目标聚类集合。According to the target membership degree matrix and the cluster center corresponding to the target membership degree matrix, the historical load data is clustered to obtain a target cluster set.
可选地,所述的电力负荷预测方法,其中,所述当所述聚类个数大于等于所述聚类个数阈值时,确定第一中间隶属度矩阵至第(K-1)中间隶属度矩阵中的目标隶属度矩阵,具体包括:Optionally, the power load prediction method, wherein, when the number of clusters is greater than or equal to the threshold of the number of clusters, determine the first intermediate membership degree matrix to the (K-1)th intermediate membership. The target membership degree matrix in the degree matrix, including:
针对所述第一中间隶属度矩阵至所述第(K-1)中间隶属度矩阵中的每一个中间隶属度矩阵,计算该中间隶属度矩阵对应的聚类有效性指标;For each of the intermediate membership degree matrices from the first intermediate membership degree matrix to the (K-1)th intermediate membership degree matrix, calculate the clustering validity index corresponding to the intermediate membership degree matrix;
根据所述聚类有效性指标,确定第一中间隶属度矩阵至所述第(K-1)中间隶属度矩阵中的目标聚类集合。According to the clustering effectiveness index, a set of target clusters in the first intermediate membership degree matrix to the (K-1)th intermediate membership degree matrix is determined.
可选地,所述的电力负荷预测方法,其中,所述负荷预测模型包括若干个负荷预测子模型,所述负荷预测子模型与所述用电模式一一对应。Optionally, in the power load forecasting method, the load forecasting model includes several load forecasting sub-models, and the load forecasting sub-models are in one-to-one correspondence with the electricity consumption patterns.
可选地,所述的电力负荷预测方法,其中,所述历史负荷数据包括每一个所述历史时间对应的历史负荷曲线,所述历史负荷曲线包括历史负荷特征值;所述负荷预测子模型的训练过程包括具体包括:Optionally, in the power load forecasting method, the historical load data includes a historical load curve corresponding to each historical time, and the historical load curve includes a historical load characteristic value; The training process includes specifically:
针对每一个预设的初始模型,将训练曲线数据输入该初始模型中所述历史特征数据中该初始模型对应的训练特征数据并通过该初始模型对所述训练曲线数据历史特征数据进行分类,得到各个所述训练曲线数据历史特征数据对应的训练负荷特征值,其中,所述训练曲线数据为所述历史特征数据中与该初始模型对应的数据;For each preset initial model, input the training curve data into the training feature data corresponding to the initial model in the historical feature data in the initial model, and classify the historical feature data of the training curve data through the initial model to obtain Each training load characteristic value corresponding to the historical characteristic data of the training curve data, wherein the training curve data is the data corresponding to the initial model in the historical characteristic data;
根据所述训练负荷特征值和所述历史特征数据对应的历史负荷特征值,对该初始模型进行参数优化,直至该初始模型收敛,得到损失负荷预测子模型。According to the training load characteristic value and the historical load characteristic value corresponding to the historical characteristic data, parameter optimization of the initial model is performed until the initial model converges, and a loss load prediction sub-model is obtained.
可选地,所述的电力负荷预测方法,其中,所述初始用电负荷曲线预测用电负荷包括每个负荷预测子模型对应的候选预估用电负荷曲线;所述将所述预测特征数据输入已训练的负荷预测模型并通过所述负荷预测模型对所述待预测时间进行用电负荷预测,得到所述待预测时间对应的初始用电负荷曲线预测用电负荷,具体包括:Optionally, in the power load forecasting method, wherein the initial power consumption curve prediction power consumption load includes a candidate estimated power consumption load curve corresponding to each load prediction sub-model; Input the trained load prediction model and use the load prediction model to predict the electricity load for the time to be predicted, and obtain the initial electricity load curve corresponding to the to-be-predicted time to predict the electricity load, which specifically includes:
针对每一个所述负荷预测子模型,将所述预测特征数据输入该负荷预测子模型,得到所述预测特征数据对应的预测负荷特征值;For each of the load prediction sub-models, input the predicted characteristic data into the load prediction sub-model to obtain the predicted load characteristic value corresponding to the predicted characteristic data;
根据该负荷预测子模型对应的用电模式集合和所述预测负荷特征值,计算该负荷预测子模型对应的候选用电负荷曲线预估用电负荷。According to the set of power consumption patterns corresponding to the load forecasting sub-model and the predicted load characteristic value, a candidate power consumption curve corresponding to the load forecasting sub-model is calculated to estimate the power consumption load.
可选地,所述的电力负荷预测方法,其中,所述预测用电模式包括每一个所述分类决策树对所述预测特征数据分类得到的该待预测时间对应的预估用电模式;所述根据所述预测用电模式和所述初始用电负荷曲线预测用电负荷,确定所述待预测时间对应的预测用电负荷曲线,具体包括:Optionally, in the power load forecasting method, the predicted power consumption mode includes an estimated power consumption mode corresponding to the to-be-predicted time obtained by classifying the predicted feature data by each of the classification decision trees; Predicting the power consumption load according to the predicted power consumption mode and the initial power consumption load curve, and determining the predicted power consumption load curve corresponding to the to-be-predicted time, specifically including:
根据所有的所述预估用电模式,计算各个用电模式对应的模式占比值;According to all the estimated power consumption modes, calculate the mode ratio value corresponding to each power consumption mode;
针对每一个所述用电模式,根据该用电模式对应的模式占比值,对该用电模式对应的候选用电负荷曲线预测负荷曲线进行加权求和,得到该待预测时间对应的预测用电负荷曲线。For each power consumption mode, according to the mode ratio value corresponding to the power consumption mode, weighted summation is performed on the predicted load curve of the candidate power consumption curve corresponding to the power consumption mode to obtain the predicted power consumption corresponding to the to-be-predicted time. load curve.
此外,为实现上述目的,本发明还提供一种智能终端,其中,所述智能终端包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的电力负荷预测程序,所述电力负荷预测程序被所述处理器执行时实现如上所述的电力负荷预测方法的步骤。In addition, in order to achieve the above object, the present invention also provides an intelligent terminal, wherein the intelligent terminal includes: a memory, a processor, and a power load prediction program stored in the memory and running on the processor, The electrical load forecasting program, when executed by the processor, implements the steps of the electrical load forecasting method as described above.
此外,为实现上述目的,本发明还提供一种计算机可读存储介质,其中,所述计算机可读存储介质存储有电力负荷预测程序,所述电力负荷预测程序被处理器执行时实现如上所述的电力负荷预测方法的步骤。In addition, in order to achieve the above object, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a power load prediction program, and the power load prediction program is executed by a processor to achieve the above-mentioned The steps of the power load forecasting method.
本发明将用电的预测分为模式预测和负荷预测,先获取待预测时间对应的待预测特征数据,待预测特征数据包括气象数据和时间类型,然后根据预测特征数据确定其对应的预测用电模式,同时根据预测特征数据预测其对应的初始用电负荷曲线,然后根据预测用电模式,对预测用电负荷进行调整,从而得到待预测时间对应的用电负荷曲线。由于本发明在常规的负荷预测基础上增加了对用电模式的预测,并且在用电模式的基础上对负荷预测的结果进行调整,因此预测结果更为准确。The present invention divides the prediction of electricity consumption into mode prediction and load prediction. First, the to-be-predicted characteristic data corresponding to the to-be-predicted time is obtained. The to-be-predicted characteristic data includes meteorological data and time type, and then the corresponding predicted electricity consumption is determined according to the predicted characteristic data. At the same time, the corresponding initial power consumption curve is predicted according to the predicted characteristic data, and then the predicted power consumption load is adjusted according to the predicted power consumption mode, so as to obtain the power consumption load curve corresponding to the time to be predicted. Since the present invention adds the prediction of the power consumption mode on the basis of the conventional load prediction, and adjusts the load prediction result on the basis of the power consumption mode, the prediction result is more accurate.
附图说明Description of drawings
图1是本发明电力负荷预测方法提供的较佳实施例的流程图;Fig. 1 is the flow chart of the preferred embodiment provided by the power load forecasting method of the present invention;
图2为本发明智能终端的较佳实施例的运行环境示意图。FIG. 2 is a schematic diagram of an operating environment of a preferred embodiment of an intelligent terminal of the present invention.
具体实施方式Detailed ways
为使本发明的目的、技术方案及优点更加清楚、明确,以下参照附图并举实施例对本发明进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the objectives, technical solutions and advantages of the present invention clearer and clearer, the present invention will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present invention.
本发明较佳实施例所述的电力负荷预测方法,该电力负荷预测方法可通过智能终端执行,所述智能终端包括智能电视、智能手机等终端。如图1所述,所述电力负荷预测方法包括以下步骤:The power load prediction method according to the preferred embodiment of the present invention can be executed by an intelligent terminal, and the intelligent terminal includes terminals such as a smart TV and a smart phone. As shown in Figure 1, the power load forecasting method includes the following steps:
步骤S100,获取待预测时间对应的预测特征数据,其中,所述预测特征数据包括气象数据和时间类型。Step S100, obtaining prediction feature data corresponding to the time to be predicted, wherein the prediction feature data includes meteorological data and time type.
具体地,先获取待预测时间所对应的预测特征数据,本实施例中,预测特征数据是指根据与用电负荷相关的特征的数据,例如气象数据和时间类型。以气象数据为例,天气炎热时,家家户户需要电扇和空调,因此用电负荷会相较于正常气温情况下要增加。本实施例中的气象数据包括温度、风力、湿度等。时间类型是指待预测时间与用电负荷相关的时间特征,例如深夜用电负荷与白天用电负荷肯定存在差异,工作日、周末和节假日的用电负荷也存在一定的差异。Specifically, the prediction feature data corresponding to the time to be predicted is obtained first. In this embodiment, the prediction feature data refers to data based on features related to electricity load, such as weather data and time type. Taking meteorological data as an example, when the weather is hot, every household needs fans and air conditioners, so the electricity load will increase compared with the normal temperature. The meteorological data in this embodiment includes temperature, wind, humidity and the like. The time type refers to the time characteristics related to the time to be predicted and the electricity load. For example, there is definitely a difference between the electricity load at night and the electricity load during the day, and there are also certain differences in the electricity load on weekdays, weekends, and holidays.
此外,本实施例中的待预测时间以日为单位,也就是预测某一天的用电负荷,但在实际应用中,待预测时间可以根据实际需求进行更为详细或粗狂的划分,例如待预测时间为某一天的某一个小时,或者某一周的用电负荷。In addition, the time to be predicted in this embodiment is in units of days, that is, to predict the electricity load on a certain day. However, in practical applications, the time to be predicted can be divided into more detail or roughness according to actual needs. The forecast time is a certain hour of a day, or the electricity load of a certain week.
步骤S200,将所述预测特征数据输入已训练的分类模型并通过所述分类模型对所述待预测时间进行用电模式分类,得到所述待预测时间对应的预测用电模式。Step S200 , inputting the predicted feature data into a trained classification model, and classifying the electricity consumption pattern of the to-be-predicted time through the classification model to obtain a predicted electricity-consumption pattern corresponding to the to-be-predicted time.
具体地,将所述预测特征数据输入已训练的分类模型,本实施例中所采用的分类模型为有监督学习的分类,分类模型计算预测特征数据为预设的用电模式的概率值,从而得到预测用电模式。在本实施例的第一种得到预测用电模式的方式中,直接将概率值最大的用电模式作为预测用电模式。Specifically, the predicted feature data is input into a trained classification model. The classification model used in this embodiment is a supervised learning classification, and the classification model calculates a probability value that the predicted feature data is a preset power consumption mode, thereby Get the predicted electricity usage pattern. In the first method of obtaining the predicted power consumption mode in this embodiment, the power consumption mode with the largest probability value is directly used as the predicted power consumption mode.
进一步地,本实施例中,所述分类模型包括基于随机森林算法训练得到的若干个分类决策树;分类决策树是在随机森林算法基础上对决策树进行训练得到的,本实施例中得到分类决策树的过程为:Further, in this embodiment, the classification model includes several classification decision trees obtained by training based on the random forest algorithm; the classification decision tree is obtained by training the decision trees on the basis of the random forest algorithm, and in this embodiment, the classification is obtained. The process of decision tree is:
A10、获取预设的各个历史时间对应的历史负荷数据和历史特征数据。A10. Acquire historical load data and historical feature data corresponding to each preset historical time.
具体地,获取预设的各个历史时间对应的历史负荷数据,由于本实施例以日为待预测时间的单位,因此,训练时获取的历史负荷数据也是以日为单位,设为X={x1,x2,…,xN},N表示数据集包含的总天数。进一步地,在本实施例中,每一个历史时间,也就是每一天的历史负荷数据包括该天的历史负荷曲线归一化的值进行表示,历史负荷曲线为xi={xi1,xi2,…,xim},m表示一天的负荷采样点,然后将历史负荷曲线中的每一个采样点对应的负荷值除以历史负荷曲线中的最大值,实现对历史负荷曲线的归一化,得到历史负荷数据。Specifically, the historical load data corresponding to each preset historical time is obtained. Since the unit of time to be predicted is taken as day in this embodiment, the historical load data obtained during training is also taken as the unit of day, which is set as X={x 1 ,x 2 ,…,x N }, where N represents the total number of days the dataset contains. Further, in this embodiment, the historical load data of each historical time, that is, each day, includes the normalized value of the historical load curve of the day for representation, and the historical load curve is x i ={x i1 ,x i2 ,…,x im }, m represents the load sampling points of one day, and then divide the load value corresponding to each sampling point in the historical load curve by the maximum value in the historical load curve to achieve normalization of the historical load curve, Get historical load data.
历史特征数据为获取的历史时间对应的气象数据和时间类型,历史特征数据的集合表示为Y={y1,y2,…,yN},其中,N表示数据集包含的总天数,每一个历史时间对应的历史特征数据可表示为yi={yi1,yi2,…,yin,yin+1,yin+2,yin+3},前n个值为气象特征数据,后三个值为本实施例中的时间类型的编码结果,本实施例中的编码结果采用one-hot编码方式,时间类型仅以工作日、周末、节假日三种时间类型三种时间类型,但在应用时,还可包括周一到周日、上午、下午等时间类型。例如工作日为[0,0,1],周末为[0,1,0],节假日为[1,0,0]。The historical feature data is the meteorological data and time type corresponding to the acquired historical time. The set of historical feature data is expressed as Y={y 1 , y 2 ,..., y N }, where N represents the total number of days included in the data set, and each The historical characteristic data corresponding to a historical time can be expressed as y i ={y i1 ,y i2 ,...,y in ,y in+1 ,y in+2 ,y in+3 }, the first n values are meteorological characteristic data , the last three values are the encoding results of the time type in the present embodiment, the encoding result in the present embodiment adopts the one-hot encoding method, and the time type is only three time types of working days, weekends, and holidays three time types, But in application, it can also include time types such as Monday to Sunday, morning, afternoon, etc. For example, weekdays are [0,0,1], weekends are [0,1,0], and holidays are [1,0,0].
本实施例收集了A市共697天的负荷数据和特征数据。本实施例中的负荷曲线中的采样周期,也就是采样点之间的间隔为1小时,因此每一个负荷数据中包括24个归一化的负荷值,对这些负荷值进行归一化,从而得到负荷数据。特征数据包括气象数据和时间类型,气象数据包括最大风速、最小风速、最大温度、最小温度和表面平均气压5个特征。负荷数据X的维度为24×730,特征数据Y的维度为8×730。In this embodiment, the load data and characteristic data of city A are collected for 697 days. The sampling period in the load curve in this embodiment, that is, the interval between sampling points is 1 hour, so each load data includes 24 normalized load values, and these load values are normalized, so that Get load data. The characteristic data includes meteorological data and time type, and the meteorological data includes 5 characteristics of maximum wind speed, minimum wind speed, maximum temperature, minimum temperature and surface average pressure. The dimension of load data X is 24×730, and the dimension of feature data Y is 8×730.
为评估本实施例中采用的预测方法的准确性,本实施例中,以7:3的方式,随机选择486天(486/697约为0.7)的负荷数据作为历史负荷数据及其对应的特征数据作为历史特征数据。剩下的211天作为待预测时间,其对应的负荷数据和特征数据作为评估本实施例采用的方法准确性的测试负荷数据和测试特征数据。In order to evaluate the accuracy of the prediction method adopted in this embodiment, in this embodiment, the load data of 486 days (486/697 is about 0.7) is randomly selected as the historical load data and its corresponding characteristics in a 7:3 manner. data as historical feature data. The remaining 211 days are used as the time to be predicted, and the corresponding load data and characteristic data are used as test load data and test characteristic data for evaluating the accuracy of the method adopted in this embodiment.
A20、对所述历史负荷数据进行聚类处理,生成目标聚类集合,其中,所述目标聚类集合包括若干个用电模式集合,所述用电模式集合包括对应同一用电模式的历史负荷数据。A20. Perform clustering processing on the historical load data to generate a target cluster set, where the target cluster set includes several sets of electricity consumption patterns, and the set of electricity consumption patterns includes historical loads corresponding to the same electricity consumption pattern data.
具体地,通过对历史负荷数据进行聚类处理,生成目标聚类集合,所述目标聚类集合中包括有若干个用电模式集合。在本实施例中,聚类处理的方式可采用有监督、半监督的聚类算法,也可采用无监督的聚类算法。例如K-Means聚类、均值偏移聚类算法、层次聚类。Specifically, by performing clustering processing on the historical load data, a target cluster set is generated, and the target cluster set includes several power consumption mode sets. In this embodiment, a supervised or semi-supervised clustering algorithm or an unsupervised clustering algorithm may be used for the clustering process. For example K-Means clustering, mean shift clustering algorithm, hierarchical clustering.
进一步地,本实施例在聚类过程采用改进的模糊C均值聚类算法作为对历史负荷数据进行聚类处理的方式,具体过程如下:Further, the present embodiment adopts the improved fuzzy C-means clustering algorithm as the method for clustering the historical load data in the clustering process, and the specific process is as follows:
B10、根据当前的聚类个数,随机确定所述历史负荷数据中的初始聚类中心。B10. Randomly determine the initial cluster center in the historical load data according to the current number of clusters.
具体地,在进行聚类之前,先获取当前的聚类个数,聚类个数随着聚类次数的增加而增加,本实施例中当初次进行聚类时,所述聚类个数为2,也就是说初次聚类个数c=2。随机从历史负荷数据集中选择c个样本作为初始聚类中心θj,其中,j∈[1,c]。Specifically, before performing clustering, the current number of clusters is obtained first, and the number of clusters increases with the increase of the number of clusters. In this embodiment, when clustering is performed for the first time, the number of clusters is: 2, that is to say, the number of initial clusters is c=2. Randomly select c samples from the historical load dataset as initial cluster centers θ j , where j ∈ [1, c].
B20、根据预设的模糊C均值聚类算法和所述初始聚类中心,对所述历史负荷数据进行聚类,得到当前的聚类个数对应的第k聚类集合。B20. Perform clustering on the historical load data according to a preset fuzzy C-means clustering algorithm and the initial clustering center to obtain the kth cluster set corresponding to the current number of clusters.
具体地,模糊C均值聚类(Fuzzy C-Means,FCM)算法,是一种引入模糊力量的聚类算法,通过计算一个样本属于某一类的概率作为隶属度来将样本进行分类,FCM通过最小化目标函数和预设的约束条件来实现聚类。此过程为:Specifically, the fuzzy C-means clustering (Fuzzy C-Means, FCM) algorithm is a clustering algorithm that introduces fuzzy power. The samples are classified by calculating the probability that a sample belongs to a certain class as a degree of membership. Clustering is achieved by minimizing the objective function and preset constraints. The process is:
对第(r-1)聚类中心和第(r-1)隶属度矩阵进行更新,得到第r聚类中心和第r初始隶属度矩阵,其中,更新过程为:Update the (r-1)th cluster center and the (r-1)th membership matrix to obtain the rth cluster center and the rth initial membership matrix, where the update process is:
根据所述第(r-1)隶属度矩阵,计算所述第(r-1)聚类中心对应的体量,其中,(r-1)为迭代次数,当初次迭代时,第一聚类中心为初次聚类中心,第一初始隶属度矩阵为以随机数构建所述历史负荷数据对应的隶属度矩阵;Calculate the volume corresponding to the (r-1)th cluster center according to the (r-1)th membership degree matrix, where (r-1) is the number of iterations. When the first iteration is performed, the first cluster The center is the primary clustering center, and the first initial membership matrix is the membership matrix corresponding to the historical load data constructed with random numbers;
根据预设的聚类中心更新公式,更新所述第(r-1)聚类中心,得到第r聚类中心,并根据预设的隶属度值更新公式,更新所述第(r-1)隶属度矩阵,得到第r初始隶属度矩阵;According to the preset cluster center update formula, update the (r-1)th cluster center to obtain the rth cluster center, and update the formula according to the preset membership value to update the (r-1)th cluster center Membership degree matrix, get the rth initial membership degree matrix;
当确定所述第r初始隶属度矩阵符合预设的约束条件时,将所述第r初始隶属度矩阵作为第k中间隶属度矩阵并输出;When it is determined that the rth initial membership degree matrix complies with the preset constraint condition, the rth initial membership degree matrix is used as the kth intermediate membership degree matrix and output;
当确定所述第r初始隶属度矩阵不符合所述约束条件时,迭代对所述第r聚类中心和所述第r初始隶属度矩阵进行更新。When it is determined that the rth initial membership degree matrix does not meet the constraint condition, the rth cluster center and the rth initial membership degree matrix are updated iteratively.
在本实施例中,以(r-1)为1为例进行描述,在根据聚类个数c确定了若干个初始聚类中心后,以随机数构建第一初始隶属度矩阵UN×c={uij},i=1,...,N,j=1,...,c,其中,uij为第i个历史负荷数据对第j个聚类中心的隶属度值,随机数为[0,1]区间的随机数,N为所有历史时间对应历史负荷数据的数据量。根据隶属度矩阵中的各个历史负荷数据与初始聚类中心之间的隶属度值,可计算每一个第一聚类中心对应的体量,体量的计算公式为 In this embodiment, taking (r-1) as 1 as an example for description, after several initial cluster centers are determined according to the number of clusters c, a first initial membership degree matrix U N×c is constructed with random numbers ={u ij },i=1,...,N,j=1,...,c, where u ij is the membership value of the i-th historical load data to the j-th cluster center, random The number is a random number in the [0,1] interval, and N is the data volume of the historical load data corresponding to all historical times. According to the membership value between each historical load data in the membership matrix and the initial cluster center, the corresponding volume of each first cluster center can be calculated. The calculation formula of the volume is:
由于初始聚类中心是随机选择,且第一隶属度值为随机分配得到的,与真实情况差距较大,因此需要对初始聚类中心进行更新,得到第二聚类中心,其中,聚类中心更新公式为q为预设的模糊度值。同时,根据体量可评估根据第一初始隶属度矩阵中的隶属度值的可靠性,因此可根据计算得到的体量,对第一隶属度值进行更新,得到第二隶属度值,隶属度值更新公式为其中DTW(xi,θj)是动态时间规整距离。Since the initial cluster center is randomly selected, and the first membership value is obtained by random assignment, which is far from the real situation, it is necessary to update the initial cluster center to obtain the second cluster center, among which, the cluster center The update formula is q is the preset blur value. At the same time, the reliability of the membership degree value in the first initial membership degree matrix can be evaluated according to the volume, so the first membership degree value can be updated according to the calculated volume to obtain the second membership degree value, the membership degree The value update formula is where DTW( xi , θ j ) is the dynamic time warping distance.
在得到第二初始隶属度矩阵后,判第二初始隶属度矩阵是否满足预设的约束规则。若满足,则将第二初始隶属度矩阵作为第k中间隶属度矩阵并输出;若不满足,则继续更新隶属度值和聚类中心,直至第r初始隶属度矩阵满足所述约束规则,并将第r初始隶属度矩阵作为第k中间隶属度矩阵并输出。After obtaining the second initial membership degree matrix, it is judged whether the second initial membership degree matrix satisfies the preset constraint rule. If it is satisfied, the second initial membership degree matrix is taken as the kth intermediate membership degree matrix and output; if not, the membership degree value and the cluster center will continue to be updated until the rth initial membership degree matrix satisfies the constraint rule, and Take the rth initial membership matrix as the kth intermediate membership matrix and output it.
进一步地,本实施例中所采用的约束条件为或者r≥R,其中,ε为预设的迭代误差阈值,R为迭代次数阈值。Further, the constraints adopted in this embodiment are Or r≥R, where ε is the preset iteration error threshold, and R is the iteration number threshold.
B30、当所述聚类个数小于预设的聚类个数阈值时,将所述聚类个数加一,并重复确定第k中间隶属度矩阵。B30. When the number of clusters is less than a preset threshold for the number of clusters, add one to the number of clusters, and repeatedly determine the kth intermediate membership matrix.
具体地,预先设定一个聚类个数阈值K,当所述聚类个数小于预设的聚类个数阈值时,将所述聚类个数加一,以当前的聚类个数为2为例,加一后的聚类个数为3,然后以聚类个数为3重新在历史负荷数据中确认初始聚类中心,并计算聚类个数为3时对应的第二中间隶属度矩阵。Specifically, a threshold K of the number of clusters is preset, and when the number of clusters is less than the preset threshold of the number of clusters, the number of clusters is increased by one, and the current number of clusters is 2 as an example, the number of clusters after adding one is 3, and then re-confirm the initial cluster center in the historical load data with the number of clusters as 3, and calculate the second intermediate membership corresponding to when the number of clusters is 3 degree matrix.
B40、当所述聚类个数大于等于所述聚类个数阈值时,确定第一中间隶属度矩阵至第(K-1)中间隶属度矩阵中的目标隶属度矩阵。B40. When the number of clusters is greater than or equal to the threshold of the number of clusters, determine target membership degree matrices from the first intermediate membership degree matrix to the (K-1)th intermediate membership degree matrix.
具体地,当所述聚类个数大于等于所述聚类个数阈值时,则从聚类个数为2迭代增加到聚类个数为K这一过程中的所有第k中间隶属度矩阵中确认目标隶属度矩阵。由于每增加一次聚类个数,都会输出一个中间隶属度矩阵,每一个中间隶属度矩阵肯定存在差异,因此在其中选择计算最为准确的中间隶属度矩阵,即目标隶属度矩阵。在本实施例中,K为10,因此得到了第一隶属度矩阵到第九隶属度矩阵。Specifically, when the number of clusters is greater than or equal to the threshold of the number of clusters, then iteratively increases all kth intermediate membership degree matrices in the process from the number of clusters being 2 to the number of clusters being K Confirm the target membership matrix in . Since each time the number of clusters is increased, an intermediate membership matrix will be output, and each intermediate membership matrix must be different, so the most accurate intermediate membership matrix is selected among them, that is, the target membership matrix. In this embodiment, K is 10, so the first to ninth membership degree matrices are obtained.
本实施例中,确定目标隶属度矩阵的方式为:In this embodiment, the method of determining the target membership degree matrix is:
针对所述第一中间隶属度矩阵至所述第(K-1)中间隶属度矩阵中的每一个中间隶属度矩阵,计算该中间隶属度矩阵对应的聚类有效性指标;For each of the intermediate membership degree matrices from the first intermediate membership degree matrix to the (K-1)th intermediate membership degree matrix, calculate the clustering validity index corresponding to the intermediate membership degree matrix;
根据所述聚类有效性指标,确定第一中间隶属度矩阵至所述第(K-1)中间隶属度矩阵中的目标聚类集合。According to the clustering effectiveness index, a set of target clusters in the first intermediate membership degree matrix to the (K-1)th intermediate membership degree matrix is determined.
具体地,针对每一个聚类集合,计算其对应的聚类有效性指标(Cluster ValidityIndex,CVI),本实施例中,聚类有效性指标的计算公式为 其中,c为聚类个数,为该中间隶属度矩阵的对应的聚类中心的动态时间规整距离的最小值。然后选择所有的CVI中最小值所对应的中间隶属度矩阵作为目标隶属度矩阵,将目标隶属度矩阵对应的聚类个数记为c*。本实施例中的c*=5,即经过历史负荷数据训练得到的用电模式有五种。由于聚类中心θj是某一个天对应的历史负荷数据,本实施例中的历史负荷数据为24小时内每一个小时采点并归一化的负荷值,因此,聚类中心θj可标识为由24个数值组合的矢量。下表表1为基于历史负荷数据确定的5种用电模式的聚类中心,其中,每一列表示该用电模式对应的聚类中心。表2为历史负荷数据对应不同的用电模式的聚类中心的隶属度值。Specifically, for each cluster set, calculate its corresponding cluster validity index (Cluster Validity Index, CVI). In this embodiment, the calculation formula of the cluster validity index is: where c is the number of clusters, is the minimum value of the dynamic time warping distance of the corresponding cluster centers of the intermediate membership matrix. Then, the intermediate membership matrix corresponding to the minimum value in all CVIs is selected as the target membership matrix, and the number of clusters corresponding to the target membership matrix is denoted as c*. In this embodiment, c*=5, that is, there are five power consumption modes obtained through the training of historical load data. Since the cluster center θ j is the historical load data corresponding to a certain day, the historical load data in this embodiment is the load value of points collected and normalized in every hour within 24 hours. Therefore, the cluster center θ j can be identified as is a vector composed of 24 values. Table 1 below shows the cluster centers of the five electricity consumption patterns determined based on historical load data, wherein each column represents the cluster center corresponding to the electricity consumption pattern. Table 2 shows the membership values of the cluster centers of the historical load data corresponding to different electricity consumption patterns.
表1Table 1
表2Table 2
B50、根据所述目标隶属度矩阵和所述目标隶属度矩阵对应的聚类中心,对所述历史负荷数据进行聚类,得到目标聚类集合。B50. Perform clustering on the historical load data according to the target membership degree matrix and the cluster center corresponding to the target membership degree matrix to obtain a target cluster set.
具体地,根据目标隶属度矩阵和所述目标隶属度矩阵对应的聚类中心,对所述历史负荷数据进行去模糊化处理,针对每一个历史负荷数据,以该历史负荷数据对应的隶属度值中的最大值所对应的聚类中心为中心点,从而对各个历史负荷数据进行聚类,得到目标聚类集合。例如历史负荷数据对目标隶属度矩阵对应的聚类中心A、B、C、D和E的隶属度值分别为0.1、0.2、0.1、0.5和0.1,因此将该历史负荷数据A归为聚类中心D所在的类别。聚类结束时,每一个聚类中心对应的类别作为一个用电模式,从而得到c*个用电模式集合。Specifically, according to the target membership degree matrix and the cluster center corresponding to the target membership degree matrix, the historical load data is defuzzified, and for each historical load data, the membership value corresponding to the historical load data is used. The cluster center corresponding to the maximum value in is the center point, so that each historical load data is clustered to obtain the target cluster set. For example, the membership values of historical load data to the cluster centers A, B, C, D and E corresponding to the target membership matrix are 0.1, 0.2, 0.1, 0.5 and 0.1, respectively, so the historical load data A is classified as a cluster The category in which center D is located. At the end of clustering, the category corresponding to each cluster center is regarded as an electricity consumption pattern, thereby obtaining c* electricity consumption pattern sets.
A30、针对每一个所述用电模式集合,根据该用电模式集合中各个历史负荷数据对应的历史时间,对所述历史特征数据进行标注,得到各个所述历史特征数据对应的用电模式。A30. For each power consumption mode set, mark the historical feature data according to the historical time corresponding to each historical load data in the power consumption mode set, to obtain the power consumption mode corresponding to each historical feature data.
具体地,针对每一个用电模式集合,例如用电模式集合A,对该用电模式集合A中的历史负荷数据对应的历史时间进行标注,例如为3月3日和3月5日,标注为用电模式为用电模式A,从而对每一个历史特征数据进行标注,得到各个所述历史特征数据对应的用电模式,也就是将3月3日和3月5日对应的历史特征数据标注为用电模式A。Specifically, for each power consumption mode set, such as power consumption mode set A, mark the historical time corresponding to the historical load data in the power consumption mode set A, for example, on March 3 and March 5, mark In order for the electricity consumption mode to be electricity consumption mode A, each historical characteristic data is marked to obtain the electricity consumption mode corresponding to each of the historical characteristic data, that is, the historical characteristic data corresponding to March 3rd and March 5th are obtained. It is marked as power consumption mode A.
A40、针对每一个预设的决策树,选取所述历史特征数据中的训练特征数据输入该决策树并根据基尼指数对该决策树进行分裂,直至该决策树中各个节点的历史特征数据对应的用电模式相同,得到所述分类决策树。A40. For each preset decision tree, select the training feature data in the historical feature data to input the decision tree and split the decision tree according to the Gini index, until the historical feature data of each node in the decision tree corresponds to The power consumption patterns are the same, and the classification decision tree is obtained.
具体地,本实施例利用Python的随机森林包构建一个随机森林模型,设置参数:n_trees=200,即预先设定200个数量的决策树,其中,决策树的数量可根据实际需求进行调整。然后从所有的历史特征数据中随机、有放回地抽取多个训练特征数据,得到与决策树数量相同的训练特征数据集。每一个训练特征数据集用于训练一个决策树。本实施例中,每一个训练特征数据集包含400个训练特征数据。Specifically, this embodiment uses the random forest package of Python to build a random forest model, and sets the parameter: n_trees=200, that is, a preset number of 200 decision trees, wherein the number of decision trees can be adjusted according to actual needs. Then, multiple training feature data are randomly and replaced from all historical feature data to obtain the same number of training feature data sets as decision trees. Each training feature dataset is used to train a decision tree. In this embodiment, each training feature data set includes 400 training feature data.
对每一个决策树,从根节点开始向下分裂,每次分裂根据基尼指数选择最好的的特征进行分裂,直到所有的节点的训练特征数据都来源于同一类,即该节点的训练特征数据对应同一用电模式,停止分裂,得到分类决策树。For each decision tree, start splitting down from the root node, and select the best feature for each split according to the Gini index, until the training feature data of all nodes come from the same class, that is, the training feature data of the node. Corresponding to the same power consumption mode, stop splitting and get a classification decision tree.
步骤S300,将所述预测特征数据输入已训练的负荷预测模型并通过所述负荷预测模型对所述待预测时间进行用电负荷预测,得到所述待预测时间对应的初始用电负荷曲线。Step S300, inputting the prediction feature data into a trained load prediction model, and using the load prediction model to predict the electricity load for the to-be-predicted time to obtain an initial electricity-consumption load curve corresponding to the to-be-predicted time.
具体地,将获取的预测特征数据输入已训练的负荷预测模型,负荷预测模型用于根据输入的预测特征数据计算该预测特征数据对应的初始用电负荷曲线。负荷预测模型训练前的初始模型优选为神经网络模型。Specifically, the acquired predictive feature data is input into a trained load prediction model, and the load prediction model is used to calculate an initial electricity load curve corresponding to the predictive feature data according to the input predictive feature data. The initial model before the training of the load prediction model is preferably a neural network model.
本实施例中,所述负荷预测模型包括若干个负荷预测子模型,所述负荷预测子模型与所述用电模式一一对应。也就是说,每一个用电模式对应一个负荷预测子模型。从而避免由于用电模式的差异,导致预测的准确性降低。在本实施例得到预测用电负荷的一种实现方式中,在获得预测用电模式后,将预测特征数据输入预测用电模式对应的负荷预测模型中,从而得到对应的初始用电负荷曲线。In this embodiment, the load prediction model includes several load prediction sub-models, and the load prediction sub-models are in one-to-one correspondence with the power consumption patterns. That is to say, each power consumption mode corresponds to a load prediction sub-model. Thereby, it is avoided that the accuracy of prediction is reduced due to the difference of electricity consumption patterns. In an implementation manner of obtaining the predicted power consumption load in this embodiment, after the predicted power consumption mode is obtained, the predicted characteristic data is input into the load prediction model corresponding to the predicted power consumption mode, so as to obtain the corresponding initial power consumption load curve.
在本实施例中,负荷预测模型的训练过程为:In this embodiment, the training process of the load prediction model is:
针对每一个预设的初始模型,将训练曲线数据输入该初始模型中并通过该初始模型对所述训练曲线数据进行分类,得到各个所述历史特征数据对应的训练负荷特征值,其中,所述训练曲线数据为所述历史特征数据中与该初始模型对应的数据;For each preset initial model, input the training curve data into the initial model and classify the training curve data through the initial model to obtain the training load characteristic value corresponding to each of the historical characteristic data, wherein the The training curve data is the data corresponding to the initial model in the historical feature data;
根据所述训练负荷特征值和所述历史特征数据对应的历史负荷特征值,对该初始模型进行参数优化,直至该初始模型收敛,得到负荷预测子模型。According to the training load characteristic value and the historical load characteristic value corresponding to the historical characteristic data, parameter optimization of the initial model is performed until the initial model converges, and a load prediction sub-model is obtained.
具体地,本实施例中,预先设置与用电模式类型数量相等的神经网络模型,即五个,每一个神经网络模型包含5层,第一层为输入层,神经元数量等于8;中间3层为隐含层,每层包含10个神经元;最后一层为输出层,由两个神经元组成。其中,输入层的神经元数量由预测特征数据的类型的数量决定,即m+3。此外,还预先设定训练相关的参数学习率γ,批尺寸batch_size,训练目标最小误差ε。本实施例中学习率γ=0.001,批尺寸batch_size=64,训练目标最小误差ε=1e-5;Specifically, in this embodiment, the number of neural network models equal to the number of power consumption modes is preset, that is, five, each neural network model includes 5 layers, the first layer is the input layer, and the number of neurons is equal to 8; The layer is the hidden layer, each layer contains 10 neurons; the last layer is the output layer, which consists of two neurons. Among them, the number of neurons in the input layer is determined by the number of types of predicted feature data, that is, m+3. In addition, the training-related parameters learning rate γ, batch size batch_size, and training target minimum error ε are also preset. In this embodiment, the learning rate γ=0.001, the batch size batch_size=64, and the minimum error of the training target ε=1e-5;
针对每一个预设的神经网络模型,将该初始模型在所述历史特征数据中对应的训练曲线数据输入该初始模型,在本实施例的第一种实现方式中,直接根据该初始模型对应的用电模式,确定其对应的训练曲线数据,例如用电模式A,训练其对应的初始模型时,只将对应用电模式A的历史特征数据作为该初始模型对应的训练曲线数据。在本实施例的第二种实现方式中,是根据每一个历史特征数据对应的隶属度值确定该初始模型对应的训练曲线数据。例如某历史特征数据A,对应用电模式A的聚类中心的隶属度值为0.99,而历史特征数据B对应的隶属度值为0.1,则历史特征数据A较大概率被选择为该初始模型对应的训练曲线数据,而历史特征数据B则较低概率被选择为该初始模型对应的训练曲线数据。For each preset neural network model, the training curve data corresponding to the initial model in the historical feature data is input into the initial model. For the power consumption mode, determine the corresponding training curve data. For example, when the power consumption mode A is used to train the corresponding initial model, only the historical feature data of the application power mode A is used as the training curve data corresponding to the initial model. In the second implementation manner of this embodiment, the training curve data corresponding to the initial model is determined according to the membership value corresponding to each historical feature data. For example, a certain historical feature data A has a membership value of 0.99 for the cluster center of the applied electrical model A, while the membership value corresponding to the historical feature data B is 0.1, then the historical feature data A has a high probability to be selected as the initial model The corresponding training curve data, while the historical feature data B is selected as the training curve data corresponding to the initial model with a lower probability.
初始模型对输入的训练曲线数据进行分类,得到其对应的训练负荷曲线。由于所述历史负荷数据包括每一个所述历史时间对应的历史负荷曲线,单独预测曲线难度较大,因此,本实施例中,将历史负荷特征值作为描述训练负荷曲线的值。历史负荷特征值是指可形容该历史负荷曲线的特征的数值,例如峰值、谷值、平均值等。本实施例以峰值和谷值两者作为历史负荷特征值为例进行描述。训练负荷特征值指对输入的训练特征数据分类后得到的负荷特征值。The initial model classifies the input training curve data to obtain its corresponding training load curve. Since the historical load data includes a historical load curve corresponding to each of the historical times, it is difficult to predict the curve independently. Therefore, in this embodiment, the historical load characteristic value is used as a value for describing the training load curve. The historical load characteristic value refers to a value that can describe the characteristics of the historical load curve, such as peak value, valley value, average value, and the like. This embodiment is described by taking both the peak value and the valley value as the historical load characteristic value as an example. The training load characteristic value refers to the load characteristic value obtained after classifying the input training characteristic data.
然后基于预设的损失函数,根据训练负荷曲线和实际上输入的训练曲线数据对应的历史负荷数据之间的损失值,本实施例中的损失函数为计算峰值和谷值的均方根误差值的公式。然后根据损失值,采用随机梯度下降法对神经网络模型的参数进行优化,直至该神经网络模型收敛,得到负荷预测子模型。每一次迭代中,以上过程重复次,N为历史负荷数据的数量。本实施例中的收敛规则为损失值小于训练目标最小误差ε=1e-5。Then, based on the preset loss function, according to the loss value between the training load curve and the historical load data corresponding to the actually input training curve data, the loss function in this embodiment is to calculate the root mean square error value of the peak value and the valley value. formula. Then according to the loss value, the stochastic gradient descent method is used to optimize the parameters of the neural network model until the neural network model converges, and the load forecasting sub-model is obtained. In each iteration, the above process is repeated times, N is the number of historical load data. The convergence rule in this embodiment is that the loss value is smaller than the training target minimum error ε=1e-5.
进一步地,在本实施例得到预测用电负荷的第二种实现方式中,所述预测用电负荷包括每个负荷预测子模型对应的预估用电负荷,得到预估用电负荷的过程为:Further, in the second implementation manner of obtaining the predicted power consumption load in this embodiment, the predicted power consumption load includes the estimated power consumption load corresponding to each load prediction sub-model, and the process of obtaining the estimated power consumption load is as follows: :
针对每一个所述负荷预测子模型,将所述预测特征数据输入该负荷预测子模型,得到所述预测特征数据对应的预测负荷特征值;For each of the load prediction sub-models, input the predicted characteristic data into the load prediction sub-model to obtain the predicted load characteristic value corresponding to the predicted characteristic data;
根据该负荷预测子模型对应的用电模式集合和所述预测负荷特征值,计算该负荷预测子模型对应的候选用电负荷曲线。According to the power consumption pattern set corresponding to the load forecasting sub-model and the predicted load characteristic value, a candidate power consumption load curve corresponding to the load forecasting sub-model is calculated.
具体地,针对每一个所述负荷预测子模型,例如用电模式A对应的负荷预测子模型,将预测特征数据输入该负荷预测子模型,该预测负荷子模型对预测特征数据进行用电负荷预测,得到所述预测特征数据对应的预测负荷特征值。在本实施例中即待预测时间对应的预测峰值和预测谷值。Specifically, for each of the load forecasting sub-models, such as the load forecasting sub-model corresponding to the electricity consumption mode A, the predicted characteristic data is input into the load forecasting sub-model, and the forecasted load sub-model performs electricity load forecasting on the predicted characteristic data. to obtain the predicted load characteristic value corresponding to the predicted characteristic data. In this embodiment, it is the predicted peak value and the predicted valley value corresponding to the time to be predicted.
由于该负荷预测子模型对应的用电模式集合中的历史用电负荷之间是存在相同的用电走向和用电趋向,因此根据该用电模式集合和已得到的预测峰值和预测谷值,可计算该负荷预测子模型对应的候选用电负荷曲线。得到每一个所述负荷预测子模型对应的候选用电负荷曲线,从而得到了初始用电负荷曲线。Since the historical electricity consumption trends in the electricity consumption pattern set corresponding to the load forecasting sub-model have the same electricity consumption trend and electricity consumption trend, according to the electricity consumption pattern set and the obtained predicted peak value and predicted valley value, The candidate power consumption load curve corresponding to the load prediction sub-model can be calculated. A candidate power consumption load curve corresponding to each of the load prediction sub-models is obtained, thereby obtaining an initial power consumption load curve.
进一步地,在本实施例中,计算该负荷预测子模型对应的候选用电负荷曲线中的公式为其中,j=1,2,...,c*,peakj表示第j个负荷预测子模型所得到的预测峰值,valleyj表示第j个负荷预测子模型所得到的预测谷值。Further, in this embodiment, the formula for calculating the candidate electricity load curve corresponding to the load prediction sub-model is: Among them, j=1,2,...,c*, peak j represents the predicted peak value obtained by the jth load forecasting sub-model, and valley j represents the predicted valley value obtained by the jth load forecasting sub-model.
步骤S400,根据所述预测用电模式和所述初始用电负荷曲线预测用电负荷,确定所述待预测时间对应的预测用电负荷曲线。Step S400, predicting the power consumption load according to the predicted power consumption mode and the initial power consumption load curve, and determining the predicted power consumption load curve corresponding to the to-be-predicted time.
具体地,在本实施例中,得到了预测用电模式和初始用电负荷曲线后,根据预测用电模式对初始用电负荷曲线进行调整,使用电负荷曲线的整体走向和趋势与预测用电模式中的历史负荷数据更为接近,从而得到待预测时间对应的预测用电负荷曲线。Specifically, in this embodiment, after the predicted power consumption pattern and the initial power consumption load curve are obtained, the initial power consumption load curve is adjusted according to the predicted power consumption mode, and the overall trend and trend of the power load curve is used to predict the power consumption. The historical load data in the model is closer, so that the predicted electricity load curve corresponding to the time to be predicted can be obtained.
进一步地,在本实施例中,所述预测用电模式包括每一个所述分类决策树对所述预测特征数据分类得到的该待预测时间对应的预估用电模式。先根据所有的所述预估用电模式,计算各个用电模式对应的模式占比值。例如待预测时间所对应的预测用电模式L为L={l1,l2,...,ln_trees},其中ln_trees为第n个分类决策树对应的预估用电模式。统计预测用电模式中各个用电模式对应的模式占比值其中nj为第j个用电模式对应的模式占比值。在本实施例中,总共得到200个分类决策树的预估用电模式,5种用电模式对应的模式占比值分别为:0.3195,0.0589,0.4729,0.0076和0.1411。Further, in this embodiment, the predicted power consumption mode includes an estimated power consumption mode corresponding to the to-be-predicted time obtained by classifying the predicted feature data by each of the classification decision trees. First, according to all the estimated power consumption modes, the mode ratio value corresponding to each power consumption mode is calculated. For example, the predicted power consumption mode L corresponding to the time to be predicted is L={l 1 , l 2 , . . . , l n_trees }, where l n_trees is the predicted power consumption mode corresponding to the nth classification decision tree. Statistically predicting the mode ratio of each power consumption mode in the power consumption mode in n j is the mode ratio value corresponding to the jth power consumption mode. In this embodiment, a total of 200 estimated power consumption modes of the classification decision tree are obtained, and the mode ratio values corresponding to the five power consumption modes are: 0.3195, 0.0589, 0.4729, 0.0076, and 0.1411, respectively.
针对每一个所述用电模式,根据该用电模式对应的模式占比值,对该用电模式对应的候选用电负荷曲线进行加权求和,得到该待预测时间对应的候选用电负荷曲线,计算公式为 For each of the power consumption modes, according to the mode ratio value corresponding to the power consumption mode, the candidate power consumption load curve corresponding to the power consumption mode is weighted and summed to obtain the candidate power consumption load curve corresponding to the to-be-predicted time, The calculation formula is
本实施例以211天待预测时间为例,计算了预测得到的用电负荷曲线和真实的用电负荷曲线之间的平均绝对百分误差(Mean Absolute Percentage Error,MAPE),211天待预测时间对应的MAPE的平均值为3.1%。This embodiment takes 211 days to be forecasted as an example, and calculates the mean absolute percentage error (Mean Absolute Percentage Error, MAPE) between the predicted power consumption curve and the real power consumption curve. The 211 days to be forecasted The mean value of the corresponding MAPE is 3.1%.
进一步地,如图2所述,基于上述电力负荷预测方法,本发明还相应提供了一种智能终端,所述智能终端包括处理器10、存储器20及显示器30。图2仅示出了智能终端的部分组件,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。Further, as shown in FIG. 2 , based on the above-mentioned power load prediction method, the present invention also provides an intelligent terminal correspondingly, and the intelligent terminal includes a
所述存储器20在一些实施例中可以是所述智能终端的内部存储单元,例如智能终端的硬盘或内存。所述存储器20在另一些实施例中也可以是所述智能终端的外部存储设备,例如所述智能终端上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器20还可以既包括所述智能终端的内部存储单元也包括外部存储设备。所述存储器20用于存储安装于所述智能终端的应用软件及各类数据,例如所述安装智能终端的程序代码等。所述存储器20还可以用于暂时地存储已经输出或者将要输出的数据。在一实施例中,存储器20上存储有电力负荷预测程序40,该电力负荷预测程序40可被处理器10所执行,从而实现本申请中电力负荷预测方法。In some embodiments, the
所述处理器10在一些实施例中可以是一中央处理器(Central Processing Unit,CPU),微处理器或其他数据处理芯片,用于运行所述存储器20中存储的程序代码或处理数据,例如执行所述电力负荷预测方法等。In some embodiments, the
所述显示器30在一些实施例中可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。所述显示器30用于显示在所述智能终端的信息以及用于显示可视化的用户界面。所述智能终端的部件10-30通过系统总线相互通信。In some embodiments, the
在一实施例中,当处理器10执行所述存储器20中电力负荷预测程序40时实现以下步骤:In one embodiment, when the
获取待预测时间对应的预测特征数据,其中,所述预测特征数据包括气象数据和时间类型;Obtaining prediction feature data corresponding to the time to be predicted, wherein the prediction feature data includes meteorological data and time type;
将所述预测特征数据输入已训练的分类模型并通过所述分类模型对所述待预测时间进行用电模式分类,得到所述待预测时间对应的预测用电模式;Inputting the predicted feature data into a trained classification model and classifying the electricity consumption pattern of the time to be predicted by the classification model, to obtain a predicted electricity consumption pattern corresponding to the time to be predicted;
将所述预测特征数据输入已训练的负荷预测模型并通过所述负荷预测模型对所述待预测时间进行用电负荷预测,得到所述待预测时间对应的初始用电负荷曲线预测用电负荷;Inputting the prediction feature data into a trained load prediction model and predicting the electricity load for the to-be-predicted time by using the load prediction model, to obtain an initial electricity-use load curve corresponding to the to-be-predicted time to predict the electricity load;
根据所述预测用电模式和所述初始用电负荷曲线预测用电负荷,确定所述待预测时间对应的预测用电负荷曲线。The power consumption load is predicted according to the predicted power consumption mode and the initial power consumption load curve, and the predicted power consumption load curve corresponding to the to-be-predicted time is determined.
本发明还提供一种计算机可读存储介质,其中,所述计算机可读存储介质存储有电力负荷预测程序,所述电力负荷预测程序被处理器执行时实现如上所述的电力负荷预测方法的步骤。The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a power load forecasting program, and when the power load forecasting program is executed by a processor, implements the steps of the above-mentioned power load forecasting method .
当然,本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关硬件(如处理器,控制器等)来完成,所述的程序可存储于一计算机可读取的计算机可读存储介质中,所述程序在执行时可包括如上述各方法实施例的流程。其中所述的计算机可读存储介质可为存储器、磁碟、光盘等。Of course, those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware (such as processors, controllers, etc.) through a computer program, and the programs can be stored in a In a computer-readable computer-readable storage medium, the program, when executed, may include the processes of the foregoing method embodiments. The computer-readable storage medium may be a memory, a magnetic disk, an optical disk, or the like.
应当理解的是,本发明的应用不限于上述的举例,对本领域普通技术人员来说,可以根据上述说明加以改进或变换,所有这些改进和变换都应属于本发明所附权利要求的保护范围。It should be understood that the application of the present invention is not limited to the above examples. For those of ordinary skill in the art, improvements or transformations can be made according to the above descriptions, and all these improvements and transformations should belong to the protection scope of the appended claims of the present invention.
Claims (7)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110102621.0A CN112734135B (en) | 2021-01-26 | 2021-01-26 | A power load forecasting method, intelligent terminal and computer-readable storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110102621.0A CN112734135B (en) | 2021-01-26 | 2021-01-26 | A power load forecasting method, intelligent terminal and computer-readable storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN112734135A CN112734135A (en) | 2021-04-30 |
| CN112734135B true CN112734135B (en) | 2022-07-15 |
Family
ID=75594025
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202110102621.0A Active CN112734135B (en) | 2021-01-26 | 2021-01-26 | A power load forecasting method, intelligent terminal and computer-readable storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN112734135B (en) |
Families Citing this family (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113516295B (en) * | 2021-05-25 | 2023-01-20 | 广东电网有限责任公司广州供电局 | Space load prediction method and system for rapid power restoration after disaster |
| CN113673587B (en) * | 2021-08-12 | 2024-02-02 | 国网湖北省电力有限公司电力科学研究院 | A method for calculating basic household daily electricity consumption |
| CN113819581B (en) * | 2021-08-23 | 2022-11-18 | 广西电网有限责任公司电力科学研究院 | Summer air conditioner load capacity and air temperature sensitivity analysis method |
| CN113705929B (en) * | 2021-09-15 | 2024-05-07 | 中国南方电网有限责任公司 | Spring festival holiday load prediction method based on load characteristic curve and typical characteristic value fusion |
| CN113988369B (en) * | 2021-09-23 | 2025-04-11 | 上海三一重机股份有限公司 | Training method of prediction model and prediction method based on prediction model |
| CN114066068A (en) * | 2021-11-18 | 2022-02-18 | 广东电网有限责任公司广州供电局 | A short-term power load forecasting method, device, equipment and storage medium |
| CN115526420A (en) * | 2022-10-19 | 2022-12-27 | 宁波市电力设计院有限公司 | A power load forecasting method and system based on the correlation of external influencing factors |
| CN116485049B (en) * | 2023-06-25 | 2024-04-19 | 陕西银河电力仪表股份有限公司 | Electric energy metering error prediction and optimization system based on artificial intelligence |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107145976A (en) * | 2017-04-28 | 2017-09-08 | 北京科技大学 | A Method of Forecasting Consumer Electricity Load |
| CN110071502A (en) * | 2019-04-24 | 2019-07-30 | 广东工业大学 | A kind of calculation method of short-term electric load prediction |
| CN111028100A (en) * | 2019-11-29 | 2020-04-17 | 南方电网能源发展研究院有限责任公司 | Refined short-term load prediction method, device and medium considering meteorological factors |
| CN111832796A (en) * | 2020-02-29 | 2020-10-27 | 上海电力大学 | A fine classification and prediction method and system for residential electricity load mode |
| CN112215426A (en) * | 2020-10-16 | 2021-01-12 | 国网山东省电力公司信息通信公司 | A Short-Term Electricity Load Prediction Method |
Family Cites Families (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104881706B (en) * | 2014-12-31 | 2018-05-25 | 天津弘源慧能科技有限公司 | A kind of power-system short-term load forecasting method based on big data technology |
| CN105989420B (en) * | 2015-02-12 | 2020-07-17 | 西门子公司 | Method for determining electricity utilization behavior characteristics of user, and method and device for predicting electricity utilization load of user |
| GB2543281A (en) * | 2015-10-13 | 2017-04-19 | British Gas Trading Ltd | System for energy consumption prediction |
| CN105512768A (en) * | 2015-12-14 | 2016-04-20 | 上海交通大学 | User electricity consumption relevant factor identification and electricity consumption quantity prediction method under environment of big data |
| CN108846517B (en) * | 2018-06-12 | 2021-03-16 | 清华大学 | Integration method for predicating quantile probabilistic short-term power load |
| US11315044B2 (en) * | 2018-11-08 | 2022-04-26 | Vmware, Inc. | Multi dimensional scale analysis using machine learning |
-
2021
- 2021-01-26 CN CN202110102621.0A patent/CN112734135B/en active Active
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107145976A (en) * | 2017-04-28 | 2017-09-08 | 北京科技大学 | A Method of Forecasting Consumer Electricity Load |
| CN110071502A (en) * | 2019-04-24 | 2019-07-30 | 广东工业大学 | A kind of calculation method of short-term electric load prediction |
| CN111028100A (en) * | 2019-11-29 | 2020-04-17 | 南方电网能源发展研究院有限责任公司 | Refined short-term load prediction method, device and medium considering meteorological factors |
| CN111832796A (en) * | 2020-02-29 | 2020-10-27 | 上海电力大学 | A fine classification and prediction method and system for residential electricity load mode |
| CN112215426A (en) * | 2020-10-16 | 2021-01-12 | 国网山东省电力公司信息通信公司 | A Short-Term Electricity Load Prediction Method |
Non-Patent Citations (2)
| Title |
|---|
| 基于小波回归分析法的短期负荷预测模型研究;闫冬梅等;《长春师范学院学报(自然科学版)》;20100420;第29卷(第04期);第20-24页 * |
| 基于聚类分析与随机森林的短期负荷滚动预测;荀港益;《智能城市》;20180514;第4卷(第09期);第9-11页 * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN112734135A (en) | 2021-04-30 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN112734135B (en) | A power load forecasting method, intelligent terminal and computer-readable storage medium | |
| CN118411003B (en) | Load control method, system, device and storage medium for multi-class power device | |
| CN114862032B (en) | XGBoost-LSTM-based power grid load prediction method and device | |
| Candelieri et al. | Identifying typical urban water demand patterns for a reliable short-term forecasting–the icewater project approach | |
| CN110163429B (en) | A Short-Term Load Forecasting Method Based on Optimal Screening of Similar Days | |
| CN118472946B (en) | Smart grid AI joint peak load decision-making method, system, equipment and medium | |
| CN106502799A (en) | A kind of host load prediction method based on long memory network in short-term | |
| CN111985701A (en) | A power consumption prediction method based on the big data model library of power supply enterprises | |
| CN116186548B (en) | Power load prediction model training method and power load prediction method | |
| CN115392546B (en) | Cooling power forecasting and demand-side management method and device based on meteorological factors | |
| CN112288157A (en) | A wind farm power prediction method based on fuzzy clustering and deep reinforcement learning | |
| CN112330044A (en) | Support vector regression model based on iterative aggregation grid search algorithm | |
| Wang et al. | A power load forecasting model based on FA‐CSSA‐ELM | |
| CN116169670A (en) | A short-term non-resident load forecasting method and system based on improved neural network | |
| CN117494947A (en) | Residential electricity consumption prediction methods, devices, equipment and media based on machine learning | |
| Zahin et al. | A comparative analysis of power demand forecasting with artificial intelligence and traditional approach | |
| CN116796895A (en) | Holiday short-term load prediction method and system | |
| Zhai et al. | Combining PSO-SVR and Random Forest Based Feature Selection for Day-ahead Peak Load Forecasting. | |
| CN120728593A (en) | Power load forecasting method based on dynamic correlation of industrial user groups | |
| CN112365280B (en) | Electric power demand prediction method and device | |
| Alıoghlı et al. | IoT-Based Energy Consumption Prediction Using Transformers | |
| Li et al. | A comprehensive learning-based model for power load forecasting in smart grid | |
| Ji et al. | Online refinement of day‐ahead forecasting using intraday data for campus‐level load | |
| Manojlović et al. | Cumulant Learning: Highly Accurate and Computationally Efficient Load Pattern Recognition Method for Probabilistic STLF at the LV Level | |
| CN114548510A (en) | Power load prediction method and system based on hybrid attention mechanism |
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 | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |