# Intelligent Prediction Method of Building Energy Consumption Based on Deep Learning

Authors: Bingqian Fan; Xuanxuan Xing
Journal: Scientific Programming
 (2021)

---

## Abstract

Building energy consumption prediction plays an important role in realizing building energy conservation control. Limited by some external factors such as temperature, there are some problems in practical applications, such as complex operation and low prediction accuracy. Aiming at the problem of low prediction accuracy caused by poor timing of existing building energy consumption prediction methods, a building energy consumption prediction and analysis method based on the deep learning network is proposed in this paper. Before establishing the energy consumption prediction model, the building energy consumption data source is preprocessed and analyzed. Then, based on the Keras deep learning framework, an improved long short-term memory (ILSTM) prediction model is built to support the accurate analysis of the whole cycle of the prediction network. At the same time, the adaptive moment (Adam) estimation algorithm is used to update and optimize the weight parameters of the model to realize the adaptive and rapid update and matching of network parameters. The simulation experiment is based on the actual dataset collected by a university in Southwest China. The experimental results show that the evaluation indexes MAE and RMSE of the proposed method are 0.015 and 0.109, respectively, which are better than the comparison method. The simulation experiment proves that the proposed method is feasible.


---

## Body

## 1. Introduction

With the advent of the twenty-first century, China has officially entered a period of rapid economic development. Due to the continuous growth of the population, the problem of energy consumption has become increasingly serious [1]. At present, in the field of energy consumption in China, the energy consumption in the building sector ranks second, accounting for about 30%, only to industrial energy consumption. Among them, the construction area of large public buildings only accounts for 4% of the total construction area of the country, while its electricity consumption accounts for as much as 22%.As the consumption of public buildings increases year by year, it plays a vital role in carbon emissions [2–4]. Among the energy consumption of large-scale public buildings in my country, the energy consumption of public buildings in colleges and universities occupies a considerable part. Colleges and universities are important places for scientific research and learning, but with the increase in the number of colleges and universities, as well as the increase in the number of teachers and students, the issue of high-efficiency building energy consumption has attracted more and more attention [5, 6]. Therefore, an accurate prediction of high-efficiency energy consumption has become a hot topic. Constructing a reliable and efficient energy optimization forecasting model can realize the optimal control and management of building energy. It is of great significance for improving the environment and alleviating energy shortages [7].Building energy consumption prediction plays an important role in realizing building energy efficiency management and control, building energy efficiency strategy formulation, and energy-saving potential quantification [8, 9]. Traditional building energy prediction methods are mainly based on physical modeling. Building energy consumption prediction models based on physical models use the principles of building thermophysics to predict building energy consumption, and their prediction results often have good interpretability. However, this method requires detailed building physical parameters and environmental parameters and other detailed information [10, 11] and is also limited by some external factors such as temperature. In the actual application process, there are problems such as complicated operation and low prediction accuracy.The widespread application of the Internet of Things technology in intelligent buildings provides new solutions for building energy consumption prediction, combining the building's terminal heterogeneous sensors with the building automation control platform [12]. Mass sensors provide multidimensional and reliable data support for automated platform analysis through continuous situational awareness of intelligent buildings [13]. The autonomous control platform is based on the deep learning network to complete the effective prediction of building energy consumption [14–16]. At present, some scholars have carried out research and analysis on building energy consumption based on the data-driven method of the deep network. Chen et al. [17] improved the neural network and introduced the adaptive weighted particle swarm algorithm into the prediction network to achieve the effective prediction of building energy consumption. Fu et al. [18] proposed a building energy consumption prediction method based on the deep neural network and transfer reinforcement learning. The stack denoising autoencoder is introduced to extract the deep features of building energy consumption, and the hidden layer structure is shared to transfer public information between different building energy issues. Huang et al. [19] combined clustering technology and neural network, the neighbor propagation clustering algorithm completed the data model construction, and the BP neural network completed energy consumption analysis and prediction, in order to achieve effective control of building energy. Reference [20] used a support vector machine model to realize energy consumption analysis based on actual collected data, which provides effective assistance to construction practitioners. The above methods adopt a data-driven approach to solve the problem of difficult modeling of physical model analysis methods to a certain extent, but it should also be pointed out that the current data-driven method ignores that building energy data are typical one-dimensional time series data [21]. However, the current method lacks consideration of the time correlation of time series data and requires the artificial addition of time features. The calculation complexity is large, and it is difficult to maintain accurate prediction and analysis throughout the entire cycle.In response to this problem, this paper proposes a new building energy loss prediction model based on ILSTM and Adam optimization algorithms to support the sustainable development of environmental resources. The paper modularizes the hidden layer nodes of the traditional LSTM network model based on clock distribution and completes the directional connection between modules according to the clock frequency from high to low so as to improve the fast calculation ability of the prediction network in different processing cycles. Finally, efficient analysis of the energy loss of efficient buildings is realized.


## 2. Time Series Prediction Problem Description and Data Analysis

Energy consumption model data have strong time difference characteristics. So, for building energy consumption prediction and analysis, it is necessary to carry out corresponding analyses based on time characteristics. The historical data of building energy consumption can reveal the law of this event over time.


### 2.1. Time Series Prediction Problem Description

This paper chooses to conduct a targeted analysis of building energy consumption in colleges and universities. The data model has the following characteristics:(1)
Long-term directionality means that in the general direction, time-series data will show an overall upward or downward or stable trend. For example, with the introduction of different large machines, the school's time series of energy consumption will steadily increase under the long-term observation. After taking certain energy-saving measures in the dormitory area, the time series of school energy consumption fluctuates and so on. It usually appears as a trend of long-term recession, long-term stagnation, or long-term stable growth.(2)
Quarterly variability means that due to quarterly changes, the time series will fluctuate cyclically, and the cycle will be relatively fixed [22]. For example, due to the relatively regular dormitory energy consumption time series formed by people's living habits, the fluctuation cycle may be daily, weekly, monthly, or even seasonal. For example, the dormitory's energy consumption is relatively low during class, and energy consumption will reach a peak at night. This kind of cyclical fluctuation of the observation time window is at least one year or more.(3)
Cyclic variability refers to the fluctuations in the time series according to some unstable cycles, such as unscheduled power outages or failures.(4)
Random variability, also known as irregular changes, refers to irregular changes that cannot be artificially predicted and cannot be determined, such as some disordered molecular movement.This article assumes that the data value of the historical time series value of energy consumption isxt,xt−1,……, and the prediction model is equivalent to estimating the value at time xt+1.For single-step time series forecasting methods and indirect multistep forecasting methods and for long-span time data forecasting, the cumulative error generated by the gradual iteration will increase the overall forecast error exponentially. For this reason, this article defines a direct multistep forecasting model that takes the historical time series value vector as the input of the model and then performs the data forecast at timet+pp>0, that is, the direct multistep forecasting method:(1)xt+p=fpxt,a.where a is the undetermined coefficient of the direct multistep prediction model.


### 2.2. Data Source and Processing

This paper uses real building energy consumption datasets as sample datasets for analysis. With an hourly granularity, the energy consumption data of multiple buildings in a college campus in the southwest from October 1, 2018, to October 1, 2020, were collected, and a total of 100,000 pieces of data were obtained.Due to problems such as equipment failure and human interference during data collection, nearly 1.25% of missing data in the dataset were collected. Missing data will affect the accuracy of prediction. Therefore, the missing data should be processed first before training. The sample mean is used to fill in the missing values in the data to avoid the loss of relevant information due to the elimination of missing values [23, 24].If you directly use the original indicators for analysis, it will highlight the role of indicators with higher values in the comprehensive analysis and weaken the role of lower values. Therefore, the data need to be standardized according to formula (2), and the data are mapped between 0 and 1. Not only can the convergence speed of the model be improved but also the impact of different data dimensions can be avoided.(2)X′=X−XminXmax−Xmin,where X′ is the processed standard data; X is the sample data before processing; Xmax is the maximum value of the sample dataset; Xmin is the minimum data in the sample dataset.


### 2.3. Data Analysis

Before establishing a time-series data analysis model, it is necessary to conduct a comprehensive exploration of the data to fully understand the data and facilitate subsequent analysis. Taking the building energy consumption data set as an example, this paper analyzes the building energy consumption dataset so as to have a more in-depth understanding of the data characteristics and quality characteristics of the dataset.Statistical analysis is performed on the distribution of energy consumption values, and the histogram of the distribution of energy consumption values is obtained, as shown in Figure1.Figure 1
Histogram of energy consumption distribution.It can be seen from Figure1 that the distribution of energy consumption values is mainly concentrated between 20 and 50. In addition, it also presents a large proportion near the value of 0, which means that the building is in a situation where the energy consumption is small or even 0 at many times (for example, in the early hours of the morning).Then, taking the energy consumption data in 2019 as an example, the energy consumption value is divided by day to calculate the total 24-hour energy consumption per day, and the annual energy consumption value statistic chart shown in Figure2 is obtained.Figure 2
Annual energy consumption statistics.It can be seen from Figure2 that during the annual winter and summer vacations (that is, January-February and June-August), the energy consumption will temporarily drop to a trough for a period of time due to the movement of people. Immediately after the temperature gradually rose from March to July, the air-conditioning electricity consumption gradually increased, and the energy consumption also increased rapidly. The law of this change mainly depends on the changes in the temperature requirements of teachers and students' daily use of electricity. From September to November, the level of energy consumption remained basically stable, and as the temperature dropped in December, the energy consumption of buildings also gradually decreased. The above phenomena all reflect that seasonal attributes and temperature attributes have a non-negligible effect on energy consumption. Therefore, when building energy consumption forecasting models, the importance of these external factors for energy consumption forecasting should be reasonably analyzed.Next, this paper draws the 24-hour average electricity consumption of three different types of buildings: administrative office buildings, student dormitories, and teaching buildings, as shown in Figure3.Figure 3
Variation curve of average energy consumption value of different building types.It can be seen from Figure3 that the average energy consumption of teaching buildings is higher than that of administrative office buildings and student dormitories. Its main energy supply is concentrated in the school period from 8 am to 22 : 00, and its energy consumption is significantly reduced in the early morning. The energy consumption of administrative buildings is mainly concentrated in the daytime, which is obviously different from dormitory buildings. This phenomenon reflects that different building types represent different energy use patterns. Therefore, when building energy consumption prediction models, we should dig deeper into the hidden information contained in different building types.


## 2.1. Time Series Prediction Problem Description

This paper chooses to conduct a targeted analysis of building energy consumption in colleges and universities. The data model has the following characteristics:(1)
Long-term directionality means that in the general direction, time-series data will show an overall upward or downward or stable trend. For example, with the introduction of different large machines, the school's time series of energy consumption will steadily increase under the long-term observation. After taking certain energy-saving measures in the dormitory area, the time series of school energy consumption fluctuates and so on. It usually appears as a trend of long-term recession, long-term stagnation, or long-term stable growth.(2)
Quarterly variability means that due to quarterly changes, the time series will fluctuate cyclically, and the cycle will be relatively fixed [22]. For example, due to the relatively regular dormitory energy consumption time series formed by people's living habits, the fluctuation cycle may be daily, weekly, monthly, or even seasonal. For example, the dormitory's energy consumption is relatively low during class, and energy consumption will reach a peak at night. This kind of cyclical fluctuation of the observation time window is at least one year or more.(3)
Cyclic variability refers to the fluctuations in the time series according to some unstable cycles, such as unscheduled power outages or failures.(4)
Random variability, also known as irregular changes, refers to irregular changes that cannot be artificially predicted and cannot be determined, such as some disordered molecular movement.This article assumes that the data value of the historical time series value of energy consumption isxt,xt−1,……, and the prediction model is equivalent to estimating the value at time xt+1.For single-step time series forecasting methods and indirect multistep forecasting methods and for long-span time data forecasting, the cumulative error generated by the gradual iteration will increase the overall forecast error exponentially. For this reason, this article defines a direct multistep forecasting model that takes the historical time series value vector as the input of the model and then performs the data forecast at timet+pp>0, that is, the direct multistep forecasting method:(1)xt+p=fpxt,a.where a is the undetermined coefficient of the direct multistep prediction model.


## 2.2. Data Source and Processing

This paper uses real building energy consumption datasets as sample datasets for analysis. With an hourly granularity, the energy consumption data of multiple buildings in a college campus in the southwest from October 1, 2018, to October 1, 2020, were collected, and a total of 100,000 pieces of data were obtained.Due to problems such as equipment failure and human interference during data collection, nearly 1.25% of missing data in the dataset were collected. Missing data will affect the accuracy of prediction. Therefore, the missing data should be processed first before training. The sample mean is used to fill in the missing values in the data to avoid the loss of relevant information due to the elimination of missing values [23, 24].If you directly use the original indicators for analysis, it will highlight the role of indicators with higher values in the comprehensive analysis and weaken the role of lower values. Therefore, the data need to be standardized according to formula (2), and the data are mapped between 0 and 1. Not only can the convergence speed of the model be improved but also the impact of different data dimensions can be avoided.(2)X′=X−XminXmax−Xmin,where X′ is the processed standard data; X is the sample data before processing; Xmax is the maximum value of the sample dataset; Xmin is the minimum data in the sample dataset.


## 2.3. Data Analysis

Before establishing a time-series data analysis model, it is necessary to conduct a comprehensive exploration of the data to fully understand the data and facilitate subsequent analysis. Taking the building energy consumption data set as an example, this paper analyzes the building energy consumption dataset so as to have a more in-depth understanding of the data characteristics and quality characteristics of the dataset.Statistical analysis is performed on the distribution of energy consumption values, and the histogram of the distribution of energy consumption values is obtained, as shown in Figure1.Figure 1
Histogram of energy consumption distribution.It can be seen from Figure1 that the distribution of energy consumption values is mainly concentrated between 20 and 50. In addition, it also presents a large proportion near the value of 0, which means that the building is in a situation where the energy consumption is small or even 0 at many times (for example, in the early hours of the morning).Then, taking the energy consumption data in 2019 as an example, the energy consumption value is divided by day to calculate the total 24-hour energy consumption per day, and the annual energy consumption value statistic chart shown in Figure2 is obtained.Figure 2
Annual energy consumption statistics.It can be seen from Figure2 that during the annual winter and summer vacations (that is, January-February and June-August), the energy consumption will temporarily drop to a trough for a period of time due to the movement of people. Immediately after the temperature gradually rose from March to July, the air-conditioning electricity consumption gradually increased, and the energy consumption also increased rapidly. The law of this change mainly depends on the changes in the temperature requirements of teachers and students' daily use of electricity. From September to November, the level of energy consumption remained basically stable, and as the temperature dropped in December, the energy consumption of buildings also gradually decreased. The above phenomena all reflect that seasonal attributes and temperature attributes have a non-negligible effect on energy consumption. Therefore, when building energy consumption forecasting models, the importance of these external factors for energy consumption forecasting should be reasonably analyzed.Next, this paper draws the 24-hour average electricity consumption of three different types of buildings: administrative office buildings, student dormitories, and teaching buildings, as shown in Figure3.Figure 3
Variation curve of average energy consumption value of different building types.It can be seen from Figure3 that the average energy consumption of teaching buildings is higher than that of administrative office buildings and student dormitories. Its main energy supply is concentrated in the school period from 8 am to 22 : 00, and its energy consumption is significantly reduced in the early morning. The energy consumption of administrative buildings is mainly concentrated in the daytime, which is obviously different from dormitory buildings. This phenomenon reflects that different building types represent different energy use patterns. Therefore, when building energy consumption prediction models, we should dig deeper into the hidden information contained in different building types.


## 3. Energy Consumption Prediction Method Based on the Improved LSTM Network Model

The LSTM network model has the function of remembering a longer time range. Based on this feature, this paper uses an improved LSTM network model to construct a building energy consumption prediction and analysis network.


### 3.1. Establishing Building Energy Consumption Prediction Model

The traditional LSTM network model has better prediction performance results than the ordinary neural network model [25]. However, the LSTM model has more parameter settings, and the training will be slower than the ordinary neural network model. Therefore, this article improves the LSTM model and proposes a predictive analysis method based on the improved LSTM (ILSTM) model. The proposed ILSTM model is shown in Figure 4, and its main features are as follows:(1)
All nodes in the hidden layer are divided into several modules, and each module is allocated with different clock cycles to independently manage the update time.(2)
The hidden layer of the RNN is connected to each other. Although the interior is fully connected, the modules are directional. The intermodule connection will point from the high-clock frequency to the low-clock frequency module.Figure 4
Forward propagation matrix of the ILSTM model.Each time the weight is updated, LSTM has 7 weight matrices that need to be updated each time, and the length of each matrix is the number of hidden layer nodes. This article separates the hidden layer nodes into different modules. During operation, a part of the modules will be selected to participate in the operation, and the modules not participating in the operation will be set to 0. One of the weight matrices is similar to the other weight matrices:(3)Wiw=wiw,1wiw,2…wiw,n.The update formula will be as follows:(4)Wiw=WiwfortMODTi=00otherwise.Among them, the model definitionTi=2i−1 based on energy consumption prediction, and the feedforward formula mechanism of the output gate will be formed, and other formulas are similar:Such a mechanism can guarantee that the nodes in the first module will always participate in the calculation. As the training time increases, the number of modules involved in the operation will increase; that is, modules with higher clock frequencies will only participate in the operation at a later time during training. The update of different modules at different times will be as shown in Figure5. The red star symbol indicates the module that will participate in the operation at the current moment.Figure 5
ILSTM model update diagram.The reason is that the short-range information needs to be updated frequently, which will be handed over to the low-clock frequency module for the main processing. For long-distance information, the main processing is performed by the high-clock cycle module. Under such a mechanism, different modules have different functions and divisions of labor, and different information of long and short distances can be handled well.In terms of time complexity, the time complexity of the ILSTM model that combines the advantages of the LSTM model will also be lower than that of the LSTM model. This is because each time the parameters are updated, partial updates are selected instead of all updates. In short, the training time of the ILSTM model is shorter than that of the LSTM model, which makes up for the shortcomings of the long training time of the LSTM model.At the same time, this paper builds an ILSTM analysis network model based on the Keras framework. Keras is a deep learning framework based on the Python language that can run on TensorFlow, CNTK, or Theano. It has the advantages of open source and strong scalability, and its development focus is to achieve rapid experiments. The structure of the ILSTM prediction model is shown in Figure6. Among them, xt and yt are the input and output of the time model, respectively.Figure 6
Structure diagram of ILSTM building energy consumption prediction model.The hidden layer of the ILSTM unit uses 150 neurons and defines the dimensions of the input data. Then, the Adam optimization algorithm is used to optimize and update the parameters of the model. The dropout layer randomly closes some neurons in each iteration, and as the iteration progresses, any neuron may be closed. Therefore, neurons become less sensitive to the activation of other specific neurons. It can reduce the complex coadaptation relationship between neurons, effectively alleviate the occurrence of overfitting, and achieve the effect of regularization to a certain extent. Its various parameters are shown in Table1.Table 1
Parameters of building energy consumption prediction model.
ParameterValueNumber of hidden layer neurons150Dropout0.15Learning rate0.015Attenuation coefficientβ10.85Attenuation coefficientβ21.0


### 3.2. Optimization Algorithm

For a multilayer predictive network model, the calculated network weight parameters are quickly and accurately updated, which can effectively improve the prediction accuracy and speed of the energy consumption model.The traditional stochastic gradient descent (SGD) algorithm only uses one sample of the dataset to update the network parameters each time. If the sample is noisy or outliers, it will make SGD unable to update towards the global optimal solution, which will easily cause the model to not converge.Adam is a learning rate-adaptive optimization algorithm that combines the advantages of the momentum algorithm and the root-mean-square backpropagation algorithm. It can automatically search the learning rate and efficiently search the parameter space. It can replace the traditional gradient descent stochastic algorithm for weight parameters. Optimization is updated. The Adam algorithm has high computational efficiency and low memory requirements, which is very suitable for problems with large data or parameters. The specific optimization process is as follows:Step 1:
set the initial learning rateα to 0.015, the first-order moment estimated attenuation coefficient β1 to 0.85, and the second-order moment estimated attenuation coefficient β2 to 1.0Step 2:
calculate the gradientgt of the objective function(5)gt=∇θftθt−1,Among them,ftθt−1 is the objective function; θt−1 is the network parameter weight at time step t−1.Step 3:
calculate the first-order moment estimationmt and the second-order moment estimate vt:(6)mt=β1⋅mt−1+1−β1⋅gt,vt=β1⋅vt−1+1−β2⋅gt2.Step 4:
the first-order moment estimatem^t and the second-order moment estimate v^t after calculating the corrected deviation is as follows:(7)m^t=mt1−β1t,v^t=vt1−β2t.Step 5:
update the learning rateα and network parameter weight θt:(8)αt=α1−β2t1−β1t,θt=θt−1−αt⋅m^tv^t+ε,where ε is a constant that maintains a stable value, with a value of 10−8.


## 3.1. Establishing Building Energy Consumption Prediction Model

The traditional LSTM network model has better prediction performance results than the ordinary neural network model [25]. However, the LSTM model has more parameter settings, and the training will be slower than the ordinary neural network model. Therefore, this article improves the LSTM model and proposes a predictive analysis method based on the improved LSTM (ILSTM) model. The proposed ILSTM model is shown in Figure 4, and its main features are as follows:(1)
All nodes in the hidden layer are divided into several modules, and each module is allocated with different clock cycles to independently manage the update time.(2)
The hidden layer of the RNN is connected to each other. Although the interior is fully connected, the modules are directional. The intermodule connection will point from the high-clock frequency to the low-clock frequency module.Figure 4
Forward propagation matrix of the ILSTM model.Each time the weight is updated, LSTM has 7 weight matrices that need to be updated each time, and the length of each matrix is the number of hidden layer nodes. This article separates the hidden layer nodes into different modules. During operation, a part of the modules will be selected to participate in the operation, and the modules not participating in the operation will be set to 0. One of the weight matrices is similar to the other weight matrices:(3)Wiw=wiw,1wiw,2…wiw,n.The update formula will be as follows:(4)Wiw=WiwfortMODTi=00otherwise.Among them, the model definitionTi=2i−1 based on energy consumption prediction, and the feedforward formula mechanism of the output gate will be formed, and other formulas are similar:Such a mechanism can guarantee that the nodes in the first module will always participate in the calculation. As the training time increases, the number of modules involved in the operation will increase; that is, modules with higher clock frequencies will only participate in the operation at a later time during training. The update of different modules at different times will be as shown in Figure5. The red star symbol indicates the module that will participate in the operation at the current moment.Figure 5
ILSTM model update diagram.The reason is that the short-range information needs to be updated frequently, which will be handed over to the low-clock frequency module for the main processing. For long-distance information, the main processing is performed by the high-clock cycle module. Under such a mechanism, different modules have different functions and divisions of labor, and different information of long and short distances can be handled well.In terms of time complexity, the time complexity of the ILSTM model that combines the advantages of the LSTM model will also be lower than that of the LSTM model. This is because each time the parameters are updated, partial updates are selected instead of all updates. In short, the training time of the ILSTM model is shorter than that of the LSTM model, which makes up for the shortcomings of the long training time of the LSTM model.At the same time, this paper builds an ILSTM analysis network model based on the Keras framework. Keras is a deep learning framework based on the Python language that can run on TensorFlow, CNTK, or Theano. It has the advantages of open source and strong scalability, and its development focus is to achieve rapid experiments. The structure of the ILSTM prediction model is shown in Figure6. Among them, xt and yt are the input and output of the time model, respectively.Figure 6
Structure diagram of ILSTM building energy consumption prediction model.The hidden layer of the ILSTM unit uses 150 neurons and defines the dimensions of the input data. Then, the Adam optimization algorithm is used to optimize and update the parameters of the model. The dropout layer randomly closes some neurons in each iteration, and as the iteration progresses, any neuron may be closed. Therefore, neurons become less sensitive to the activation of other specific neurons. It can reduce the complex coadaptation relationship between neurons, effectively alleviate the occurrence of overfitting, and achieve the effect of regularization to a certain extent. Its various parameters are shown in Table1.Table 1
Parameters of building energy consumption prediction model.
ParameterValueNumber of hidden layer neurons150Dropout0.15Learning rate0.015Attenuation coefficientβ10.85Attenuation coefficientβ21.0


## 3.2. Optimization Algorithm

For a multilayer predictive network model, the calculated network weight parameters are quickly and accurately updated, which can effectively improve the prediction accuracy and speed of the energy consumption model.The traditional stochastic gradient descent (SGD) algorithm only uses one sample of the dataset to update the network parameters each time. If the sample is noisy or outliers, it will make SGD unable to update towards the global optimal solution, which will easily cause the model to not converge.Adam is a learning rate-adaptive optimization algorithm that combines the advantages of the momentum algorithm and the root-mean-square backpropagation algorithm. It can automatically search the learning rate and efficiently search the parameter space. It can replace the traditional gradient descent stochastic algorithm for weight parameters. Optimization is updated. The Adam algorithm has high computational efficiency and low memory requirements, which is very suitable for problems with large data or parameters. The specific optimization process is as follows:Step 1:
set the initial learning rateα to 0.015, the first-order moment estimated attenuation coefficient β1 to 0.85, and the second-order moment estimated attenuation coefficient β2 to 1.0Step 2:
calculate the gradientgt of the objective function(5)gt=∇θftθt−1,Among them,ftθt−1 is the objective function; θt−1 is the network parameter weight at time step t−1.Step 3:
calculate the first-order moment estimationmt and the second-order moment estimate vt:(6)mt=β1⋅mt−1+1−β1⋅gt,vt=β1⋅vt−1+1−β2⋅gt2.Step 4:
the first-order moment estimatem^t and the second-order moment estimate v^t after calculating the corrected deviation is as follows:(7)m^t=mt1−β1t,v^t=vt1−β2t.Step 5:
update the learning rateα and network parameter weight θt:(8)αt=α1−β2t1−β1t,θt=θt−1−αt⋅m^tv^t+ε,where ε is a constant that maintains a stable value, with a value of 10−8.


## 4. Experiment

The simulation experiment runs in the Ubuntu16 environment (CPU is InterCore i7-980 × 3.33 GHz, memory is 128 GB). Written in Python 3.0 language, data preprocessing is performed through numpy 1.19.4 and pandas 0.20.3, and implemented based on the Keras deep learning framework. The specific development environment and hardware configuration of the experiment are shown in Table2.Table 2
Experimental simulation scenarios.
Software environmentOperating systemLinux ubuntu 16.04Deep learning frameworkKerasData processing libraryNumpy 1.19.4/pandas 0.20.3Program editorPython 1.5CUDACUDA toolkit 9.0Hardware environmentCPUIntercore i7-980 × 3.33 GHzGPUGeForce GTX 1050 Max-QRunning memory128 GB


### 4.1. Evaluation Index

In deep learning, evaluation indicators are the key to measuring the performance of a model. In this paper, the root mean squared error (RMSE) and mean absolute error (MAE) indicators commonly used in time-series prediction tasks are used to evaluate the effect of the model.RMSE is the square root of the ratio of the sum of the squares of the deviation between the predicted value and the true value to the number of observationsN, which represents the difference between the predicted value of the model and the true value. The definition of RMSE is shown in the equation as follows:(9)RMSE=∑i=1Ny^i−yi2N.MAE is the average value of absolute error, which can better reflect the actual situation of predicted value error. The definition of MAE is shown in the formula as follows:(10)MAE=∑i=1Ny^i−yiN,where y^i and yi respectively represent the predicted value and the true value of the model. N represents the number of samples.It should be noted that the smaller the value of the evaluation indicators RMSE and MAE, the better the performance of the building energy consumption prediction analysis model.


### 4.2. Network Parameter Optimization Analysis

The AdaGrad algorithm, SGD algorithm, and Adam algorithm are used to compare the optimization effects. Figure7 shows the model test set training error drop curve under different optimization algorithms.Figure 7
Variation curve of model error under different optimization algorithms.As shown in Figure7, the Adam parameter optimization algorithm used in this article can achieve effective network convergence in the fourth iteration, with a training error of 0.00005. The AdaGrad algorithm and SGD algorithm training errors converge to 0.00014 and 0.00027, respectively. It is proved that the Adam parameter optimization method can achieve an accurate matching of energy consumption prediction network parameters. At the same time, it is also noticed that the comparison algorithm is slower than the Adam algorithm. The SGD algorithm realizes parameter matching in the 8th iteration, and the AdaGrad algorithm realizes the network calculation tuning in the 14th iteration. It proves that the Adam optimization algorithm has fast network status tracking ability and can realize the real-time update and matching of building energy consumption prediction network parameters.


### 4.3. Comparison of Predicted Results and Actual Values

At the same time, References [17, 20] are also used as a comparison method to conduct a comparison experiment with the proposed ILSTM energy consumption prediction network model. The experiment is divided into training experiment and test experiment. 100 continuous data from the forecast results are randomly selected and compared them with the actual values. The comparison result is shown in Figure 8.Figure 8
Comparison of prediction performance under different methods. (a) Training set. (b) Test set.
(a)(b)Figure8 shows the prediction accuracy of building energy consumption under different methods. As shown in Figure 8(a), thanks to the proposed ILSTM predictive network model, different modules are distributed in different clock periods, which can ensure a better training data curve in the full cycle. In reference [17], although the particle swarm algorithm is used to realize adaptive update of predictive network parameters, it ignores the time sequence of building status data, and it is difficult to achieve accurate feature extraction for the training dataset. Reference [20] builds an energy consumption prediction model based on a support vector machine, which has a stronger nonlinear fitting ability than the ordinary neural network. However, due to ignoring the characteristics of the data itself, it is still insufficient compared with the predictive analysis ability of the proposed method.Figure8(b) shows the prediction and analysis of the test dataset by different methods, and the performance advantages of the proposed method can be further seen. The proposed method exhibits excellent tracking and prediction performance during the full simulation cycle, while other methods have large tracking errors and cannot achieve accurate and efficient building energy consumption prediction analysis.In order to quantify the evaluation effects of different methods, this paper selects MAE and RMSE as performance evaluation indicators and takes the average of 100 calculation results for comparative analysis. Figure9 shows the evaluation performance of different prediction methods.Figure 9
Comparison of evaluation indexes under different methods. (a) MAE. (b) RMSE.
(a)(b)As shown in Figure9, the lower the numerical indicators of the predictive evaluation indexes MAE and RMSE, the better the predictive performance of the network model. The combination of the ILSTM network model and the Adam optimization algorithm effectively guarantees the tracking and analysis performance of the prediction method. The method proposed in this paper has an MAE index of 0.015 and an RMSE index of 0.029. Because the comparison method ignores the time-series characteristics of the data, the analysis index value is significantly higher than the proposed method. It proves the excellent predictive performance of building energy consumption by the proposed method.


## 4.1. Evaluation Index

In deep learning, evaluation indicators are the key to measuring the performance of a model. In this paper, the root mean squared error (RMSE) and mean absolute error (MAE) indicators commonly used in time-series prediction tasks are used to evaluate the effect of the model.RMSE is the square root of the ratio of the sum of the squares of the deviation between the predicted value and the true value to the number of observationsN, which represents the difference between the predicted value of the model and the true value. The definition of RMSE is shown in the equation as follows:(9)RMSE=∑i=1Ny^i−yi2N.MAE is the average value of absolute error, which can better reflect the actual situation of predicted value error. The definition of MAE is shown in the formula as follows:(10)MAE=∑i=1Ny^i−yiN,where y^i and yi respectively represent the predicted value and the true value of the model. N represents the number of samples.It should be noted that the smaller the value of the evaluation indicators RMSE and MAE, the better the performance of the building energy consumption prediction analysis model.


## 4.2. Network Parameter Optimization Analysis

The AdaGrad algorithm, SGD algorithm, and Adam algorithm are used to compare the optimization effects. Figure7 shows the model test set training error drop curve under different optimization algorithms.Figure 7
Variation curve of model error under different optimization algorithms.As shown in Figure7, the Adam parameter optimization algorithm used in this article can achieve effective network convergence in the fourth iteration, with a training error of 0.00005. The AdaGrad algorithm and SGD algorithm training errors converge to 0.00014 and 0.00027, respectively. It is proved that the Adam parameter optimization method can achieve an accurate matching of energy consumption prediction network parameters. At the same time, it is also noticed that the comparison algorithm is slower than the Adam algorithm. The SGD algorithm realizes parameter matching in the 8th iteration, and the AdaGrad algorithm realizes the network calculation tuning in the 14th iteration. It proves that the Adam optimization algorithm has fast network status tracking ability and can realize the real-time update and matching of building energy consumption prediction network parameters.


## 4.3. Comparison of Predicted Results and Actual Values

At the same time, References [17, 20] are also used as a comparison method to conduct a comparison experiment with the proposed ILSTM energy consumption prediction network model. The experiment is divided into training experiment and test experiment. 100 continuous data from the forecast results are randomly selected and compared them with the actual values. The comparison result is shown in Figure 8.Figure 8
Comparison of prediction performance under different methods. (a) Training set. (b) Test set.
(a)(b)Figure8 shows the prediction accuracy of building energy consumption under different methods. As shown in Figure 8(a), thanks to the proposed ILSTM predictive network model, different modules are distributed in different clock periods, which can ensure a better training data curve in the full cycle. In reference [17], although the particle swarm algorithm is used to realize adaptive update of predictive network parameters, it ignores the time sequence of building status data, and it is difficult to achieve accurate feature extraction for the training dataset. Reference [20] builds an energy consumption prediction model based on a support vector machine, which has a stronger nonlinear fitting ability than the ordinary neural network. However, due to ignoring the characteristics of the data itself, it is still insufficient compared with the predictive analysis ability of the proposed method.Figure8(b) shows the prediction and analysis of the test dataset by different methods, and the performance advantages of the proposed method can be further seen. The proposed method exhibits excellent tracking and prediction performance during the full simulation cycle, while other methods have large tracking errors and cannot achieve accurate and efficient building energy consumption prediction analysis.In order to quantify the evaluation effects of different methods, this paper selects MAE and RMSE as performance evaluation indicators and takes the average of 100 calculation results for comparative analysis. Figure9 shows the evaluation performance of different prediction methods.Figure 9
Comparison of evaluation indexes under different methods. (a) MAE. (b) RMSE.
(a)(b)As shown in Figure9, the lower the numerical indicators of the predictive evaluation indexes MAE and RMSE, the better the predictive performance of the network model. The combination of the ILSTM network model and the Adam optimization algorithm effectively guarantees the tracking and analysis performance of the prediction method. The method proposed in this paper has an MAE index of 0.015 and an RMSE index of 0.029. Because the comparison method ignores the time-series characteristics of the data, the analysis index value is significantly higher than the proposed method. It proves the excellent predictive performance of building energy consumption by the proposed method.


## 5. Conclusion

This paper proposes a method for predicting and analyzing building energy consumption based on improved LSTM, which can handle time series well. The prediction model based on the Keras deep learning framework can be effectively trained on building energy consumption data. The proposed ILSTM prediction model distributes different modules in different clock periods, which can ensure a better curve tracking fit in the full cycle and match the analysis needs of different prediction periods. The experimental results show that the prediction network optimized by the Adam algorithm has higher accuracy and significantly improves the full-cycle tracking and analysis capabilities of the building energy consumption prediction network.The purpose of building energy consumption prediction is to better realize the refined management of building energy. At present, a large number of studies have focused on the problem of building energy consumption prediction, but how to set building energy efficiency strategies and achieve optimal building operation is the ultimate goal of building energy refined management. Therefore, in the future, research and application of user-centered building energy management and energy-saving strategies will be carried out, and energy consumption forecasting, energy-saving strategy formulation, and rapid operation analysis application linkage analysis will be carried out.



---

*Source: 3323316-2021-12-29.xml*