SummaryThis post predicts appliance energy usage.
Table of Contents
The purpose of the post is to mimic the analysis of Candendo et. al. with a variety of statistical models using the
modeltime packages in R. Candendo predicts appliance energy usage. The post will provide an (1) overview of energy prediction, (2) construct statistical models and (3) evaluate their effectiveness.
Energy usage has been explored extensively concerning buildings. “The buildings and building construction sectors consumed 36% of the global final energy and nearly 40% of total CO2 emission in 2018”.  Building energy usage may be reduced by improving efficiency. Less energy usage would lower buildings’ environmental and economic burden.  Effective prediction techniques could quantify savings and improve conservation.  Building designs could be chosen based on the expected energy usage, and future costs could be discounted to present value over the building’s expected useful life. 
In a 2020 metanalysis, Sun and coauthors performed an extensive review on building energy prediction compiling 105 papers. The effort detailed “the entire data-driven process that includes feature engineering, potential data-driven models and expected outputs.” 
Sun grouped energy conservation strategies into three boxes: white, grey, and black. “White box” models predict the thermal behavior by numerical equations. . “Grey box” or hybrid methods “combine physical models and data-driven approaches to simulate building energy.” . “Black box” use machine learning methods to discover statistical patterns with the data set. 
Frequently, data sets contain (1) meteorological/outside, (2) indoor, (3) occupancy, (4) time, (5) building characteristics, (6) socioeconomic, and (7) historic features.  With regard to available features, meteorological information, historical data and time index are the top-3 important factors for building energy prediction.  Popular statistical models are artificial neural network (“ANN”), support vector regression (“SVR”), and linear regression (“LR”), while the less popular models are time series analysis and regression trees (“RT”). 
Appliances represent a significant portion (between 20 and 30% of the electrical energy demand electricity consumption in domestic buildings is explained by two main factors: the type and number of electrical appliances and the use of the appliances by the occupants. Buildings and, specifically residential buildings, are candidates in reducing energy as “approximately 74% of this electricity use is from all buildings, and 38% is from residential buildings. 
“Refrigeration and freezer loads tended to be very flat, while cooking, dishwasher, lights and small appliances showed distinct evening peaks.”  “Refrigerators have a uniform load profile, while clothes washers, cloth dryers, and dishwashers are very user-dependent and thus vary from household to household and time of day.”
The variability in energy usage is a challenge for power operators. Electric grids are vulnerable to failure at peak load times. A Texas study attributed 75% of the peak demand to buildings, with 50% to residential and 25% to business.  Economizing appliance use during peak times has received more attention than HVAC systems because appliances do not affect “the comfort of the indoor environment.” 
The data set originally served as the basis for an article entitled “Data-driven prediction models of energy use of appliances in a low-energy house.”  Since the publication of the article, the data set is available at the UCI Machine Learning Repository and can be found here. According to the website,
“the data set is time series measured at 10-minute intervals for 4.5 months. The house temperature and humidity conditions were monitored with a ZigBee wireless sensor network. Each wireless node transmitted the temperature and humidity conditions around 3.3 min. Then, the wireless data was averaged for 10 minutes periods. The energy data was logged every 10 minutes with m-bus energy meters. Weather from the nearest airport weather station (Chievres Airport, Belgium) was downloaded from a public data set from Reliable Prognosis (rp5.ru), and merged together with the experimental data sets using the date and time column. Two random variables have been included in the data set for testing the regression models and to filter out non-predictive attributes (parameters). GitHub Repo.”
The data set consists of a single, residential house and was simplified to reduce the file size by filtering the measurements to those taken at the start of each hour. The resulting dataset contained 1/6 of the rows of the original. An exploratory analysis of the data set was previously conducted here.
The 2017 paper used four statistical models which “were trained with repeated cross-validation and evaluated on a testing set: (a) multiple linear regression, (b) support vector machine with radial kernel, (c) random forest and (d) gradient boosting machines (GBM). The best model (GBM) was able to explain 97% of the variance (R2) in the training set and with 57% in the testing set when using all the predictors.
# Split Data 90/10 set.seed(1) # note the "initial_time_split" from "resamples" package df_splits <- initial_time_split(df, prop = 0.9) df_train <- training(df_splits) df_test <- testing(df_splits)
# Model 1: auto_arima ---- model_fit_arima_no_boost <- arima_reg() %>% set_engine(engine = "auto_arima") %>% fit(appliances ~ date_time + t1, data = df_train) # Model 2: arima_boost ---- model_fit_arima_boosted <- arima_boost( min_n = 2, learn_rate = 0.015 ) %>% set_engine(engine = "auto_arima_xgboost") %>% fit(appliances ~ date_time + as.numeric(date_time) + factor(hour(date_time), ordered = F), data = df_train) # Model 3: ets ---- model_fit_ets <- exp_smoothing() %>% set_engine(engine = "ets") %>% fit(appliances ~ ., data = df_train) # Model 4: prophet ---- model_fit_prophet <- prophet_reg() %>% set_engine(engine = "prophet") %>% fit(appliances ~ date_time, data = training(df_splits)) # Model 5: lm ---- model_fit_lm <- linear_reg() %>% set_engine("lm") %>% fit(appliances ~ date_time, data = training(df_splits)) # Add fitted models to model table models_tbl <- modeltime_table( model_fit_arima_no_boost, model_fit_arima_boosted, model_fit_ets, model_fit_prophet, model_fit_lm ) # calibrate calibration_tbl <- models_tbl %>% modeltime_calibrate(new_data = testing(df_splits))
|1||REGRESSION WITH ARIMA(2,0,1)(2,0,0) ERRORS||Test||51.90||64.83||1.11||48.86||74.25||0.09|
|2||ARIMA(2,0,0)(2,0,0) WITH NON-ZERO MEAN W/ XGBOOST ERRORS||Test||46.32||53.67||0.99||43.68||72.73||0.11|