# Research on PSO-ARMA-SVR Short-Term Electricity Consumption Forecast Based on the Particle Swarm Algorithm

Authors: Wenbo Zhu; Hao Ma; Gaoyan Cai; Jianwen Chen; Xiucai Wang; Aiyuan Li
Journal: Wireless Communications and Mobile Computing
 (2021)

---

## Abstract

Aimed at the problem of order determination of short-term power consumption in a time series model, a new method was proposed to determine the orderp and the moving average q of the ARMA model by particle swarm optimization (PSO).According to the difference between the predicted value and the real value of the ARMA model, the fitness function of the particle swarm optimization algorithm is constructed, while the optimal solution which satisfies the ARMA model is confirmed by adjusting the inertia weight, population size, particle velocity, and iteration number. Finally, SVR regression is performed by using a support vector machine to correct the residual sequence obtained after the prediction of ARMA. The final prediction result is obtained by adding the predicted values and corrected residual. Based on the data of historical electricity load of a residential district in 2016~2017, the proposed method is compared with the traditional models. The result of the use of MATLAB simulation shows that the method is simple and feasible, greatly improves the model prediction accuracy, and implements the new method for short-term load forecasting of a small sample.


---

## Body

## 1. Introduction

The short-term load forecast of the power system is generally a series of forecasts based on the data of the next few days or several weeks. Since electric energy cannot be stored in large quantities and the demand for electric power in society is constantly changing, it is necessary to predict short-term electricity consumption in order to achieve a dynamic balance between the power supply end and the power generation end. The higher the accuracy of the short-term load forecasting, the more beneficial it is to the normal operation of the power grid system, and it also provides an important basis for the power grid to formulate a short-term reasonable dispatch plan [1]. With the increase in the scale of power systems, the increase in nonlinear loads, and the introduction of market competition mechanisms, it becomes more important and urgent to study combinatorial optimization algorithms with higher prediction accuracy [2]. Liu and Zhang propose cluster-based CIIoT wherein the cluster heads perform cooperative spectrum sensing to get available spectrum and the nodes transmit via nonorthogonal multiple access (NOMA) [3]. Then, Liu et al. furtherly propose a joint optimization algorithm based on Lagrange dual decomposition which is proposed to achieve the optimal solution [4]. Jia et al. propose a space segment design based on a spectrum sensing-based cooperative framework, in consideration of the presence of MUs [5]. Moreover, a novel detector which joints the QOC and Fixed Sphere Decoding (FSD) algorithm is proposed by Jia et al. to address multiplexing overlapped carriers [6].The essence of load forecasting is to extract the changing law of historical electricity consumption data over time. Because the load is affected by various factors such as temperature and weather, the difficulty of load forecasting also increases [7]. Traditional load forecasting methods include time series method, autoregressive method, Kalman filter [8], and so on. These methods mainly make predictions based on the time series of historical load data. Therefore, the prediction accuracy of data with strong time series is relatively high, but for some nonlinear data, the effect of using this method to predict is relatively poor. Traditional prediction methods have difficulty in meeting higher prediction accuracy requirements. In recent years, artificial intelligence algorithms represented by support vector machines and neural networks [9] have attracted widespread attention due to their high prediction accuracy and strong computing capabilities. Among them, the most widely used is the BP neural network model, which is also simpler and faster, for prediction, but the BP neural network is easy to fall into the local optimum, and it is difficult to obtain the global optimum solution [10, 11]. Yue et al. proposed a short-term load prediction model of a ridgelet recurrent neural network, which improved the accuracy of prediction to a certain extent, but too much data resulted in slower training speed [12]. Wang and others put forward an ARIMA-SVM combined forecasting model through research, which has strong generalization ability and is suitable for load forecasting with strong fluctuations [13]. Wang et al. proposed a short-term prediction model of a convolutional neural network with an encoder and particle swarm optimization algorithm. The PSO algorithm is used to optimize the parameters of the convolutional neural network to improve the prediction accuracy [14]. Li and Wang proposed a short-term load forecasting method based on the PSO algorithm and RNN, which overcomes the problem of large random value of the initial weight of RNN and has good convergence, but it does not solve the gradient problem that easily occurs in RNN [15]. To further promote the forecasting precision, the adjustable fractional weighted coefficients and corresponding time parameter of the initial condition are estimated by utilizing the particle swarm optimization (PSO) [16].In recent years, many experts have put forward many new criteria and methods on how to determine the structure of ARMA, which has improved compared with traditional methods [17]. But the problem of applying the particle swarm algorithm to ARMA model order determination has been studied by few scholars. This paper proposes a new order determination method for prediction. The particle swarm algorithm is applied to the order problem of the model, and the optimization is performed according to the self-adaptation of the particle swarm algorithm and iteratively finds the optimal position of the particles, that is, the autoregressive order. The optimal solution of the value of the number p and the number of moving average terms q, so as to determine the best ARMA model, uses SVR to perform regression correction on the residual data obtained after prediction to obtain new effective residual data, combined with the PSO-ARMA. The prediction results are added to get the final prediction result. Additionally, Wu et al. construct the EMD-GM-ARMA model via superimposing the prediction results of each subsequence to predict the mining safety production situation [18]. Guo et al. use a fruit fly optimization algorithm to optimize the parameters in SVR [19]. The above modifications are considered effective improvement, through case analysis and comparison with the prediction results of other models. It is proven that the prediction accuracy of the combined model has been significantly improved.


## 2. Overview of the PSO-ARMA-SVR Combination Model

### 2.1. Algorithm Overview

When determining the order of the ARMA model, some uncertain factors often appear. After comprehensive consideration of various constraints, this paper uses the particle swarm algorithm to adaptively optimize the parameters in the ARMA model. The order of thep,q model is iterated and optimized to finally achieve the goal of improving the prediction accuracy of the ARMAp,q model. The framework of the algorithm is mainly divided into three parts:
(1)
PSO-ARMA partA new ARMA model order determination method is proposed, through the continuous iteration of the particle swarm algorithm to find the optimal solution that satisfies the ARMA model autoregressive order p and the moving average term q. According to the optimal solution obtained by the dynamic weight iteration and the exhaustive method for comparison and verification, it was confirmed that the value is the global optimal solution.
(2)
ARMA-SVR partThe residual sequence after fitting arma isx^res=x^res1,x^res2,x^res3⋯x^resn. The support vector regression (SVR) model is used for fitting, the new effective residual data is obtained through regression correction, and the final prediction results are combined with the prediction results obtained by PSO-ARMA.
(3)
Fitness function constructionIn actual electricity consumption forecasting, usually observable time series are modeled according to their part, and the remaining part of the data is used for verification. If the difference between the predicted value and the true value is small, it represents the model. It is more accurate. Otherwise, it means that the model has a large error and needs to be remodeled. Therefore, the difference between the predicted value and the true value can be used as a criterion for judging whether the model is correct.


### 2.2. Algorithm Flow and Block Diagram

The PSO algorithm is used to optimize the order ofp and q parameters in ARMA, so as to establish the optimal ARMA-SVR combined prediction model. The PSO-ARMA-SVR modeling process is shown in Figure 1. The specific optimization modeling steps are as follows:Step 1.
Normalize the data. The purpose of normalization of data is to narrow the difference between the attributes in the input data. If the difference is large, it will have a greater impact on the predicted results; the normalization processing formula is as follows:(1)xi,j∗=xi,j−xminxmax−xmin,where xi,j represents the sample point in the ith row and jth column and xmax and xmin represent the maximum and minimum values of the data.Step 2.
Use the PSO algorithm to optimize the parameters, initialize the position and velocity of the particles, and obtain a new fitness function value through each iteration to verify whether it is the optimal solution, until the optimal parameters (p and q value) are obtained.Step 3.
Establish an ARMA model based on thep and q parameters obtained by iterative optimization in the previous step, and perform fitting prediction.Step 4.
The data fitting result of the prediction sample is subtracted from the original training data to obtain the residual data predicted by the ARMA model, and the SVR model is further constructed based on the training residual data, and then, the residual data is predicted.Step 5.
According to the residual value obtained after the sample data prediction, the residual is used as the input of the SVR model to perform regression, and a new residual sequence is predicted.Step 6.
Concatenate the ARMA model and the SVR model, train 70% of the data in the sample sequence, and the final output result is the sum of the residual optimization result obtained by the combined prediction model and the ARMA prediction result, and compare the remaining 30% of the data. The final output sequence isFp=f1,f2,⋯,fp.Figure 1
Flowchart of PSO-ARMA-SVR.


## 2.1. Algorithm Overview

When determining the order of the ARMA model, some uncertain factors often appear. After comprehensive consideration of various constraints, this paper uses the particle swarm algorithm to adaptively optimize the parameters in the ARMA model. The order of thep,q model is iterated and optimized to finally achieve the goal of improving the prediction accuracy of the ARMAp,q model. The framework of the algorithm is mainly divided into three parts:
(1)
PSO-ARMA partA new ARMA model order determination method is proposed, through the continuous iteration of the particle swarm algorithm to find the optimal solution that satisfies the ARMA model autoregressive order p and the moving average term q. According to the optimal solution obtained by the dynamic weight iteration and the exhaustive method for comparison and verification, it was confirmed that the value is the global optimal solution.
(2)
ARMA-SVR partThe residual sequence after fitting arma isx^res=x^res1,x^res2,x^res3⋯x^resn. The support vector regression (SVR) model is used for fitting, the new effective residual data is obtained through regression correction, and the final prediction results are combined with the prediction results obtained by PSO-ARMA.
(3)
Fitness function constructionIn actual electricity consumption forecasting, usually observable time series are modeled according to their part, and the remaining part of the data is used for verification. If the difference between the predicted value and the true value is small, it represents the model. It is more accurate. Otherwise, it means that the model has a large error and needs to be remodeled. Therefore, the difference between the predicted value and the true value can be used as a criterion for judging whether the model is correct.


## 2.2. Algorithm Flow and Block Diagram

The PSO algorithm is used to optimize the order ofp and q parameters in ARMA, so as to establish the optimal ARMA-SVR combined prediction model. The PSO-ARMA-SVR modeling process is shown in Figure 1. The specific optimization modeling steps are as follows:Step 1.
Normalize the data. The purpose of normalization of data is to narrow the difference between the attributes in the input data. If the difference is large, it will have a greater impact on the predicted results; the normalization processing formula is as follows:(1)xi,j∗=xi,j−xminxmax−xmin,where xi,j represents the sample point in the ith row and jth column and xmax and xmin represent the maximum and minimum values of the data.Step 2.
Use the PSO algorithm to optimize the parameters, initialize the position and velocity of the particles, and obtain a new fitness function value through each iteration to verify whether it is the optimal solution, until the optimal parameters (p and q value) are obtained.Step 3.
Establish an ARMA model based on thep and q parameters obtained by iterative optimization in the previous step, and perform fitting prediction.Step 4.
The data fitting result of the prediction sample is subtracted from the original training data to obtain the residual data predicted by the ARMA model, and the SVR model is further constructed based on the training residual data, and then, the residual data is predicted.Step 5.
According to the residual value obtained after the sample data prediction, the residual is used as the input of the SVR model to perform regression, and a new residual sequence is predicted.Step 6.
Concatenate the ARMA model and the SVR model, train 70% of the data in the sample sequence, and the final output result is the sum of the residual optimization result obtained by the combined prediction model and the ARMA prediction result, and compare the remaining 30% of the data. The final output sequence isFp=f1,f2,⋯,fp.Figure 1
Flowchart of PSO-ARMA-SVR.


## 3. Problem of Determining the ARMA Model Order Based on Particle Swarm Optimization

### 3.1. Principle of the Particle Swarm Algorithm

The original of the particle swarm algorithm is that people have a lot of different behavioral studies between bird groups. The biggest feature of bird predation is that it can quickly search for a range of predation between similar groups and between groups. Certain sharing of food information is conducive to the coevolution of individuals and groups [13]. The particle swarm algorithm corresponds to one of the solutions of each “flying” particle in space and summarizes the characteristic information of the particle with the three indicators of flight speed, position, and fitness function value and iterates the optimization according to the fitness function. The calculated value is used to judge the quality of particles. By judging the “flying” path of itself and other particles, the particle changes its position and direction to continuously find a better area, thus completing the process of continuous optimization in the global search space [20].The description of the particle swarm algorithm in the past is as follows: assume that the search space of particles inD dimension consists of N particles to form a population X=x1,x2,⋯xm, where xi=xi1,xi2,⋯xil. The fitness function is fxi. The velocity of particle i is Vi. The best position for the individual particle i to pass is Pbest. The optimal position of population X is gbest. Suppose the characteristic information of xi at time t isspeed:(2)Vit=vi1t,vi2t,⋯,viDtT,position:(3)Xit=xi1t,xi2t,⋯,xiDtT,individual optimal position:(4)Pit=pi1t,pi2t,⋯,piDtT,global optimal position:(5)Pgt=vi1t,vi2t,⋯,viDtT.Then, the speed and position information of the particle “flying” at timet+1 is
(6)vidk=wvidk−1+c1r1pidk−1−xidk−1+c2r2pgdk−1−xidk−1,xidk=xidk−1+vidk−1.Among them,vidk andxidk are the components of the velocity and position of the particle i in the kth iteration in the dth dimension, respectively; c1 and c2 are constants for adjusting the learning step length; r1 andr2 are random numbers distributed between 0,1; and ω is used to adjust the search range of the solution space. In order to keep the particles in the search range, the speed and position of the particles are generally limited to −vmax,vmax and −xmax,xmax, respectively.


### 3.2. Basic Parameter Setting of Particle Swarm

Since the particle swarm algorithm is restricted by the fixed inertia weight during the iteration process, the global search ability of the algorithm is greatly weakened. In order to prevent the particles from falling into the local optimum prematurely, this paper adopts a rule of diminishing inertia weight differential, which is calculated as follows:(7)dωdt=2ωmax−ωmintmax2·t,ω=ωmax−ωmax−ωmintmax2∙t2.ω represents the inertia weight, ωmax and ωmin are the maximum and minimum weights, tmax represents the maximum number of iterations, and t is the current number of iterations. When the value of ω is too small, the search will gradually fall into the local optimum. When the value of ω is larger, the global search ability is stronger. Therefore, according to this dynamic method, the particles can be better at the global optimum status. First, initialize the population of particles, set the initial position and initial speed of the particle population randomly, and set the number of populations to N (the setting of p and q in the ARMA model by particle swarm). After many experiments, it is found that the initial set number of populations has no great influence on the iterative results of particle swarm optimization. Therefore, in order to simplify and save the iteration time, this paper chooses the number of populations N=50, for the selection of learning factors c1,c2, generally c1=c2=2.


### 3.3. Determination of Fitness Function

For a time series model, if you want to evaluate the pros and cons of the combined model, you need to judge the accuracy of the model’s prediction results. The higher the accuracy of the prediction, the more reasonable the model is. In the actual electricity consumption forecast, usually for the observable time series, model according to its part and use the remaining part of the data to verify. If the difference between the predicted value and the true value is small, it means that the model is more accurate. Otherwise, it means that the model has a large error and needs to be remodeled. Therefore, the difference between the predicted value and the true value can be used as a criterion for judging whether the model is correct. Therefore, according to this criterion, the square sum of the difference between the predicted value and the actual value is established. The smaller the value change obtained, the more appropriate the model, which is defined as(8)Z=∑i=1Ny∧i−yi2,where y^i is the predicted value andyi is the actual value.According to formula (8), the fitness function can be constructed:
(9)fx=1Z.It can be seen from formula (9) that the smaller the change value Z, the more ideal the predicted effect. When Z=0, it means that the ARMAp,q model is the best prediction model, and the prediction effect is the best. Therefore, the above-mentioned Z value can be used as a criterion function for judging the pros and cons of the model, and the fitness function curve established according to the rule of searching for extreme values of the particle swarm algorithm can well represent the entire algorithm iteration process.


## 3.1. Principle of the Particle Swarm Algorithm

The original of the particle swarm algorithm is that people have a lot of different behavioral studies between bird groups. The biggest feature of bird predation is that it can quickly search for a range of predation between similar groups and between groups. Certain sharing of food information is conducive to the coevolution of individuals and groups [13]. The particle swarm algorithm corresponds to one of the solutions of each “flying” particle in space and summarizes the characteristic information of the particle with the three indicators of flight speed, position, and fitness function value and iterates the optimization according to the fitness function. The calculated value is used to judge the quality of particles. By judging the “flying” path of itself and other particles, the particle changes its position and direction to continuously find a better area, thus completing the process of continuous optimization in the global search space [20].The description of the particle swarm algorithm in the past is as follows: assume that the search space of particles inD dimension consists of N particles to form a population X=x1,x2,⋯xm, where xi=xi1,xi2,⋯xil. The fitness function is fxi. The velocity of particle i is Vi. The best position for the individual particle i to pass is Pbest. The optimal position of population X is gbest. Suppose the characteristic information of xi at time t isspeed:(2)Vit=vi1t,vi2t,⋯,viDtT,position:(3)Xit=xi1t,xi2t,⋯,xiDtT,individual optimal position:(4)Pit=pi1t,pi2t,⋯,piDtT,global optimal position:(5)Pgt=vi1t,vi2t,⋯,viDtT.Then, the speed and position information of the particle “flying” at timet+1 is
(6)vidk=wvidk−1+c1r1pidk−1−xidk−1+c2r2pgdk−1−xidk−1,xidk=xidk−1+vidk−1.Among them,vidk andxidk are the components of the velocity and position of the particle i in the kth iteration in the dth dimension, respectively; c1 and c2 are constants for adjusting the learning step length; r1 andr2 are random numbers distributed between 0,1; and ω is used to adjust the search range of the solution space. In order to keep the particles in the search range, the speed and position of the particles are generally limited to −vmax,vmax and −xmax,xmax, respectively.


## 3.2. Basic Parameter Setting of Particle Swarm

Since the particle swarm algorithm is restricted by the fixed inertia weight during the iteration process, the global search ability of the algorithm is greatly weakened. In order to prevent the particles from falling into the local optimum prematurely, this paper adopts a rule of diminishing inertia weight differential, which is calculated as follows:(7)dωdt=2ωmax−ωmintmax2·t,ω=ωmax−ωmax−ωmintmax2∙t2.ω represents the inertia weight, ωmax and ωmin are the maximum and minimum weights, tmax represents the maximum number of iterations, and t is the current number of iterations. When the value of ω is too small, the search will gradually fall into the local optimum. When the value of ω is larger, the global search ability is stronger. Therefore, according to this dynamic method, the particles can be better at the global optimum status. First, initialize the population of particles, set the initial position and initial speed of the particle population randomly, and set the number of populations to N (the setting of p and q in the ARMA model by particle swarm). After many experiments, it is found that the initial set number of populations has no great influence on the iterative results of particle swarm optimization. Therefore, in order to simplify and save the iteration time, this paper chooses the number of populations N=50, for the selection of learning factors c1,c2, generally c1=c2=2.


## 3.3. Determination of Fitness Function

For a time series model, if you want to evaluate the pros and cons of the combined model, you need to judge the accuracy of the model’s prediction results. The higher the accuracy of the prediction, the more reasonable the model is. In the actual electricity consumption forecast, usually for the observable time series, model according to its part and use the remaining part of the data to verify. If the difference between the predicted value and the true value is small, it means that the model is more accurate. Otherwise, it means that the model has a large error and needs to be remodeled. Therefore, the difference between the predicted value and the true value can be used as a criterion for judging whether the model is correct. Therefore, according to this criterion, the square sum of the difference between the predicted value and the actual value is established. The smaller the value change obtained, the more appropriate the model, which is defined as(8)Z=∑i=1Ny∧i−yi2,where y^i is the predicted value andyi is the actual value.According to formula (8), the fitness function can be constructed:
(9)fx=1Z.It can be seen from formula (9) that the smaller the change value Z, the more ideal the predicted effect. When Z=0, it means that the ARMAp,q model is the best prediction model, and the prediction effect is the best. Therefore, the above-mentioned Z value can be used as a criterion function for judging the pros and cons of the model, and the fitness function curve established according to the rule of searching for extreme values of the particle swarm algorithm can well represent the entire algorithm iteration process.


## 4. ARMA-SVR Model

### 4.1. ARMA Fitting

Time series model research is based on linearity. Usually in statistics, a set of random variablesX1,X2,⋯,Xt,⋯ arranged in time is often used to represent a time series of random events, abbreviated asXt,t∈T or Xt. When the system response Xt at time t is not only related to its own value at the previous time but also related to the interference before entering the system, then we can define this system as an autoregressive moving average system, and its mathematical model is recorded as ARMAp,q:
(10)xt=φ0+φ1xt−1+⋯+φpxt−p+εt+θ1εt−1+θ2εt−2⋯+θqεt−qφp≠0,θq≠0,Eεt=0,Varεt=σε2,Eεtεs=0,s≠tExsεt,=0,∀s<t,where the real parameter φi1≤i≤n is the autoregressive coefficient, the real parameter θj1≤j≤m is the moving average coefficient, and εt is the white noise sequence. If φ0=0, this model serves as a centralized ARMAp,q model. In particular, when q=0, the ARMAp,q model becomes the ARp model. When p=0, the ARMAp,q model becomes the MAq model. The construction of the above model mainly includes the following steps:Step 1.
Data preprocessing. Due to the characteristics of the ARMA model, we need to preprocess the current time series before modeling, so that the data is in a stable trend, and then, the next forecast can be made. This requires us to use the differential method to perform differential processing on the data from the first order to obtain the comparison result of the initial data and the first-order difference as shown in Figure2. The data is finally in a stable state.Step 2.
Model the order. In this paper, particle swarm optimization is mainly used for self-adaptive optimization. To further determine the self-regression orderp and sliding average number of items q in the ARMA model, this process involves ensuring that the particles reach a global optimal solution. Therefore, the exhaustive method is used to verify the results.Step 3.
Parameter estimation. The commonly used parameter estimation methods mainly include the least square method, moment estimation method, and maximum likelihood estimation method. Each of these methods has its advantages and disadvantages. Generally, we use the moment estimation method for low-order models, and the calculation of the maximum likelihood estimation method is too complicated. Therefore, this paper adopts the least square method with higher accuracy and wider application and directly calls the armax function in MATLAB to estimate the parameters.Step 4.
Test the model. For the test of the ARMA model, we generally check the residual series by the white noise test according to the theoretical method, but the actual calculation process of the model is very cumbersome, so the test of the rationality of the model is passed. The final predicted value is compared with the actual value. If the model is established, the model needs to be remodeled.Figure 2
Comparison of initial data distribution and first-order difference.


### 4.2. SVR Concept

The support vector machine was initially mainly used in linear problems such as binary classification, and the sample points were divided into two parts as much as possible by finding a hyperplane. A model that is often used in the problem of SVM vector regression is the SVR model [21], so the core technique of SVM is also applicable to the SVR model. After raising the dimensionality of the data to a high-dimensional space, a linear decision function is constructed. Through this decision function, we can realize the linear regression of the equation and replace the nonlinear part of the equation with the kernel function to solve the problem between the nonlinear regression and the dimension [22].Set a training setD of sample data:
(11)D=x1,y1,x2,y2,x3,y3⋯xn,yn,yi∈R.In the above data set, by mappingx to the high-dimensional feature space through a nonlinear mapping function ϕx, this regression equation can be written as
(12)fx,y=ω∙ϕx+b.In the formula,ω is a constant vector, which determines the direction of the hyperplane, and b is the displacement, which determines the distance between the hyperplane and the origin.


### 4.3. Regression Model Algorithm

The SVR model has a regional “spacing zone” boundary at each end of the linear function. Samples falling within this range do not need to calculate the loss but only need to calculate the loss value outside the boundary. Therefore, the purpose of the application of the SVR model for regression is mainly to put the sample distribution within the deviation rangeε as much as possible and describe the SVR model by formulas (13) and (14):
(13)minw,b12w2+C∑i=1nfxi−yis.t.fxi−yi≤ε.In the formula,C represents the penalty coefficient, which is generally a constant. By introducing the slack variables ξ and ξ‘, then this formula can be transformed into
(14)minw,b,ξi,ξi‘12w2+C∑i=1nξi+ξi′,(15)s.t.fxi−yi≤ε+ξiyi−fxi≤ε+ξi′ξi≥0.ξi′≥0,i=1,2⋯,n.According to the above problem, the Lagrangian equation can be established and the dual problem can be solved very well.(16)fx=∑i=1nαi′−αiϕxiTϕxj+b.In the above formula,αi′ and αi are both Lagrange multipliers.


### 4.4. SVR Residual Correction

Since the initial original data is randomly distributed, the residual of the ARMA model contains some other random items with interference information when it is generated. In order to correct and optimize the residual generated by the ARMA model, we input it into the SVR regression modeling which is performed in the model. The residual optimization modeling steps of ARMA-SVR are as follows:Step 1.
Input a training setD in the SVR model:
(17)D=x1,y1,x2,y2,⋯,xn,yn,yiϵR.In the above formula, the time node value corresponding tox is used as input; the residual value of SVR model correction corresponding to y is used as output. By mapping a kernel function into a high-dimensional space, this article uses the most commonly used Gaussian kernel function in the form
(18)ϕx=exp−x−xc22σ2.In the formula,xc is the center of the kernel function and σ is the width parameter, which controls the radial range of the function. According to the regression equation fx=ω,x+b, the sample sequence F=f1,f2,⋯,fn+m can be defined. The training fit data is FT¯ = fT1,fT2,⋯,fTn. The forecast data is FP¯ = fP1,fP2,⋯,fpm.Step 2.
There is a setting for the parameters and deviation range of the SVR model. According to the kernel function equation defined in the previous step, when the center of the kernel functionxc is very close to the value of x, then the value of the kernel function is 1. When xc is far from x, the value of the kernel function is 0. According to experience, the parameter value of the penalty coefficient is 0.01≤C≤1000. The value range of the insensitivity coefficient ε is 0.01≤ε≤1. Choose the mean square error (MSE) of the calculation result as the fitness function. Use the PSO algorithm to iteratively optimize the penalty coefficient C and the insensitivity coefficient ε in the SVR model. Then, find the optimal parameters to predict and correct the residual.Step 3.
Calculate the residual error of the sample after data training based on the established ARMA modelET=F−FT¯. From the start time of the residual sequence, train 70% of the data in the residual sequence and use the regression prediction method of the SVR model to predict the remaining 30% of the data to obtain a new residual sequence EP.Step 4.
Obtain the final short-term electricity consumption load forecasting sequenceFP; then, the ARMA-SVR combined model for residual forecasting expression is
(19)FP=FP¯+EP.


## 4.1. ARMA Fitting

Time series model research is based on linearity. Usually in statistics, a set of random variablesX1,X2,⋯,Xt,⋯ arranged in time is often used to represent a time series of random events, abbreviated asXt,t∈T or Xt. When the system response Xt at time t is not only related to its own value at the previous time but also related to the interference before entering the system, then we can define this system as an autoregressive moving average system, and its mathematical model is recorded as ARMAp,q:
(10)xt=φ0+φ1xt−1+⋯+φpxt−p+εt+θ1εt−1+θ2εt−2⋯+θqεt−qφp≠0,θq≠0,Eεt=0,Varεt=σε2,Eεtεs=0,s≠tExsεt,=0,∀s<t,where the real parameter φi1≤i≤n is the autoregressive coefficient, the real parameter θj1≤j≤m is the moving average coefficient, and εt is the white noise sequence. If φ0=0, this model serves as a centralized ARMAp,q model. In particular, when q=0, the ARMAp,q model becomes the ARp model. When p=0, the ARMAp,q model becomes the MAq model. The construction of the above model mainly includes the following steps:Step 1.
Data preprocessing. Due to the characteristics of the ARMA model, we need to preprocess the current time series before modeling, so that the data is in a stable trend, and then, the next forecast can be made. This requires us to use the differential method to perform differential processing on the data from the first order to obtain the comparison result of the initial data and the first-order difference as shown in Figure2. The data is finally in a stable state.Step 2.
Model the order. In this paper, particle swarm optimization is mainly used for self-adaptive optimization. To further determine the self-regression orderp and sliding average number of items q in the ARMA model, this process involves ensuring that the particles reach a global optimal solution. Therefore, the exhaustive method is used to verify the results.Step 3.
Parameter estimation. The commonly used parameter estimation methods mainly include the least square method, moment estimation method, and maximum likelihood estimation method. Each of these methods has its advantages and disadvantages. Generally, we use the moment estimation method for low-order models, and the calculation of the maximum likelihood estimation method is too complicated. Therefore, this paper adopts the least square method with higher accuracy and wider application and directly calls the armax function in MATLAB to estimate the parameters.Step 4.
Test the model. For the test of the ARMA model, we generally check the residual series by the white noise test according to the theoretical method, but the actual calculation process of the model is very cumbersome, so the test of the rationality of the model is passed. The final predicted value is compared with the actual value. If the model is established, the model needs to be remodeled.Figure 2
Comparison of initial data distribution and first-order difference.


## 4.2. SVR Concept

The support vector machine was initially mainly used in linear problems such as binary classification, and the sample points were divided into two parts as much as possible by finding a hyperplane. A model that is often used in the problem of SVM vector regression is the SVR model [21], so the core technique of SVM is also applicable to the SVR model. After raising the dimensionality of the data to a high-dimensional space, a linear decision function is constructed. Through this decision function, we can realize the linear regression of the equation and replace the nonlinear part of the equation with the kernel function to solve the problem between the nonlinear regression and the dimension [22].Set a training setD of sample data:
(11)D=x1,y1,x2,y2,x3,y3⋯xn,yn,yi∈R.In the above data set, by mappingx to the high-dimensional feature space through a nonlinear mapping function ϕx, this regression equation can be written as
(12)fx,y=ω∙ϕx+b.In the formula,ω is a constant vector, which determines the direction of the hyperplane, and b is the displacement, which determines the distance between the hyperplane and the origin.


## 4.3. Regression Model Algorithm

The SVR model has a regional “spacing zone” boundary at each end of the linear function. Samples falling within this range do not need to calculate the loss but only need to calculate the loss value outside the boundary. Therefore, the purpose of the application of the SVR model for regression is mainly to put the sample distribution within the deviation rangeε as much as possible and describe the SVR model by formulas (13) and (14):
(13)minw,b12w2+C∑i=1nfxi−yis.t.fxi−yi≤ε.In the formula,C represents the penalty coefficient, which is generally a constant. By introducing the slack variables ξ and ξ‘, then this formula can be transformed into
(14)minw,b,ξi,ξi‘12w2+C∑i=1nξi+ξi′,(15)s.t.fxi−yi≤ε+ξiyi−fxi≤ε+ξi′ξi≥0.ξi′≥0,i=1,2⋯,n.According to the above problem, the Lagrangian equation can be established and the dual problem can be solved very well.(16)fx=∑i=1nαi′−αiϕxiTϕxj+b.In the above formula,αi′ and αi are both Lagrange multipliers.


## 4.4. SVR Residual Correction

Since the initial original data is randomly distributed, the residual of the ARMA model contains some other random items with interference information when it is generated. In order to correct and optimize the residual generated by the ARMA model, we input it into the SVR regression modeling which is performed in the model. The residual optimization modeling steps of ARMA-SVR are as follows:Step 1.
Input a training setD in the SVR model:
(17)D=x1,y1,x2,y2,⋯,xn,yn,yiϵR.In the above formula, the time node value corresponding tox is used as input; the residual value of SVR model correction corresponding to y is used as output. By mapping a kernel function into a high-dimensional space, this article uses the most commonly used Gaussian kernel function in the form
(18)ϕx=exp−x−xc22σ2.In the formula,xc is the center of the kernel function and σ is the width parameter, which controls the radial range of the function. According to the regression equation fx=ω,x+b, the sample sequence F=f1,f2,⋯,fn+m can be defined. The training fit data is FT¯ = fT1,fT2,⋯,fTn. The forecast data is FP¯ = fP1,fP2,⋯,fpm.Step 2.
There is a setting for the parameters and deviation range of the SVR model. According to the kernel function equation defined in the previous step, when the center of the kernel functionxc is very close to the value of x, then the value of the kernel function is 1. When xc is far from x, the value of the kernel function is 0. According to experience, the parameter value of the penalty coefficient is 0.01≤C≤1000. The value range of the insensitivity coefficient ε is 0.01≤ε≤1. Choose the mean square error (MSE) of the calculation result as the fitness function. Use the PSO algorithm to iteratively optimize the penalty coefficient C and the insensitivity coefficient ε in the SVR model. Then, find the optimal parameters to predict and correct the residual.Step 3.
Calculate the residual error of the sample after data training based on the established ARMA modelET=F−FT¯. From the start time of the residual sequence, train 70% of the data in the residual sequence and use the regression prediction method of the SVR model to predict the remaining 30% of the data to obtain a new residual sequence EP.Step 4.
Obtain the final short-term electricity consumption load forecasting sequenceFP; then, the ARMA-SVR combined model for residual forecasting expression is
(19)FP=FP¯+EP.


## 5. Experimental Research on Short-Term Electricity Consumption Forecast

### 5.1. Electricity Data Collection and Access

For the power load forecasting system, different structured data and unstructured data should be collected from an important aspect of the system—the data collection layer. Once the data center is configured, the data is automatically collected to the cloud. As shown in Figure3, the user’s load data is collected through a trigger-type smart meter. This type of smart meter generally uses the HT5019 chip as the measurement chip, and the collection frequency is generally 15 minutes. It can be connected with LORA, 4G, Wi-Fi, etc. Other submeters, terminals, and servers are connected to give full play to the role of the data collection layer and then actively upload the collected load power data to the cloud. The power load forecasting system obtains electricity consumption information mostly by using the electricity consumption, voltage value, current value, real-time power, etc. collected by smart meters. By querying the weather port, it can also obtain data information about weather, temperature, and seasons.Figure 3
Intelligent meter data acquisition device.The research object of this paper selects the electricity load data of 210 residents in a residential area in Guangdong Province to conduct experiments. Through the method of ARMA modeling and SVR residual correction method, we combined the forecast of the work load data of 103 weeks from 2016 to 2017.This experiment was completed in the simulation environment of MATLAB 2018a. After the required data was collected, the data was reasonably selected by analyzing the distribution law of the sample data. At the same time, abnormal points should be processed according to the previous and next moments. Data with a large difference is regarded as an abnormal point. For missing data, replace the average of several similar daily load data based on the periodic characteristics of electricity usage. Further build the particle swarm algorithm to find the optimal parameters to build the ARMA model for load forecasting. Finally, the difference between the predicted data and the true value of the verification set data is made to obtain the predicted error value. The residual sequence is introduced into the SVR vector regression as the input variable, and the residual correction value of the ARMA model is obtained. Finally, the sum of the ARMA predicted value and the SVR residual correction value is used as the final weekly load forecast result. The combined prediction model was compared with a single ARMA model, SVR model, and SVR-ARMA model, and the performance evaluation results of the combined prediction model were obtained.


### 5.2. ARMA-SVR Model Experimental Results and Analysis Based on the Particle Swarm Algorithm

The ARMA model has the characteristics of stability when predicting. Usually, we need to test the stationarity of the data first. If the original data is in a random distribution state, then the data must be processed by multiorder difference until it is in a stable state. Referring to electricity usage rules, Figure4 shows the weekly load data distribution map of a residential area from 2016 to 2017. By observing the data distribution status of the map, it can be seen that the data has a large range of changes and presents a periodic distribution law.Figure 4
Trend chart of original power consumption of weekly load.By performing the first-order difference change on the data as shown in Figure5, it can be observed that its distribution fluctuates roughly above and below the mean. After passing the ADF test, it can be determined that the time series is first-order difference stationary.Figure 5
First-order difference curve of weekly load data.The optimal model results obtained after 40 iterations of the particle swarm algorithm are shown in Table1.Table 1
Optimization results of the ARMA model.
Number of iterations123456…50Autoregressive orderp333442…2Moving average coefficientq766667…7It can be concluded from Table1 that the final region of the iteration process is stable, and the curve of evolutionary algebra and objective function is shown in Figure 6.Figure 6
The relationship between evolutionary algebra and objective function.As can be seen from the above figure, as the evolutionary algebra gradually increases, the optimal value of the objective function gradually tends to be in a stable state, indicating that the solution at this time is the optimal solution; then,ARMA2,7 can be used as the optimal model to make predictions.The optimalARMA2,7 model obtained after applying the particle swarm to determine the order is used to simulate the electricity consumption data of 103 households from 2016 to 2017, select 70% of the sample data for training, and use 30% of the data as the verification set; its simulated trend chart is shown in Figure 7.Figure 7
Comparison of the ARMA model predicted value and actual value trend.The SVR model is established based on the residual data of the ARMA prediction results, and the input data is divided into two parts using the hold-out method. One part is used as the training set (about 70%), and the other part is used as the test set (about 30%) for verification. The SVR model prediction value and actual value trend comparison chart of the residual data is shown in Figure8.Figure 8
Comparison between predicted and actual residual values of SVR model.The PSO-ARMA-SVR combined forecasting model proposed in this paper is used to predict the weekly load data of 103 residents in a community. The forecast results are shown in Table2. It can be seen from the table that the residual correction value in the SVR prediction model is the correction result of the residual value generated by the ARMA model, and the prediction value of the combined model is the sum of the prediction value of the ARMA prediction model and the SVR residual correction value. It can be seen from the table that the prediction error of the combined model is smaller than that of the single ARMA model. The maximum error is 374.85 kWh, and the minimum error is only 1.52 kWh, indicating that the combined prediction model is more effective.Table 2
Load forecasting results of the PSO-ARMA-SVR combined model.
TimeActual weekly load (kWh)ARMA predictive modelSVR predictive modelPSO-ARMA-SVR combined forecasting modelARMA predictive value (kWh)Generated residual values (kWh)Residual correction value (kWh)Combined forecast (kWh)Relative error percentage110311.979775.45-536.52-590.4410365.890.52%214413.5318795.084381.554098.2914696.791.97%310588.257710.82-2877.43-2679.8510390.681.87%412814.4113623.62809.21477.9413145.672.59%512142.7912155.7812.99175.5111980.271.34%614913.2016061.391148.191208.3614853.040.40%715691.7316630.35938.62745.6415884.711.23%817136.4617815.82679.36664.3617151.450.09%917461.9916473.99-988.00-1131.8417605.820.82%1014380.1412203.63-2176.51-2150.1114353.740.18%1111806.717565.42-4241.29-3983.8211548.422.19%1211219.5710607.95-611.62-362.1310970.082.22%1313592.1614522.68930.52796.6813726.000.98%1414434.9115302.29867.38729.5614572.740.95%1514059.9313014.50-1045.43-1035.2114049.710.07%1613227.4113906.55679.14660.3613246.190.14%1710718.829663.97-1054.85-1429.6911093.673.50%185818.273018.05-2800.22-2768.485786.610.54%196151.676240.1188.4496.576143.540.13%205956.746811.51854.77160.826050.631.58%215859.835140.24-719.59-751.245891.480.54%224732.724440.30-292.42-290.904731.200.03%235868.396933.941065.561106.775827.170.70%245754.717310.601555.89983.475851.921.69%255747.346525.16777.82689.015836.071.54%265164.245158.25-6.01-135.805294.032.51%276081.697066.28984.59597.736168.531.43%285793.726227.32433.60153.395773.930.34%


### 5.3. Comparative Analysis

In order to verify the prediction accuracy of the PSO-ARMA-SVR combined prediction model used in this article, the prediction values of the three models of ARMA, SVR, and SVR-ARMA were established for comparison. The initial values and parameter settings of each model were compared with PSO-ARMA-SVR. The ARMA-SVR models are all the same, and the prediction comparison results are shown in Figure9.Figure 9
Comparison of predicted values.Through the comparison and analysis of the prediction results of the four prediction models in the figure, it can be seen that the PSO-ARMA-SVR combined prediction model proposed in this paper has the highest degree of agreement with the actual value, indicating that the model has good fitting performance. In order to test the model, according to the quality, the error value of the fitting was studied, and the result is shown in Figure10.Figure 10
Comparison chart of prediction error percentage.From the comparison of the four types of prediction errors in the figure, it can be seen that the prediction effects of the ARMA model and the SVR model are relatively poor, and the prediction accuracy of the combined prediction model is significantly higher than that of the single prediction model. The error fitting curve of the PSO-ARMA-SVR combined prediction model proposed in this paper tends to be 0, and the prediction deviation drops to 0.03%. The 28 periods of data in the figure are compared to the average prediction of each period of the combined model SVR-ARMA. The performance increased by 0.95%, indicating that the combined model constructed in this paper is more effective for load forecasting and the forecasting effect is relatively better.


## 5.1. Electricity Data Collection and Access

For the power load forecasting system, different structured data and unstructured data should be collected from an important aspect of the system—the data collection layer. Once the data center is configured, the data is automatically collected to the cloud. As shown in Figure3, the user’s load data is collected through a trigger-type smart meter. This type of smart meter generally uses the HT5019 chip as the measurement chip, and the collection frequency is generally 15 minutes. It can be connected with LORA, 4G, Wi-Fi, etc. Other submeters, terminals, and servers are connected to give full play to the role of the data collection layer and then actively upload the collected load power data to the cloud. The power load forecasting system obtains electricity consumption information mostly by using the electricity consumption, voltage value, current value, real-time power, etc. collected by smart meters. By querying the weather port, it can also obtain data information about weather, temperature, and seasons.Figure 3
Intelligent meter data acquisition device.The research object of this paper selects the electricity load data of 210 residents in a residential area in Guangdong Province to conduct experiments. Through the method of ARMA modeling and SVR residual correction method, we combined the forecast of the work load data of 103 weeks from 2016 to 2017.This experiment was completed in the simulation environment of MATLAB 2018a. After the required data was collected, the data was reasonably selected by analyzing the distribution law of the sample data. At the same time, abnormal points should be processed according to the previous and next moments. Data with a large difference is regarded as an abnormal point. For missing data, replace the average of several similar daily load data based on the periodic characteristics of electricity usage. Further build the particle swarm algorithm to find the optimal parameters to build the ARMA model for load forecasting. Finally, the difference between the predicted data and the true value of the verification set data is made to obtain the predicted error value. The residual sequence is introduced into the SVR vector regression as the input variable, and the residual correction value of the ARMA model is obtained. Finally, the sum of the ARMA predicted value and the SVR residual correction value is used as the final weekly load forecast result. The combined prediction model was compared with a single ARMA model, SVR model, and SVR-ARMA model, and the performance evaluation results of the combined prediction model were obtained.


## 5.2. ARMA-SVR Model Experimental Results and Analysis Based on the Particle Swarm Algorithm

The ARMA model has the characteristics of stability when predicting. Usually, we need to test the stationarity of the data first. If the original data is in a random distribution state, then the data must be processed by multiorder difference until it is in a stable state. Referring to electricity usage rules, Figure4 shows the weekly load data distribution map of a residential area from 2016 to 2017. By observing the data distribution status of the map, it can be seen that the data has a large range of changes and presents a periodic distribution law.Figure 4
Trend chart of original power consumption of weekly load.By performing the first-order difference change on the data as shown in Figure5, it can be observed that its distribution fluctuates roughly above and below the mean. After passing the ADF test, it can be determined that the time series is first-order difference stationary.Figure 5
First-order difference curve of weekly load data.The optimal model results obtained after 40 iterations of the particle swarm algorithm are shown in Table1.Table 1
Optimization results of the ARMA model.
Number of iterations123456…50Autoregressive orderp333442…2Moving average coefficientq766667…7It can be concluded from Table1 that the final region of the iteration process is stable, and the curve of evolutionary algebra and objective function is shown in Figure 6.Figure 6
The relationship between evolutionary algebra and objective function.As can be seen from the above figure, as the evolutionary algebra gradually increases, the optimal value of the objective function gradually tends to be in a stable state, indicating that the solution at this time is the optimal solution; then,ARMA2,7 can be used as the optimal model to make predictions.The optimalARMA2,7 model obtained after applying the particle swarm to determine the order is used to simulate the electricity consumption data of 103 households from 2016 to 2017, select 70% of the sample data for training, and use 30% of the data as the verification set; its simulated trend chart is shown in Figure 7.Figure 7
Comparison of the ARMA model predicted value and actual value trend.The SVR model is established based on the residual data of the ARMA prediction results, and the input data is divided into two parts using the hold-out method. One part is used as the training set (about 70%), and the other part is used as the test set (about 30%) for verification. The SVR model prediction value and actual value trend comparison chart of the residual data is shown in Figure8.Figure 8
Comparison between predicted and actual residual values of SVR model.The PSO-ARMA-SVR combined forecasting model proposed in this paper is used to predict the weekly load data of 103 residents in a community. The forecast results are shown in Table2. It can be seen from the table that the residual correction value in the SVR prediction model is the correction result of the residual value generated by the ARMA model, and the prediction value of the combined model is the sum of the prediction value of the ARMA prediction model and the SVR residual correction value. It can be seen from the table that the prediction error of the combined model is smaller than that of the single ARMA model. The maximum error is 374.85 kWh, and the minimum error is only 1.52 kWh, indicating that the combined prediction model is more effective.Table 2
Load forecasting results of the PSO-ARMA-SVR combined model.
TimeActual weekly load (kWh)ARMA predictive modelSVR predictive modelPSO-ARMA-SVR combined forecasting modelARMA predictive value (kWh)Generated residual values (kWh)Residual correction value (kWh)Combined forecast (kWh)Relative error percentage110311.979775.45-536.52-590.4410365.890.52%214413.5318795.084381.554098.2914696.791.97%310588.257710.82-2877.43-2679.8510390.681.87%412814.4113623.62809.21477.9413145.672.59%512142.7912155.7812.99175.5111980.271.34%614913.2016061.391148.191208.3614853.040.40%715691.7316630.35938.62745.6415884.711.23%817136.4617815.82679.36664.3617151.450.09%917461.9916473.99-988.00-1131.8417605.820.82%1014380.1412203.63-2176.51-2150.1114353.740.18%1111806.717565.42-4241.29-3983.8211548.422.19%1211219.5710607.95-611.62-362.1310970.082.22%1313592.1614522.68930.52796.6813726.000.98%1414434.9115302.29867.38729.5614572.740.95%1514059.9313014.50-1045.43-1035.2114049.710.07%1613227.4113906.55679.14660.3613246.190.14%1710718.829663.97-1054.85-1429.6911093.673.50%185818.273018.05-2800.22-2768.485786.610.54%196151.676240.1188.4496.576143.540.13%205956.746811.51854.77160.826050.631.58%215859.835140.24-719.59-751.245891.480.54%224732.724440.30-292.42-290.904731.200.03%235868.396933.941065.561106.775827.170.70%245754.717310.601555.89983.475851.921.69%255747.346525.16777.82689.015836.071.54%265164.245158.25-6.01-135.805294.032.51%276081.697066.28984.59597.736168.531.43%285793.726227.32433.60153.395773.930.34%


## 5.3. Comparative Analysis

In order to verify the prediction accuracy of the PSO-ARMA-SVR combined prediction model used in this article, the prediction values of the three models of ARMA, SVR, and SVR-ARMA were established for comparison. The initial values and parameter settings of each model were compared with PSO-ARMA-SVR. The ARMA-SVR models are all the same, and the prediction comparison results are shown in Figure9.Figure 9
Comparison of predicted values.Through the comparison and analysis of the prediction results of the four prediction models in the figure, it can be seen that the PSO-ARMA-SVR combined prediction model proposed in this paper has the highest degree of agreement with the actual value, indicating that the model has good fitting performance. In order to test the model, according to the quality, the error value of the fitting was studied, and the result is shown in Figure10.Figure 10
Comparison chart of prediction error percentage.From the comparison of the four types of prediction errors in the figure, it can be seen that the prediction effects of the ARMA model and the SVR model are relatively poor, and the prediction accuracy of the combined prediction model is significantly higher than that of the single prediction model. The error fitting curve of the PSO-ARMA-SVR combined prediction model proposed in this paper tends to be 0, and the prediction deviation drops to 0.03%. The 28 periods of data in the figure are compared to the average prediction of each period of the combined model SVR-ARMA. The performance increased by 0.95%, indicating that the combined model constructed in this paper is more effective for load forecasting and the forecasting effect is relatively better.


## 6. Conclusion

With the increasing demand for electricity consumption in cities, the state grid has become increasingly in demand for accurate electricity consumption distribution and dispatch. Based on the traditional ARMA prediction model, this paper establishes a PSO-ARMA-SVR combined prediction model combining linear and nonlinear features to achieve accurate prediction of short-term electricity consumption in residential areas. The ARMA model is constructed by building a particle swarm algorithm. A new method of order determination, by optimizing the parametersC and ε in the SVR, realizes the correction of the ARMA prediction residual value in the SVR regression prediction model, improves the accuracy of the prediction model, and reduces the prediction deviation to 0.03%. The PSO-ARMA-SVR model proposed in this paper is evaluated based on the prediction results and the percentage of data errors after data fitting, which proves that the method has outstanding performance in load forecasting and provides a new idea for future research, having good application prospects.



---

*Source: 6691537-2021-02-25.xml*