Intelligent Prediction Method of Building Energy Consumption Based on Deep Learning

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. -en, based on the Keras deep learning framework, an improved long shortterm 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. -e simulation experiment is based on the actual dataset collected by a university in Southwest China. -e 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. -e simulation experiment proves that the proposed method is feasible.


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][3][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]. erefore, 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. e widespread application of the Internet of ings 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]. e autonomous control platform is based on the deep learning network to complete the effective prediction of building energy consumption [14][15][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. e 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. e 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. e 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. e 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.

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. e historical data of building energy consumption can reveal the law of this event over time.

Time Series Prediction Problem Description.
is paper chooses to conduct a targeted analysis of building energy consumption in colleges and universities. e 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. is 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.
is article assumes that the data value of the historical time series value of energy consumption is x t , x t−1 , . . . . . ., and the prediction model is equivalent to estimating the value at time x t+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 time t + p(p > 0), that is, the direct multistep forecasting method: 2 Scientific Programming (1) where a is the undetermined coefficient of the direct multistep prediction model.

Data Source and Processing.
is 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. erefore, the missing data should be processed first before training. e 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. erefore, 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.
where X ′ is the processed standard data; X is the sample data before processing; X max is the maximum value of the sample dataset; X min is the minimum data in the sample dataset.

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 Figure 1.
It can be seen from Figure 1 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).
en, 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 Figure 2 is obtained.
It can be seen from Figure 2 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. e 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. e above phenomena all reflect that seasonal attributes and temperature attributes have a nonnegligible effect on energy consumption. erefore, 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 Figure 3.
It can be seen from Figure 3 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. e energy consumption of administrative buildings is mainly concentrated in the daytime, which is obviously different from dormitory buildings. is phenomenon reflects that different building types represent different energy use patterns. erefore, when building energy consumption prediction models, we should dig deeper into the hidden information contained in different building types.

Energy Consumption Prediction Method
Based on the Improved LSTM Network Model e 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.

Establishing Building Energy Consumption Prediction
Model.
e 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. erefore, this article improves the LSTM model and proposes a predictive analysis method based on the improved LSTM (ILSTM) model. e 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) e hidden layer of the RNN is connected to each other. Although the interior is fully connected, the modules are directional. e intermodule connection will point from the high-clock frequency to the low-clock frequency module.
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. is 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: e update formula will be as follows: Among them, the model definition T i � 2 i− 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. e update of different modules at different times will be as shown in Figure 5. e red star symbol indicates the module that will participate in the operation at the current moment. e reason is that the short-range information needs to be updated frequently, which will be handed over to the lowclock frequency module for the main processing. For longdistance 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. is 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 eano. It has the e hidden layer of the ILSTM unit uses 150 neurons and defines the dimensions of the input data. en, the Adam optimization algorithm is used to optimize and update the parameters of the model. e dropout layer randomly closes some neurons in each iteration, and as the iteration progresses, any neuron may be closed. erefore, 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 Table 1.

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. e 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.
e Adam algorithm has high computational efficiency and low memory requirements, which is very suitable for problems with large data or parameters. e specific optimization process is as follows: Step 1: set the initial learning rate α to 0.015, the firstorder moment estimated attenuation coefficient β 1 to 0.85, and the second-order moment estimated attenuation coefficient β 2 to 1.0 Step 2: calculate the gradient g t of the objective function Among them, f t (θ 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 estimation m t and the second-order moment estimate v t :

Scientific Programming
Step 4: the first-order moment estimate m t and the second-order moment estimate v t after calculating the corrected deviation is as follows: Step 5: update the learning rate α and network parameter weight θ t : where ε is a constant that maintains a stable value, with a value of 10 −8 .

Experiment
e 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. e specific development environment and hardware configuration of the experiment are shown in Table 2.

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 timeseries 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 observations N, which represents the difference between the predicted value of the model and the true value. e definition of RMSE is shown in the equation as follows: MAE is the average value of absolute error, which can better reflect the actual situation of predicted value error. e definition of MAE is shown in the formula as follows: where y i and y i 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.

Network Parameter Optimization Analysis.
e Ada-Grad algorithm, SGD algorithm, and Adam algorithm are used to compare the optimization effects. Figure 7 shows the model test set training error drop curve under different optimization algorithms.
As shown in Figure 7, 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.
e 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.
e 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.

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. e 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. e comparison result is shown in Figure 8. Figure 8 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. Figure 8(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. e 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. Figure 9 shows the evaluation performance of different prediction methods.
As shown in Figure 9, the lower the numerical indicators of the predictive evaluation indexes MAE and RMSE, the better the predictive performance of the network model. e combination of the ILSTM network model and the Adam optimization algorithm effectively guarantees the tracking and analysis performance of the prediction method. e 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.

Conclusion
is paper proposes a method for predicting and analyzing building energy consumption based on improved LSTM, which can handle time series well. e prediction model based on the Keras deep learning framework can be effectively trained on building energy consumption data. e 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.
e 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. e 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. erefore, 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.
Data Availability e data included in this paper are available without any restriction.  Scientific Programming