**4. Two-Stage STLF Model Construction**

So far, various single algorithm-based STLF models have been proposed [46]. Even though they showed good performance in the domains that were focused on, their performance was limited in the other domains or electric energy consumption patterns were intricate. To alleviate this limitation, we propose a two-stage day-ahead STLF model that combines two single algorithm-based STLF models using DNNs.

### *4.1. The First Stage: Constructing Two STLF Models*

In the first stage, we build two STLF models based on XGBoost and RF, which are well-known tree-based ensemble models in time series prediction [47], by using various input variables. They are based on boosting and bootstrap aggregating (bagging) algorithms, respectively. Compared to other boosting algorithms and bagging algorithms, the XGBoost and RF models show better predictive accuracy and have the highest correlation with actual power consumption. In addition, as XGBoost supports various loss functions, we can choose an appropriate loss function depending on the characteristics of the data. On the contrary, it su ffers from overfitting during training [48]. RF can handle high dimensional data well, but it cannot give precise value for the regression model because the final prediction is the average of all the predictions from the subset trees [49]. By using the predicted values of the XGBoost model and the RF model together with other input variables, it is possible to prevent overfitting and to make more accurate prediction.
