CN117541291A - An electricity price prediction method and system based on EMD decomposition and SSA-SVM model - Google Patents
An electricity price prediction method and system based on EMD decomposition and SSA-SVM model Download PDFInfo
- Publication number
- CN117541291A CN117541291A CN202311563567.5A CN202311563567A CN117541291A CN 117541291 A CN117541291 A CN 117541291A CN 202311563567 A CN202311563567 A CN 202311563567A CN 117541291 A CN117541291 A CN 117541291A
- Authority
- CN
- China
- Prior art keywords
- electricity price
- ssa
- prediction
- svm model
- sparrow
- 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.)
- Withdrawn
Links
- 230000005611 electricity Effects 0.000 title claims abstract description 162
- 238000000354 decomposition reaction Methods 0.000 title claims abstract description 62
- 238000000034 method Methods 0.000 title claims abstract description 47
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 24
- 238000005457 optimization Methods 0.000 claims abstract description 22
- 241000287127 Passeridae Species 0.000 claims description 70
- 230000006870 function Effects 0.000 claims description 39
- 238000010845 search algorithm Methods 0.000 claims description 21
- 238000012549 training Methods 0.000 claims description 19
- 238000004364 calculation method Methods 0.000 claims description 16
- 238000004590 computer program Methods 0.000 claims description 10
- 230000008569 process Effects 0.000 claims description 9
- 239000011159 matrix material Substances 0.000 claims description 6
- 238000012360 testing method Methods 0.000 claims description 6
- 230000002431 foraging effect Effects 0.000 claims description 5
- 230000014509 gene expression Effects 0.000 claims description 5
- 238000012417 linear regression Methods 0.000 claims description 4
- 230000009977 dual effect Effects 0.000 claims description 3
- 238000011156 evaluation Methods 0.000 claims description 3
- 238000013507 mapping Methods 0.000 claims description 3
- 244000062645 predators Species 0.000 claims description 3
- 238000010276 construction Methods 0.000 claims description 2
- 230000008901 benefit Effects 0.000 abstract description 8
- 238000004458 analytical method Methods 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 238000012706 support-vector machine Methods 0.000 description 4
- 230000006399 behavior Effects 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 3
- 238000012731 temporal analysis Methods 0.000 description 3
- 238000000700 time series analysis Methods 0.000 description 3
- 238000013528 artificial neural network Methods 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 239000003245 coal Substances 0.000 description 2
- 239000000284 extract Substances 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 101001121408 Homo sapiens L-amino-acid oxidase Proteins 0.000 description 1
- 102100026388 L-amino-acid oxidase Human genes 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 238000007405 data analysis Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000019637 foraging behavior Effects 0.000 description 1
- 230000002068 genetic effect Effects 0.000 description 1
- 238000012804 iterative process Methods 0.000 description 1
- 238000007477 logistic regression Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- YHXISWVBGDMDLQ-UHFFFAOYSA-N moclobemide Chemical compound C1=CC(Cl)=CC=C1C(=O)NCCN1CCOCC1 YHXISWVBGDMDLQ-UHFFFAOYSA-N 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000002245 particle Substances 0.000 description 1
- ZRHANBBTXQZFSP-UHFFFAOYSA-M potassium;4-amino-3,5,6-trichloropyridine-2-carboxylate Chemical group [K+].NC1=C(Cl)C(Cl)=NC(C([O-])=O)=C1Cl ZRHANBBTXQZFSP-UHFFFAOYSA-M 0.000 description 1
- 230000000717 retained effect Effects 0.000 description 1
- 230000035945 sensitivity Effects 0.000 description 1
- 238000004088 simulation Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 230000005612 types of electricity Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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
- G06Q30/00—Commerce
- G06Q30/02—Marketing; Price estimation or determination; Fundraising
- G06Q30/0201—Market modelling; Market analysis; Collecting market data
- G06Q30/0206—Price or cost determination based on market factors
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F17/00—Digital computing or data processing equipment or methods, specially adapted for specific functions
- G06F17/10—Complex mathematical operations
- G06F17/14—Fourier, Walsh or analogous domain transformations, e.g. Laplace, Hilbert, Karhunen-Loeve, transforms
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N20/00—Machine learning
- G06N20/10—Machine learning using kernel methods, e.g. support vector machines [SVM]
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Business, Economics & Management (AREA)
- Mathematical Physics (AREA)
- Data Mining & Analysis (AREA)
- Strategic Management (AREA)
- Development Economics (AREA)
- Software Systems (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- Entrepreneurship & Innovation (AREA)
- Pure & Applied Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Computational Mathematics (AREA)
- Mathematical Analysis (AREA)
- Mathematical Optimization (AREA)
- Databases & Information Systems (AREA)
- Marketing (AREA)
- Algebra (AREA)
- Game Theory and Decision Science (AREA)
- Economics (AREA)
- General Business, Economics & Management (AREA)
- Artificial Intelligence (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Evolutionary Computation (AREA)
- Medical Informatics (AREA)
- Computing Systems (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
本发明公开了一种基于EMD分解和SSA‑SVM模型的电价预测方法及系统,涉及电价预测技术领域,包括获取原始电价数据,对电价数据通过EMD算法进行分解;构建SSA‑SVM模型,应用SSA优化SVM模型中的关键参数,进行预测,得到每个特征信号下的预测值;将预测值累加重构获得最终预测结果。本发明能够有效处理非线性和非平稳性,提高电价预测准确性,更好地适应电价数据的真实特征。更能应对电价数据中的异常值和波动,通过参数优化提高模型的性能,更好地拟合电价数据的特性。能够更好地预测未来电价趋势和波动,提高能源资源的利用效率,实现更好的经济效益。
The invention discloses an electricity price prediction method and system based on EMD decomposition and SSA-SVM model. It relates to the technical field of electricity price prediction and includes obtaining original electricity price data, decomposing the electricity price data through the EMD algorithm; constructing an SSA-SVM model, and applying SSA Optimize the key parameters in the SVM model, perform predictions, and obtain the predicted value under each characteristic signal; accumulate and reconstruct the predicted values to obtain the final prediction result. The invention can effectively handle nonlinearity and non-stationarity, improve the accuracy of electricity price prediction, and better adapt to the real characteristics of electricity price data. It can better deal with outliers and fluctuations in electricity price data, improve the performance of the model through parameter optimization, and better fit the characteristics of electricity price data. It can better predict future electricity price trends and fluctuations, improve the utilization efficiency of energy resources, and achieve better economic benefits.
Description
技术领域Technical Field
本发明涉及电价预测技术领域,特别是一种基于EMD分解和SSA-SVM模型的电价预测方法及系统。The invention relates to the technical field of electricity price prediction, in particular to an electricity price prediction method and system based on EMD decomposition and SSA-SVM model.
背景技术Background Art
基于人工智能和数据分析技术,目前已经建立了许多电价预测模型。鉴于单一模型往往具有一定的局限性和精度误差,结合不同算法的特点,构建混合电价预测模型成为研究热点。Based on artificial intelligence and data analysis technology, many electricity price prediction models have been established. Given that a single model often has certain limitations and precision errors, combining the characteristics of different algorithms to build a hybrid electricity price prediction model has become a research hotspot.
常见的混合预测方法有遗传算法优化的BP神经网络(GA-BP)、小波变换分解的ARIMA(WT-ARIMA)、粒子群算法优化的LS-SVM(PSO-LSSVM)、小波包分解的LSTM网络(WPD-LSTM)、混合贝叶斯支持向量机方法(BE-SVM)等。Common hybrid prediction methods include BP neural network optimized by genetic algorithm (GA-BP), ARIMA decomposed by wavelet transform (WT-ARIMA), LS-SVM optimized by particle swarm algorithm (PSO-LSSVM), LSTM network decomposed by wavelet packet (WPD-LSTM), hybrid Bayesian support vector machine method (BE-SVM), etc.
上述混合模型在处理非平稳,非线性时间序列变化复杂的电价数据时还存在不足之处:GA-BP缺乏泛化能力,而且可能陷入局部最优,导致预测性能不佳;WT-ARIMA非线性和非平稳性处理特性处理不足,较高的计算复杂度使其预测能力可能受到限制;PSO-LSSVM虽然可以在一定程度上处理非线性问题,但对于高度非线性的电价数据,LS-SVM仍可能无法完全捕捉到其内在规律,从而影响预测性能;BE-SVM方法的性能在很大程度上取决于参数的选择,参数调优困难,而且对噪声敏感,虽然SVM具有较强的鲁棒性,但在电价预测中,如果噪声较大或存在离群值,可能会影响BE-SVM的预测性能。The above hybrid models still have shortcomings when dealing with non-stationary, nonlinear time series and complex electricity price data: GA-BP lacks generalization ability and may fall into local optimality, resulting in poor prediction performance; WT-ARIMA does not adequately handle nonlinear and non-stationary processing characteristics, and its high computational complexity may limit its prediction ability; although PSO-LSSVM can handle nonlinear problems to a certain extent, for highly nonlinear electricity price data, LS-SVM may still not be able to fully capture its inherent laws, thus affecting the prediction performance; the performance of the BE-SVM method depends to a large extent on the selection of parameters, which is difficult to tune and sensitive to noise. Although SVM has strong robustness, in electricity price forecasting, if the noise is large or there are outliers, it may affect the prediction performance of BE-SVM.
发明内容Summary of the invention
鉴于现有的基于EMD分解和SSA-SVM模型的电价预测方法存在的问题,提出了本发明。利用EMD对非线性和非平稳数据处理的优势,充分挖掘电价序列隐含信息,并结合SSA适应性强及SVM泛化性能好的特点,提高电价预测的精度。因此,本发明所要解决的问题在于如何提供一种基于EMD分解和SSA-SVM模型的电价预测方法及系统。In view of the problems existing in the existing electricity price prediction methods based on EMD decomposition and SSA-SVM models, the present invention is proposed. By utilizing the advantages of EMD in processing nonlinear and non-stationary data, the implicit information of the electricity price series is fully mined, and the accuracy of electricity price prediction is improved by combining the strong adaptability of SSA and the good generalization performance of SVM. Therefore, the problem to be solved by the present invention is how to provide an electricity price prediction method and system based on EMD decomposition and SSA-SVM models.
为解决上述技术问题,本发明提供如下技术方案:In order to solve the above technical problems, the present invention provides the following technical solutions:
第一方面,本发明实施例提供了一种基于EMD分解和SSA-SVM模型的电价预测方法,其包括,获取原始电价数据,将原始电价数据划分为训练集和测试集,对电价数据通过经验模态分解算法EMD进行分解;构建SSA-SVM模型,应用麻雀搜索算法SSA优化SVM模型中的关键参数,将分解后的电价数据输入模型进行预测,得到每个特征信号下的预测值;将模型输出的预测值累加重构获得最终预测结果,进行基于EMD分解和SSA-SVM模型的电价预测。In the first aspect, an embodiment of the present invention provides an electricity price prediction method based on EMD decomposition and SSA-SVM model, which includes obtaining original electricity price data, dividing the original electricity price data into a training set and a test set, and decomposing the electricity price data through an empirical mode decomposition algorithm EMD; constructing an SSA-SVM model, applying a sparrow search algorithm SSA to optimize key parameters in the SVM model, inputting the decomposed electricity price data into the model for prediction, and obtaining a predicted value under each characteristic signal; accumulating and reconstructing the predicted values output by the model to obtain a final prediction result, and performing electricity price prediction based on EMD decomposition and SSA-SVM model.
作为本发明所述基于EMD分解和SSA-SVM模型的电价预测方法的一种优选方案,其中:所述通过经验模态分解算法EMD进行分解具体包括,确定原始电价数据信号X(t)上所有的极大值和极小值点,使用三次样条插值构建信号的上包络线xmax(t)和下包络线xmin(t);计算出包络均值相关计算公式如下:As a preferred solution of the electricity price prediction method based on EMD decomposition and SSA-SVM model described in the present invention, the decomposition by the empirical mode decomposition algorithm EMD specifically includes determining all the maximum and minimum points on the original electricity price data signal X(t), using cubic spline interpolation to construct the upper envelope x max (t) and lower envelope x min (t) of the signal; calculating the envelope mean The relevant calculation formula is as follows:
根据原始信号和包络均值求原始信号的中间条件函数h1(t),相关计算公式如下:The intermediate condition function h 1 (t) of the original signal is calculated based on the original signal and the envelope mean. The relevant calculation formula is as follows:
若h1(t)满足IMF条件,则得到IMF的第一个特征分量;若h1(t)不满足IMF条件,则重复上述计算,直至满足IMF条件,得到IMF分量,相关公式如下:If h 1 (t) satisfies the IMF condition, the first characteristic component of IMF is obtained; if h 1 (t) does not meet the IMF condition, the above calculation is repeated until the IMF condition is met and the IMF component is obtained. The relevant formula is as follows:
IMF1(t)=h1(t)IMF 1 (t) = h 1 (t)
将IMF1(t)从信号中剥离得到残余分量r1(t),相关计算公式如下:The IMF 1 (t) is stripped from the signal to obtain the residual component r 1 (t). The relevant calculation formula is as follows:
r1(t)=x(t)-IMF1(t)r 1 (t) = x (t) - IMF 1 (t)
以r1(t)为待处理信号,相关计算公式如下:Taking r 1 (t) as the signal to be processed, the relevant calculation formula is as follows:
x(t)=r1(t)x(t)= r1 (t)
直到不能再分解,则得到最终分解结果,相关计算公式如下:Until it can no longer be decomposed, the final decomposition result is obtained. The relevant calculation formula is as follows:
式中,x(t)为原始电价数据信号,rn(t)为残差分量,即最终分解完成后的待处理信号。In the formula, x(t) is the original electricity price data signal, and r n (t) is the residual component, that is, the signal to be processed after the final decomposition is completed.
作为本发明所述基于EMD分解和SSA-SVM模型的电价预测方法的一种优选方案,其中:所述构建SSA-SVM模型具体包括,构建SVM模型,选择模型的核函数,确定核函数中需要选取的关键参数;对麻雀搜索算法SSA进行优化,使用优化后的麻雀搜索算法确定核函数中的关键参数;将经过EMD分解后的待处理信号输入麻雀搜索算法中得出预测参数结果,将得到的预测参数结果代入到SVM模型中进行训练,模型训练完成后,将得到的各待处理信号输入模型进行预测。As a preferred solution of the electricity price prediction method based on EMD decomposition and SSA-SVM model described in the present invention, wherein: the construction of the SSA-SVM model specifically includes: constructing an SVM model, selecting the kernel function of the model, and determining the key parameters that need to be selected in the kernel function; optimizing the sparrow search algorithm SSA, and using the optimized sparrow search algorithm to determine the key parameters in the kernel function; inputting the signal to be processed after EMD decomposition into the sparrow search algorithm to obtain the prediction parameter result, substituting the obtained prediction parameter result into the SVM model for training, and after the model training is completed, inputting each signal to be processed into the model for prediction.
作为本发明所述基于EMD分解和SSA-SVM模型的电价预测方法的一种优选方案,其中:所述SVM模型具体包括,加入拉格朗日函数,根据最优条件,得到原始优化问题的对偶形式,相关表达式如下:As a preferred solution of the electricity price prediction method based on EMD decomposition and SSA-SVM model described in the present invention, the SVM model specifically includes adding a Lagrangian function and obtaining the dual form of the original optimization problem according to the optimal conditions. The relevant expressions are as follows:
约束条件为:The constraints are:
式中,xi为输入向量,yi为输出向量,l为训练样本,ε为不敏感损失函数,C为惩罚参数,αi为拉格朗日乘子且αi≥0;设定非线性映射值φ将训练样本与高维空间进行映射并进行线性回归,引入核函数K(x,y)实现非线性回归,其优化方程转化为:Where xi is the input vector, yi is the output vector, l is the training sample, ε is the insensitive loss function, C is the penalty parameter, αi is the Lagrange multiplier and αi ≥ 0; the nonlinear mapping value φ is set to map the training sample to the high-dimensional space and perform linear regression, and the kernel function K(x,y) is introduced to realize nonlinear regression, and its optimization equation is transformed into:
K(x,xi)=exp(-||x-xi||2/2g2)K(x,x i )=exp(-||xx i || 2 /2g 2 )
式中,xi为输入向量,g为预测参数。Where xi is the input vector and g is the prediction parameter.
作为本发明所述基于EMD分解和SSA-SVM模型的电价预测方法的一种优选方案,其中:所述关键参数包括核函数中的预测参数g和惩罚参数C,使用优化后的麻雀搜索算法确定核函数中的关键参数,具体包括,将原始电价数据序列分解得到的子序列,本征模态IMF和残差分量作为预测的输入;将各子序列进行归一化处理,相关计算公式如下:As a preferred solution of the electricity price prediction method based on EMD decomposition and SSA-SVM model described in the present invention, the key parameters include the prediction parameter g and the penalty parameter C in the kernel function, and the key parameters in the kernel function are determined using the optimized sparrow search algorithm, specifically including: decomposing the original electricity price data sequence to obtain subsequences, intrinsic mode IMF and residual components as prediction inputs; normalizing each subsequence, and the relevant calculation formula is as follows:
式中,x′i为子序列第i点的归一化结果,xi为子序列第i点的电价,xmax和xmin为子序列中电价的最大值和最小值;确定优化参数个数为2,迭代次数,初始化麻雀种群位置向量,设置麻雀种群数量,发现者和预警者比例,以及预警阈值;计算每个麻雀个体的适应度,得出高适应度值的当前麻雀最佳位置;判断是否满足位置更新条件,若满足,则进行位置更新;若不满足,则保留当前位置;判断是否满足停止搜索条件,如满足,则停止寻优,得到最优解。Wherein, x′ i is the normalized result of the i-th point of the subsequence, xi is the electricity price of the i-th point of the subsequence, and x max and x min are the maximum and minimum electricity prices in the subsequence; the number of optimization parameters is determined to be 2, the number of iterations, the position vector of the sparrow population is initialized, the number of sparrow populations, the ratio of discoverers to warners, and the warning threshold are set; the fitness of each individual sparrow is calculated to obtain the current optimal position of the sparrow with a high fitness value; whether the position update condition is met, if so, the position is updated; if not, the current position is retained; whether the stop search condition is met, if so, the optimization is stopped to obtain the optimal solution.
作为本发明所述基于EMD分解和SSA-SVM模型的电价预测方法的一种优选方案,其中:所述优化后的麻雀搜索算法具体包括,初始化种群、迭代次数、发现者与追随者比例,相应表达式如下:As a preferred solution of the electricity price prediction method based on EMD decomposition and SSA-SVM model described in the present invention, the optimized sparrow search algorithm specifically includes initializing the population, the number of iterations, and the ratio of discoverers to followers. The corresponding expressions are as follows:
式中,n为麻雀种群的数量,d表示麻雀个体所附带的维度;计算麻雀个体适应度,相关表达式如下:In the formula, n is the number of sparrow populations, and d represents the dimension of individual sparrows. The fitness of individual sparrows is calculated as follows:
式中,FX为每一行麻雀个体的适应度值;有较强搜索能力即具备较好适应度值的发现者在搜索过程中会优先获取食物,作为探索者,可获得比追随者更大的觅食搜索范围;发现者在迭代过程中的位置更新如下:In the formula, F X is the fitness value of each row of sparrows; the discoverer with stronger search ability, that is, with better fitness value, will get food first during the search process. As an explorer, it can obtain a larger foraging search range than the follower; the position update of the discoverer during the iteration process is as follows:
式中,表示迭代t次第i只麻雀在j维时的位置,α表示(0,1]范围内的随机数,Tmax表示最大迭代次数,R2∈[0,1]表示预警值,ST∈[0,1]表示安全值,Q为服从正态分布的随机数,L1表示1×d列的矩阵,且所有元素均为1;当R2<ST时,则表示麻雀周围没有天敌,探索者进行全局搜索;若R2≥ST时,则表示部分麻雀已经发现捕食者,所有麻雀均采取相关行动,更新个体位置;更新追随者位置:In the formula, represents the position of the i-th sparrow in the j-dimension after iteration t, α represents a random number in the range of (0,1], T max represents the maximum number of iterations, R 2 ∈[0,1] represents the warning value, ST∈[0,1] represents the safety value, Q is a random number that obeys the normal distribution, L 1 represents a 1×d column matrix, and all elements are 1; when R 2 <ST, it means that there are no natural enemies around the sparrow, and the explorer conducts a global search; if R2 ≥ ST, it means that some sparrows have found the predator, and all sparrows take relevant actions to update their individual positions; update the follower position:
式中,表示在第(t+1)次迭代时生产者在j维时所占据的最佳位置,表示第t次迭代时整个种群中的最差位置;A表示每个元素随机分配1或-1的矩阵,且A+=AT(AAT)-1;当i>n/2时,则表明追随者处于十分饥饿的状态,利用一个标准正态分布随机数与以自然对数为底指数函数的积,控制其取值符合正态分布,即获取更多的能量;当i≤n/2时,则在当前最优位置附近随机找到一处位置;更新警戒者位置:In the formula, represents the best position occupied by the producer in the j-th dimension at the (t+1)th iteration, represents the worst position in the entire population at the tth iteration; A represents a matrix in which each element is randomly assigned 1 or -1, and A + = AT (AA T ) -1 ; when i>n/2, it indicates that the follower is in a very hungry state, and the product of a standard normal distribution random number and an exponential function with natural logarithm as the base is used to control its value to conform to the normal distribution, that is, to obtain more energy; when i≤n/2, a position is randomly found near the current optimal position; update the position of the vigilant:
式中,β代表服从均值为0,方差为1的正态分布的步长控制系数,K代表[-1,1]区间的随机数,fi代表当前麻雀个体的适应度值,fg代表当前全局最佳适应度值,fw代表当前全局最差适应度值,c为常数;当预警麻雀处于当前最优位置,则会逃离至自身附近的位置,若麻雀当前所处位置不是最优位置,则逃离到当前最优位置附近。In the formula, β represents the step size control coefficient of the normal distribution with a mean of 0 and a variance of 1, K represents a random number in the interval [-1,1], fi represents the fitness value of the current sparrow individual, fg represents the current global best fitness value, fw represents the current global worst fitness value, and c is a constant; when the warning sparrow is in the current optimal position, it will escape to a position near itself. If the sparrow's current position is not the optimal position, it will escape to the vicinity of the current optimal position.
作为本发明所述基于EMD分解和SSA-SVM模型的电价预测方法的一种优选方案,其中:所述预测结果包括对各子序列分别建模,重复得到各自的预测结果,将所有预测结果累加重构,得到最终的电价预测结果;在评估模型预测性能时,评价指标包括均方根误差、均方误差、偏差误差、决定系数、平均绝对百分比误差以及纳什系数。As a preferred solution of the electricity price prediction method based on EMD decomposition and SSA-SVM model described in the present invention, the prediction result includes modeling each subsequence separately, repeatedly obtaining their respective prediction results, accumulating and reconstructing all the prediction results to obtain the final electricity price prediction result; when evaluating the prediction performance of the model, the evaluation indicators include root mean square error, mean square error, deviation error, determination coefficient, mean absolute percentage error and Nash coefficient.
第二方面,本发明实施例提供了一种基于EMD分解和SSA-SVM模型的电价预测系统,其包括:获取模块,用于获取原始电价数据,将原始电价数据划分为训练集和测试集,对电价数据通过经验模态分解算法EMD进行分解;构建预测模块,构建SSA-SVM模型,应用麻雀搜索算法SSA优化SVM模型中的关键参数,将分解后的电价数据输入模型进行预测,得到每个特征信号下的预测值;输出模块,用于将模型输出的预测值累加重构获得最终预测结果,进行基于EMD分解和SSA-SVM模型的电价预测。In the second aspect, an embodiment of the present invention provides an electricity price prediction system based on EMD decomposition and SSA-SVM model, which includes: an acquisition module, used to obtain original electricity price data, divide the original electricity price data into a training set and a test set, and decompose the electricity price data through the empirical mode decomposition algorithm EMD; construct a prediction module, construct an SSA-SVM model, apply the sparrow search algorithm SSA to optimize the key parameters in the SVM model, input the decomposed electricity price data into the model for prediction, and obtain the predicted value under each characteristic signal; an output module, used to accumulate and reconstruct the predicted values output by the model to obtain the final prediction result, and perform electricity price prediction based on EMD decomposition and SSA-SVM model.
第三方面,本发明实施例提供了一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其中:所述处理器执行所述计算机程序时实现上述方法的任一步骤。In a third aspect, an embodiment of the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, wherein: the processor implements any step of the above method when executing the computer program.
第四方面,本发明实施例提供了一种计算机可读存储介质,其上存储有计算机程序,其中:所述计算机程序被处理器执行时实现上述方法的任一步骤。In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: the computer program implements any step of the above method when executed by a processor.
本发明有益效果为通过使用经验模态分解EMD对原始电价数据进行分解,能够有效处理非线性和非平稳性,从而提高电价预测的准确性。每个分解的子序列都可以根据其特定的频率成分进行建模,使模型更好地适应电价数据的真实特征。可以将高频噪音成分从电价数据中分离出来,从而减少噪音对预测的干扰。这有助于提高模型的鲁棒性,使其更能够应对电价数据中的异常值和波动。EMD分解允许分别处理不同频率成分,有助于提取电价数据中的重要信息。不同成分的分析可以揭示电价数据中的趋势、季节性和周期性,使模型更好地理解电价波动的原因。麻雀搜索算法SSA用于优化支持向量机SVM模型中的关键参数,通过参数优化,可以提高模型的性能,确保其更好地拟合电价数据的特性。SSA-SVM模型具有较高的灵活性,可以适应不同类型的电价数据。无论是市场价格、消费者用电价格还是其他电价数据类型,都可以通过参数调整来适应不同的情境。通过分解和累加预测结果,可以更好地理解不同频率成分在电价数据中的贡献。有助于时间序列分析,能够更好地预测未来电价趋势和波动。高精度的电价预测为能源市场参与者提供有力的支持,优化电力采购策略、合理规划用电需求和降低成本。通过提高电价预测的准确性,电力市场参与者可以更有效地管理成本,减少不必要的开支,提高能源资源的利用效率,实现更好的经济效益。The beneficial effect of the present invention is that by using empirical mode decomposition EMD to decompose the original electricity price data, nonlinearity and non-stationarity can be effectively handled, thereby improving the accuracy of electricity price prediction. Each decomposed subsequence can be modeled according to its specific frequency component, so that the model can better adapt to the real characteristics of electricity price data. High-frequency noise components can be separated from electricity price data, thereby reducing the interference of noise on prediction. This helps to improve the robustness of the model, making it more capable of dealing with outliers and fluctuations in electricity price data. EMD decomposition allows different frequency components to be processed separately, which helps to extract important information from electricity price data. Analysis of different components can reveal trends, seasonality and periodicity in electricity price data, so that the model can better understand the reasons for electricity price fluctuations. The sparrow search algorithm SSA is used to optimize the key parameters in the support vector machine SVM model. Through parameter optimization, the performance of the model can be improved to ensure that it better fits the characteristics of electricity price data. The SSA-SVM model has high flexibility and can adapt to different types of electricity price data. Whether it is market price, consumer electricity price or other electricity price data type, it can be adapted to different scenarios through parameter adjustment. By decomposing and accumulating the forecast results, we can better understand the contribution of different frequency components in the electricity price data. It is helpful for time series analysis and can better predict future electricity price trends and fluctuations. High-precision electricity price forecasts provide strong support for energy market participants to optimize electricity procurement strategies, rationally plan electricity demand and reduce costs. By improving the accuracy of electricity price forecasts, electricity market participants can manage costs more effectively, reduce unnecessary expenses, improve the utilization efficiency of energy resources, and achieve better economic benefits.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本发明实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。其中:In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
图1为基于EMD分解和SSA-SVM模型的电价预测方法的流程图。FIG1 is a flow chart of an electricity price prediction method based on EMD decomposition and SSA-SVM model.
图2为EMD分解流程图。Figure 2 is a flowchart of EMD decomposition.
图3为支持向量回归结构图。Figure 3 is a diagram of the support vector regression structure.
图4为麻雀优化算法流程图。Figure 4 is a flow chart of the sparrow optimization algorithm.
图5为历史电价数据图。Figure 5 is a graph of historical electricity price data.
图6为各算法批发电价预测对比图。Figure 6 is a comparison of wholesale electricity price predictions of various algorithms.
图7为各算法零售电价预测对比图。Figure 7 is a comparison chart of retail electricity price predictions of various algorithms.
图8各算法批发电价预测指标对比图。Fig. 8 Comparison of wholesale electricity price prediction indicators of various algorithms.
图9各算法零售电价预测指标对比图。Figure 9 Comparison of retail electricity price prediction indicators of various algorithms.
图10各算法批发电价预测误差箱形图。Fig. 10 Box plot of wholesale electricity price prediction error of each algorithm.
图11各算法零售电价预测误差箱形图。Fig. 11 Box plot of retail electricity price prediction error of each algorithm.
具体实施方式DETAILED DESCRIPTION
为使本发明的上述目的、特征和优点能够更加明显易懂,下面结合说明书附图对本发明的具体实施方式做详细的说明,显然所描述的实施例是本发明的一部分实施例,而不是全部实施例。基于本发明中的实施例,本领域普通人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明的保护的范围。In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
在下面的描述中阐述了很多具体细节以便于充分理解本发明,但是本发明还可以采用其他不同于在此描述的其它方式来实施,本领域技术人员可以在不违背本发明内涵的情况下做类似推广,因此本发明不受下面公开的具体实施例的限制。In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
其次,此处所称的“一个实施例”或“实施例”是指可包含于本发明至少一个实现方式中的特定特征、结构或特性。在本说明书中不同地方出现的“在一个实施例中”并非均指同一个实施例,也不是单独的或选择性的与其他实施例互相排斥的实施例。Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
实施例1Example 1
参照图1,为本发明第一个实施例,该实施例提供了一种基于EMD分解和SSA-SVM模型的电价预测方法,包括:Referring to FIG. 1 , which is a first embodiment of the present invention, the embodiment provides an electricity price prediction method based on EMD decomposition and SSA-SVM model, including:
S1:获取原始电价数据,将原始电价数据划分为训练集和测试集,对电价数据通过经验模态分解算法EMD进行分解;S1: Obtain the original electricity price data, divide the original electricity price data into a training set and a test set, and decompose the electricity price data using the empirical mode decomposition algorithm EMD;
具体的,对电价数据进行EMD分解,信号分解为若干数量的本征模态函数(IMF)和残余分量(Res);Specifically, the electricity price data is subjected to EMD decomposition, and the signal is decomposed into a number of intrinsic mode functions (IMFs) and residual components (Res);
经验模态分解(EMD)是一种分析和处理非线性、非平稳信号的强大工具,它可以将复杂的数据信号分解为一系列基本的、有物理含义的振荡特征分量,这些特征分量又被称为本征模态函数(Intrinsic Mode Functions,IMFs),每个IMF都是原始信号的一个构成部分,它们共同组成了原始信号的总体结构。每个IMF都有独一无二的频率特性,并且这些频率特性是随时间变化的。这使得EMD非常适合于处理在时间尺度上有显著变化的信号,如电力负荷信号和本发明涉及的电力价格信号等在科学研究和工程领域中的许多实际信号。Empirical Mode Decomposition (EMD) is a powerful tool for analyzing and processing nonlinear and non-stationary signals. It can decompose complex data signals into a series of basic, physically meaningful oscillating characteristic components, which are also called Intrinsic Mode Functions (IMFs). Each IMF is a component of the original signal, and together they constitute the overall structure of the original signal. Each IMF has a unique frequency characteristic, and these frequency characteristics change over time. This makes EMD very suitable for processing signals that change significantly on a time scale, such as power load signals and the power price signals involved in this invention, and many other practical signals in scientific research and engineering.
EMD的分解过程是一个迭代的过程,从原始信号中依次提取出频率最高的IMF,然后将其从原始信号中减去,得到一个新的残差信号。这个过程一直重复,直到残差信号无法再被分解,或者达到了预设的停止条件。最后,每个IMF以及残差信号都可以进一步使用Hilbert变换来获取其随时间变化的瞬时频率和瞬时幅度。这样,我们就可以提取出信号的主要特征,更深入地理解和分析原始信号的动态行为和内在结构。The decomposition process of EMD is an iterative process, which extracts the highest frequency IMF from the original signal in turn, and then subtracts it from the original signal to obtain a new residual signal. This process is repeated until the residual signal can no longer be decomposed or the preset stop condition is reached. Finally, each IMF and residual signal can be further transformed using Hilbert transform to obtain its instantaneous frequency and instantaneous amplitude over time. In this way, we can extract the main features of the signal and have a deeper understanding and analysis of the dynamic behavior and internal structure of the original signal.
本发明利用EMD对电价信号分解的实现方式如下:The present invention uses EMD to decompose the electricity price signal in the following way:
确定原始电价信号X(t)上所有的极大值和极小值点,并且使用三次样条插值的方法构建信号的上包络线xmax(t)和下包络线xmin(t)。All the maximum and minimum points on the original electricity price signal X(t) are determined, and the upper envelope x max (t) and lower envelope x min (t) of the signal are constructed using the cubic spline interpolation method.
根据上下包络线可以计算出包络均值 The envelope mean can be calculated based on the upper and lower envelope lines
根据原始信号和包络均值求原始信号的中间条件函数h1(t):The intermediate condition function h 1 (t) of the original signal is obtained based on the original signal and the envelope mean:
如果h1(t)满足IMF条件,则得到IMF的第一个分量;如果h1(t)不满足IMF条件,重复步骤1)-2),直到满足IMF条件时,得到IMF分量:If h 1 (t) satisfies the IMF condition, the first component of IMF is obtained; if h 1 (t) does not satisfy the IMF condition, repeat steps 1)-2) until the IMF condition is satisfied, and the IMF component is obtained:
IMF1(t)=h1(t)IMF 1 (t) = h 1 (t)
将IMF1(t)从信号中剥离得到残余分量r1(t):The IMF 1 (t) is stripped from the signal to obtain the residual component r 1 (t):
r1(t)=x(t)-IMF1(t)r 1 (t) = x (t) - IMF 1 (t)
再以r1(t)为待处理信号:Let r 1 (t) be the signal to be processed:
x(t)=r1(t)x(t)= r1 (t)
重复步骤1)-7),直到不能再分解,则得到最终分解结果:Repeat steps 1)-7) until no further decomposition is possible, and the final decomposition result is obtained:
S2:构建SSA-SVM模型,应用麻雀搜索算法SSA优化SVM模型中的关键参数,将分解后的电价数据输入模型进行预测,得到每个特征信号下的预测值。S2: Construct the SSA-SVM model, apply the sparrow search algorithm SSA to optimize the key parameters in the SVM model, input the decomposed electricity price data into the model for prediction, and obtain the predicted value under each characteristic signal.
SVM应用于回归问题的支持向量回归是一种基于间隔最大化原则和核方法的强大回归模型,支持向量回归试图找到一个函数,使得预测值与真实值之间的误差不超过预设的阈值,并同时使得模型的复杂度最小。支持向量回归的优势在于它可以有效处理线性和非线性回归问题,其可以通过引入核函数将原始特征空间映射到更高维的空间,在这个新的特征空间中找到最优的回归函数。与逻辑回归和神经网络相比,支持向量机,在学习复杂的非线性方程时提供了一种更为清晰,更加强大的方式。Support vector regression applied to regression problems is a powerful regression model based on the principle of interval maximization and kernel method. Support vector regression attempts to find a function so that the error between the predicted value and the true value does not exceed the preset threshold, and at the same time minimizes the complexity of the model. The advantage of support vector regression is that it can effectively handle linear and nonlinear regression problems. It can map the original feature space to a higher-dimensional space by introducing a kernel function and find the optimal regression function in this new feature space. Compared with logistic regression and neural networks, support vector machines provide a clearer and more powerful way to learn complex nonlinear equations.
在SVM中,求取线性回归函数中精度ω的最小值,采用最小化欧几里德空间的范数,转化为优化问题,约束优化问题并不容易解决,因为它涉及到一种非线性的优化问题,通过引入拉格朗日函数,根据最优条件,得到原始优化问题的对偶形式:In SVM, the minimum value of the precision ω in the linear regression function is obtained, and the norm of the Euclidean space is minimized, which is transformed into an optimization problem. The constrained optimization problem is not easy to solve because it involves a nonlinear optimization problem. By introducing the Lagrangian function and according to the optimal conditions, the dual form of the original optimization problem is obtained:
约束条件为:The constraints are:
式中,xi为输入向量,yi为输出向量,l为训练样本,ε为不敏感损失函数,C为惩罚参数,αi为拉格朗日乘子且αi≥0。Where xi is the input vector, yi is the output vector, l is the training sample, ε is the insensitive loss function, C is the penalty parameter, αi is the Lagrange multiplier and αi ≥0.
对解决非线性回归问题进行时,需要先设定非线性映射值φ,这样才能有效地将训练样本与高维空间进行映射并在其进行线性回归。由于上述求解只能进行高维空间的内积计算,所以在此处可以引入核函数K(x,y)替代<φ(x),φ(x)>这样就能实现非线性回归,其优化方程能够转化成:When solving nonlinear regression problems, it is necessary to set the nonlinear mapping value φ first, so that the training samples can be effectively mapped to the high-dimensional space and linear regression can be performed on it. Since the above solution can only calculate the inner product of the high-dimensional space, the kernel function K(x,y) can be introduced here to replace <φ(x),φ(x)> so that nonlinear regression can be achieved, and its optimization equation can be transformed into:
SVM选择不同的核函数将会影响算法的优劣,本发明选择以径向基(RBF)作为核函数:Choosing different kernel functions for SVM will affect the quality of the algorithm. The present invention chooses radial basis function (RBF) as the kernel function:
K(x,xi)=exp(-||x-xi||2/2g2)K(x,x i )=exp(-||xx i || 2 /2g 2 )
电价与多个因素(如天气条件、供需关系、燃煤价格等)相关,这些关系往往是非线性的。而RBF核能够有效地处理非线性问题,对于一些噪声数据具有一定的鲁棒性,当参数选择合适时,RBF核SVM具有很好的泛化能力,能够在未见过的数据上也表现出良好的预测性能。在确定核函数之后再对径向基函数(RBF)的参数g和惩罚参数C进行选取。支持向量回归结构如图2所示。Electricity prices are related to multiple factors (such as weather conditions, supply and demand, coal prices, etc.), and these relationships are often nonlinear. The RBF kernel can effectively handle nonlinear problems and has a certain robustness to some noise data. When the parameters are selected appropriately, the RBF kernel SVM has a good generalization ability and can also show good prediction performance on unseen data. After determining the kernel function, the parameters g and penalty parameter C of the radial basis function (RBF) are selected. The support vector regression structure is shown in Figure 2.
麻雀搜索算法(Sparrow SearchAlgorithm,SSA)是一种在2020年提出的智能优化算法。该算法的设计灵感来源于麻雀的觅食行为和防捕食行为。在麻雀的觅食过程中,麻雀种群可以被划分为“发现者”和“追随者”两个角色。“发现者”负责在环境中寻找食物,并为整个麻雀种群提供觅食区域和方向,而“追随者”则依赖“发现者”来获取食物。Sparrow Search Algorithm (SSA) is an intelligent optimization algorithm proposed in 2020. The design of this algorithm is inspired by the foraging behavior and anti-predation behavior of sparrows. In the foraging process of sparrows, the sparrow population can be divided into two roles: "finders" and "followers". The "finders" are responsible for finding food in the environment and providing foraging areas and directions for the entire sparrow population, while the "followers" rely on the "finders" to obtain food.
在SSA算法中,这两类麻雀的行为被模拟为两种搜索策略,用于在优化问题的解空间中寻找最优解。同时,算法中也引入了一种预警机制。在每一次迭代中,都会有一部分麻雀个体被选出来进行预警,如果发现当前解可能会导致优化过程陷入局部最优或其他不良情况,它们可以选择放弃当前解,转而探索解空间的其他区域。这使得它具有很好的全局优化能力和适应性。其具体实现步骤如下:In the SSA algorithm, the behaviors of these two types of sparrows are simulated as two search strategies to find the optimal solution in the solution space of the optimization problem. At the same time, an early warning mechanism is also introduced in the algorithm. In each iteration, a part of the sparrow individuals will be selected for early warning. If they find that the current solution may cause the optimization process to fall into a local optimum or other undesirable situations, they can choose to abandon the current solution and explore other areas of the solution space. This makes it have good global optimization capabilities and adaptability. The specific implementation steps are as follows:
初始化种群、迭代次数、发现者与追随者比例Initialize the population, number of iterations, and the ratio of discoverers to followers
式中:n为麻雀种群的数量,d表示麻雀个体所附带的维度。Where: n is the number of sparrow populations, and d represents the dimension attached to the individual sparrows.
计算适应度Calculating fitness
式中:FX为每一行麻雀个体的适应度值Where: F X is the fitness value of each row of sparrows
有较强搜索能力即具备较好适应度值的发现者在搜索过程中会优先获取食物。作为探索者,其可获得比追随者更大的觅食搜索范围。A discoverer with a stronger search ability, i.e. a better fitness value, will have priority in obtaining food during the search process. As an explorer, it can obtain a larger foraging search range than a follower.
发现者在迭代过程中的位置更新如下:The finder's position is updated during the iteration as follows:
式中:表示迭代t次第i只麻雀在j维时的位置,α表示(0,1]范围内的随机数,Tmax表示最大迭代次数,R2∈[0,1]表示预警值,ST∈[0,1]表示安全值,Q为服从正态分布的随机数,L1表示1×d列的矩阵,且所有元素全是1。Where: represents the position of the i-th sparrow in the j-dimension at the t-th iteration, α represents a random number in the range of (0,1], T max represents the maximum number of iterations, R 2 ∈[0,1] represents the warning value, ST∈[0,1] represents the safety value, Q is a random number that obeys the normal distribution, and L 1 represents a 1×d-column matrix with all elements being 1.
当R2<ST时,这意味着周围没有天敌,探索者可以进行全局搜索。若R2≥ST这意味着一些麻雀已经发现了捕食者,所有麻雀都要采取相关行动。When R2 <ST, it means there are no natural enemies around and the explorer can conduct a global search. If R2≥ST, it means some sparrows have discovered the predator and all sparrows must take relevant actions.
更新追随者位置:Update follower location:
式中,表示在第(t+1)次迭代时生产者在j维时所占据的最佳位置,表示第t次迭代时整个种群中的最差位置;A表示每个元素随机分配1或-1的矩阵(1行d列),且A+=AT(AAT)-1。In the formula, represents the best position occupied by the producer in the j-th dimension at the (t+1)th iteration, represents the worst position in the entire population at the t-th iteration; A represents a matrix (1 row and d columns) in which each element is randomly assigned 1 or -1, and A + = AT (AA T ) -1 .
当i>n/2时,表明该追求者处于十分饥饿的状态,利用一个标准正态分布随机数与以自然对数为底指数函数的积,控制其取值符合正态分布,即获取更多的能量。当i≤n/2时,其过程可解释为在当前最优位置附近随机找到一处位置,且每一维据最优位置方差较小,值较为稳定。When i>n/2, it indicates that the pursuer is in a very hungry state. The product of a standard normal distribution random number and an exponential function with natural logarithm as the base is used to control its value to conform to the normal distribution, that is, to obtain more energy. When i≤n/2, the process can be explained as randomly finding a position near the current optimal position, and the variance of each dimension according to the optimal position is small and the value is relatively stable.
更新警戒者位置:Updated Sentinel location:
式中:β代表服从均值为0,方差为1的正态分布的步长控制系数,K代表[-1,1]区间的随机数,fi代表当前麻雀个体的适应度值,fg代表当前全局最佳适应度值,fw代表当前全局最差适应度值,c代表常数,避免分母为零而设置。Where: β represents the step size control coefficient that obeys the normal distribution with a mean of 0 and a variance of 1, K represents a random number in the interval [-1,1], fi represents the fitness value of the current sparrow individual, fg represents the current global best fitness value, fw represents the current global worst fitness value, and c represents a constant, which is set to avoid the denominator being zero.
当预警麻雀处于当前最优位置,则会逃离至自身附近的位置。若不是最优位置,则逃离到当前最优位置附近。When the warning sparrow is in the current optimal position, it will escape to a position near itself. If it is not the optimal position, it will escape to the vicinity of the current optimal position.
以SSA搜索g,C的最佳取值,具体为,Use SSA to search for the best values of g and C, specifically,
根据用EMD将原始电价序列分解得到的本征模态IMF和一个残差分量IMF-Res为其子序列,作为后续预测的输入。The original electricity price series is decomposed by EMD to obtain the intrinsic mode IMF and a residual component IMF-Res as its subsequence, which is used as the input for subsequent predictions.
将各子序列进行归一化处理,标准化后的数值处于[0,1]之间,计算方式为数据与该列的最小值作差,再除以极差:Each subsequence is normalized, and the standardized value is between [0,1]. The calculation method is to subtract the data from the minimum value of the column and then divide it by the range:
式中:x′i为子序列第i点的归一化结果,xi为子序列第i点的电价,xmax和xmin为子序列中电价的最大值和最小值。Where: x′i is the normalized result of the i-th point in the subsequence, xi is the electricity price of the i-th point in the subsequence, and xmax and xmin are the maximum and minimum electricity prices in the subsequence.
确定优化参数个数为2,迭代次数,在C、g经验值范围内初始化麻雀种群位置向量,设置麻雀种群数量,发现者和预警者比例,以及预警阈值。Determine the number of optimization parameters as 2, the number of iterations, initialize the sparrow population position vector within the C and g empirical value range, set the sparrow population size, the ratio of discoverers to warners, and the warning threshold.
计算每个麻雀个体的适应度,并得到高适应度值的当前麻雀最佳位置。Calculate the fitness of each individual sparrow and get the best position of the current sparrow with high fitness value.
判断是否满足位置更新条件,若满足,则进行位置更新;若不满足,则保留当前位置。Determine whether the location update conditions are met. If so, update the location; if not, keep the current location.
判断是否满足停止搜索条件,如满足,则停止寻优,从而得到最优解。Determine whether the stop search condition is met. If so, stop searching to obtain the optimal solution.
将得到的最优参数g和惩罚参数C代入到支持向量机模型中用以训练。The obtained optimal parameter g and penalty parameter C are substituted into the support vector machine model for training.
对各子序列分别建模,重复得到各自的预测结果,然后将所有预测结果累加重构,即得到最终的电价预测结果,并通过计算RMSE、R2、MAE、MBE等指标对预测结果进行评判。Each subsequence is modeled separately and the respective prediction results are obtained repeatedly. Then all the prediction results are accumulated and reconstructed to obtain the final electricity price prediction result. The prediction results are judged by calculating indicators such as RMSE, R2, MAE, and MBE.
构建SVM模型,选择模型的核函数,确定核函数中需要选取的关键参数;对麻雀搜索算法SSA进行优化,使用优化后的麻雀搜索算法确定核函数中的关键参数;将经过EMD分解后的待处理信号输入麻雀搜索算法中得出预测参数结果,将得到的预测参数结果代入到SVM模型中进行训练,模型训练完成后,将得到的各待处理信号输入模型进行预测。Construct an SVM model, select the kernel function of the model, and determine the key parameters that need to be selected in the kernel function; optimize the sparrow search algorithm SSA, and use the optimized sparrow search algorithm to determine the key parameters in the kernel function; input the signal to be processed after EMD decomposition into the sparrow search algorithm to obtain the prediction parameter results, and substitute the obtained prediction parameter results into the SVM model for training. After the model training is completed, the obtained signals to be processed are input into the model for prediction.
S3:将模型输出的预测值累加重构获得最终预测结果,进行基于EMD分解和SSA-SVM模型的电价预测。S3: The predicted values output by the model are accumulated and reconstructed to obtain the final prediction result, and the electricity price prediction is performed based on EMD decomposition and SSA-SVM model.
进一步的,本实施例还提供一种基于EMD分解和SSA-SVM模型的电价预测系统,包括:获取模块,用于获取原始电价数据,将原始电价数据划分为训练集和测试集,对电价数据通过经验模态分解算法EMD进行分解;构建预测模块,构建SSA-SVM模型,应用麻雀搜索算法SSA优化SVM模型中的关键参数,将分解后的电价数据输入模型进行预测,得到每个特征信号下的预测值;输出模块,用于将模型输出的预测值累加重构获得最终预测结果,进行基于EMD分解和SSA-SVM模型的电价预测。Furthermore, this embodiment also provides an electricity price prediction system based on EMD decomposition and SSA-SVM model, including: an acquisition module, used to obtain original electricity price data, divide the original electricity price data into a training set and a test set, and decompose the electricity price data through the empirical mode decomposition algorithm EMD; construct a prediction module, construct an SSA-SVM model, apply the sparrow search algorithm SSA to optimize the key parameters in the SVM model, input the decomposed electricity price data into the model for prediction, and obtain the predicted value under each characteristic signal; an output module, used to accumulate and reconstruct the predicted values output by the model to obtain the final prediction result, and perform electricity price prediction based on EMD decomposition and SSA-SVM model.
本实施例还提供一种计算机设备,适用于基于EMD分解和SSA-SVM模型的电价预测方法的情况,包括:存储器和处理器;存储器用于存储计算机可执行指令,处理器用于执行计算机可执行指令,实现如上述实施例提出的本发明实施例所述方法的全部或部分步骤。This embodiment also provides a computer device, which is suitable for the case of an electricity price prediction method based on EMD decomposition and SSA-SVM model, including: a memory and a processor; the memory is used to store computer executable instructions, and the processor is used to execute computer executable instructions to implement all or part of the steps of the method described in the embodiment of the present invention as proposed in the above embodiment.
本实施例还提供一种存储介质,其上存储有计算机程序,计算机程序被处理器执行时,执行上述实施例的任一可选的实现方式中的方法。其中,存储介质可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(Static RandomAccess Memory,简称SRAM),电可擦除可编程只读存储器(Electrically ErasableProgrammable Read-Only Memory,简称EEPROM),可擦除可编程只读存储器(ErasableProgrammable Read OnlyMemory,简称EPROM),可编程只读存储器(Programmable Red-Only Memory,简称PROM),只读存储器(Read-OnlyMemory,简称ROM),磁存储器,快闪存储器,磁盘或光盘。This embodiment also provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the method in any optional implementation of the above embodiment is executed. The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable red-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, disk or optical disk.
本实施例提出的存储介质与上述实施例提出的数据存储方法属于同一发明构思,未在本实施例中详尽描述的技术细节可参见上述实施例,并且本实施例与上述实施例具有相同的有益效果。The storage medium proposed in this embodiment and the data storage method proposed in the above embodiment belong to the same inventive concept. The technical details not fully described in this embodiment can be found in the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.
由上可知,本发明通过使用经验模态分解EMD对原始电价数据进行分解,能够有效处理非线性和非平稳性,提高电价预测准确性,可以根据特定的频率成分进行建模,更好地适应电价数据的真实特征。将高频噪音成分从电价数据中分离出来,减少噪音对预测的干扰。有助于提高模型的鲁棒性,更能应对电价数据中的异常值和波动。允许分别处理不同频率成分,有助于提取电价数据中的重要信息。不同成分的分析可以揭示电价数据中的趋势、季节性和周期性,使模型更好地理解电价波动的原因。通过参数优化,可以提高模型的性能,确保更好地拟合电价数据的特性。可以通过参数调整适应不同的情境,通过分解和累加预测结果,可以更好地理解不同频率成分在电价数据中的贡献。有助于时间序列分析,能够更好地预测未来电价趋势和波动。高精度的电价预测为能源市场参与者提供有力的支持,优化电力采购策略、合理规划用电需求和降低成本。通过提高电价预测的准确性,电力市场参与者可以更有效地管理成本,减少不必要的开支,提高能源资源的利用效率,实现更好的经济效益。As can be seen from the above, the present invention can effectively handle nonlinearity and non-stationarity, improve the accuracy of electricity price prediction, and can model according to specific frequency components to better adapt to the real characteristics of electricity price data by decomposing the original electricity price data using empirical mode decomposition EMD. Separate the high-frequency noise components from the electricity price data to reduce the interference of noise on the prediction. It helps to improve the robustness of the model and better cope with outliers and fluctuations in electricity price data. Allowing different frequency components to be processed separately helps to extract important information from electricity price data. The analysis of different components can reveal the trends, seasonality and periodicity in electricity price data, so that the model can better understand the reasons for electricity price fluctuations. Through parameter optimization, the performance of the model can be improved to ensure better fit to the characteristics of electricity price data. It can adapt to different scenarios through parameter adjustment, and the contribution of different frequency components in electricity price data can be better understood by decomposing and accumulating the prediction results. It is helpful for time series analysis and can better predict future electricity price trends and fluctuations. High-precision electricity price forecasts provide strong support for energy market participants, optimize electricity procurement strategies, rationally plan electricity demand and reduce costs. By improving the accuracy of electricity price forecasts, electricity market participants can manage costs more effectively, reduce unnecessary expenses, improve the utilization efficiency of energy resources, and achieve better economic benefits.
实施例2Example 2
参照图2~图11,为本发明第二个实施例,该实施例提供了一种基于EMD分解和SSA-SVM模型的电价预测方法,为了验证本发明的有益效果,通过经济效益计算和仿真实验进行科学论证。2 to 11 , a second embodiment of the present invention is shown. This embodiment provides an electricity price prediction method based on EMD decomposition and SSA-SVM model. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through economic benefit calculation and simulation experiments.
以贵州省电力市场的批发电价、零售电价为例,采集到其2021年1月至2023年6月的历史电价数据,并且同时将影响电价的外部因素——上网电量和煤价作为特征量输入到SVM、POS-SVM、EMD-SVM及本发明所述EMD-SSA-SVM预测模型进行预测对比,采用均方根误差(RSME)、均方误差(MAE)、偏差误差(MBE)、平均绝对百分比误差(MAPE)、决定系数(R2)、纳什系数(NSE)作为评价指标,对各模型的预测结果进行指标上的对比,指标具体如下表所示:Taking the wholesale electricity price and retail electricity price of the power market in Guizhou Province as an example, the historical electricity price data from January 2021 to June 2023 were collected, and at the same time, the external factors affecting the electricity price - the grid-connected electricity volume and the coal price were input as feature quantities into the SVM, POS-SVM, EMD-SVM and EMD-SSA-SVM prediction models of the present invention for prediction comparison. The root mean square error (RSME), mean square error (MAE), bias error (MBE), mean absolute percentage error (MAPE), determination coefficient (R2), and Nash coefficient (NSE) were used as evaluation indicators to compare the prediction results of each model. The specific indicators are shown in the following table:
表1各模型批发电价预测指标对比Table 1 Comparison of wholesale electricity price prediction indicators of various models
从批发电价的预测结果来看,EMD-SSA-SVM预测模型在RMSE、MAE、MBE、MAPE上皆小于其他三个模型,表明其对较大误差的敏感性最低,预测误差的绝对值的平均值、预测误差百分比最小,预测准确性最高。Judging from the forecast results of wholesale electricity prices, the EMD-SSA-SVM forecasting model is smaller than the other three models in RMSE, MAE, MBE, and MAPE, indicating that it has the lowest sensitivity to large errors, the smallest average of the absolute value of the forecast error, and the smallest percentage of the forecast error, and the highest forecast accuracy.
表2各模型零售电价预测指标对比Table 2 Comparison of retail electricity price prediction indicators of various models
从零售电价预测结果来看,EMD-SVR和EMD-SSA-SVR的RMSE最低,这两个模型预测误差的平方的平均值最小,它们对大的误差更不敏感。Judging from the retail electricity price forecast results, EMD-SVR and EMD-SSA-SVR have the lowest RMSE. The average of the square of the prediction errors of these two models is the smallest, and they are less sensitive to large errors.
EMD-SSA-SVR的MAE最低,其预测误差的绝对值的平均最小,MBE值也更接近于零,表示其预测值与真实值之间的偏差最小。所有模型的MAPE都非常接近,但EMD-SSA-SVR的MAPE最小,表示其相对预测误差百分比最小,预测准确性最高。总的来说,EMD-SSA-SVR的预测结果更为准确,其具有更好的预测性能。从预测误差的箱形图也可以看出EMD-SSA-SVM预测误差的四分位数之间的距离最小,误差的分布集中,稳定性好。中位数也最接近零,说明误差的偏差较小,预测更准确。本方法可以有效提高电价的预测精度。EMD-SSA-SVR has the lowest MAE, the smallest average of the absolute value of its prediction error, and its MBE value is also closer to zero, indicating that the deviation between its predicted value and the true value is the smallest. The MAPE of all models is very close, but the MAPE of EMD-SSA-SVR is the smallest, indicating that its relative prediction error percentage is the smallest and the prediction accuracy is the highest. In general, the prediction results of EMD-SSA-SVR are more accurate and have better prediction performance. From the box plot of the prediction error, it can also be seen that the distance between the quartiles of the EMD-SSA-SVM prediction error is the smallest, the distribution of the error is concentrated, and the stability is good. The median is also closest to zero, indicating that the error deviation is small and the prediction is more accurate. This method can effectively improve the prediction accuracy of electricity prices.
由上可知,本发明通过使用经验模态分解EMD对原始电价数据进行分解,能够有效处理非线性和非平稳性,提高电价预测准确性,可以根据特定的频率成分进行建模,更好地适应电价数据的真实特征。将高频噪音成分从电价数据中分离出来,减少噪音对预测的干扰。有助于提高模型的鲁棒性,更能应对电价数据中的异常值和波动。允许分别处理不同频率成分,有助于提取电价数据中的重要信息。不同成分的分析可以揭示电价数据中的趋势、季节性和周期性,使模型更好地理解电价波动的原因。通过参数优化,可以提高模型的性能,确保更好地拟合电价数据的特性。可以通过参数调整适应不同的情境,通过分解和累加预测结果,可以更好地理解不同频率成分在电价数据中的贡献。有助于时间序列分析,能够更好地预测未来电价趋势和波动。高精度的电价预测为能源市场参与者提供有力的支持,优化电力采购策略、合理规划用电需求和降低成本。通过提高电价预测的准确性,电力市场参与者可以更有效地管理成本,减少不必要的开支,提高能源资源的利用效率,实现更好的经济效益。As can be seen from the above, the present invention can effectively handle nonlinearity and non-stationarity, improve the accuracy of electricity price prediction, and can model according to specific frequency components to better adapt to the real characteristics of electricity price data by decomposing the original electricity price data using empirical mode decomposition EMD. Separate the high-frequency noise components from the electricity price data to reduce the interference of noise on the prediction. It helps to improve the robustness of the model and better cope with outliers and fluctuations in electricity price data. Allowing different frequency components to be processed separately helps to extract important information from electricity price data. The analysis of different components can reveal the trends, seasonality and periodicity in electricity price data, so that the model can better understand the reasons for electricity price fluctuations. Through parameter optimization, the performance of the model can be improved to ensure better fit to the characteristics of electricity price data. It can adapt to different scenarios through parameter adjustment, and the contribution of different frequency components in electricity price data can be better understood by decomposing and accumulating the prediction results. It is helpful for time series analysis and can better predict future electricity price trends and fluctuations. High-precision electricity price forecasts provide strong support for energy market participants, optimize electricity procurement strategies, rationally plan electricity demand and reduce costs. By improving the accuracy of electricity price forecasts, electricity market participants can manage costs more effectively, reduce unnecessary expenses, improve the utilization efficiency of energy resources, and achieve better economic benefits.
应说明的是,以上实施例仅用以说明本发明的技术方案而非限制,尽管参照较佳实施例对本发明进行了详细说明,本领域的普通技术人员应当理解,可以对本发明的技术方案进行修改或者等同替换,而不脱离本发明技术方案的精神和范围,其均应涵盖在本发明的权利要求范围当中。It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311563567.5A CN117541291A (en) | 2023-11-22 | 2023-11-22 | An electricity price prediction method and system based on EMD decomposition and SSA-SVM model |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311563567.5A CN117541291A (en) | 2023-11-22 | 2023-11-22 | An electricity price prediction method and system based on EMD decomposition and SSA-SVM model |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117541291A true CN117541291A (en) | 2024-02-09 |
Family
ID=89787853
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311563567.5A Withdrawn CN117541291A (en) | 2023-11-22 | 2023-11-22 | An electricity price prediction method and system based on EMD decomposition and SSA-SVM model |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117541291A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118235723A (en) * | 2024-05-28 | 2024-06-25 | 云南省草地动物科学研究院 | Cow intelligent monitoring platform and device based on wisdom pasture |
-
2023
- 2023-11-22 CN CN202311563567.5A patent/CN117541291A/en not_active Withdrawn
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118235723A (en) * | 2024-05-28 | 2024-06-25 | 云南省草地动物科学研究院 | Cow intelligent monitoring platform and device based on wisdom pasture |
CN118235723B (en) * | 2024-05-28 | 2024-07-19 | 云南省草地动物科学研究院 | Cow intelligent monitoring platform and device based on wisdom pasture |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Ma et al. | A hybrid attention-based deep learning approach for wind power prediction | |
Dewangan et al. | Combining forecasts of day-ahead solar power | |
Tan et al. | Multi-node load forecasting based on multi-task learning with modal feature extraction | |
Bala et al. | Financial and non-stationary time series forecasting using LSTM recurrent neural network for short and long horizon | |
Hu et al. | Research and application of a hybrid model based on Meta learning strategy for wind power deterministic and probabilistic forecasting | |
Guo et al. | A stock market forecasting model combining two-directional two-dimensional principal component analysis and radial basis function neural network | |
Dhevi | Imputing missing values using Inverse Distance Weighted Interpolation for time series data | |
Garg et al. | A CNN encoder decoder LSTM model for sustainable wind power predictive analytics | |
Yin et al. | A deep multivariate time series multistep forecasting network | |
CN117251754A (en) | A CNN-GRU energy consumption prediction method taking into account dynamic time wrapping | |
Li et al. | Residential load forecasting: An online-offline deep kernel learning method | |
CN117541291A (en) | An electricity price prediction method and system based on EMD decomposition and SSA-SVM model | |
CN110738363B (en) | Photovoltaic power generation power prediction method | |
Akhtar et al. | Optimized cascaded CNN for intelligent rainfall prediction model: a research towards statistic-based machine learning | |
Fu et al. | Enhanced machine learning model via twin support vector regression for streamflow time series forecasting of hydropower reservoir | |
Wu et al. | Hybrid support vector regression with parallel co-evolution algorithm based on GA and PSO for forecasting monthly rainfall | |
Teixeira et al. | Enhancing weather forecasting integrating LSTM and GA | |
CN118550757A (en) | Missing data-oriented micro-service system root cause positioning method, medium and device | |
CN118229119A (en) | Short-term load forecasting method, system and storage medium integrating time series decomposition and machine learning model | |
Lu et al. | Car sales volume prediction based on particle swarm optimization algorithm and support vector regression | |
CN117713053A (en) | A power load forecasting method and device integrating graph structure representation | |
Wang et al. | LightGBM-BES-BiLSTM Carbon Price Prediction Based on Environmental Impact Factors | |
CN111931994A (en) | Short-term load and photovoltaic power prediction method, system, equipment and medium thereof | |
Qin et al. | Short term wind speed prediction based on CEESMDAN and improved seagull optimization kernel extreme learning machine | |
CN114825333B (en) | Regional wind power modeling method, device, storage medium and equipment |
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 | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20240209 |