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.

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 [24]. 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 [1416]. 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 is , and the prediction model is equivalent to estimating the value at time .

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 , that is, the direct multistep forecasting method:where 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.where is the processed standard data; is the sample data before processing; is the maximum value of the sample dataset; 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 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).

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 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. 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 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. 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.

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:

The update formula will be as follows:

Among them, the model definition 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 Figure 5. The red star symbol indicates the module that will participate in the operation at the current moment.

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 Figure 6. Among them, and are the input and output of the time model, respectively.

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 Table 1.

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 to 0.85, and the second-order moment estimated attenuation coefficient to 1.0  Step 2:calculate the gradient of the objective functionAmong them, is the objective function; is the network parameter weight at time step .  Step 3:calculate the first-order moment estimation and the second-order moment estimate :  Step 4:the first-order moment estimate and the second-order moment estimate after calculating the corrected deviation is as follows:  Step 5:update the learning rate and network parameter weight :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 Table 2.

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 observations , 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:

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:where and respectively represent the predicted value and the true value of the model. 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. 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. 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 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. 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. 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. 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.

Data Availability

The data included in this paper are available without any restriction.

Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.