# Energy Demand Forecasting Scenarios for Buildings Using Six AI Models
## 2 Methodology
### Optimization Procedures  
Energy usage is taken into consideration when optimizing the performance of different machine learning models. The data are systematically separated into training, validation, and test sets using the MATLAB software. First, the data are separated into features and a \begin{table}
\begin{tabular}{c c c} \hline \hline
**Component** & **Equation** & **NO. Equation** \\ \hline Mean Squared Error (MSE) & \(\text{MSE}=\frac{1}{\text{N}}\sum\limits_{i=1}^{\text{N}}{(y_{i}-\hat{y})^{2}}\) & (40) \\ Information Gain & \(\text{IG}(\text{D},\text{A})=\text{Entropy}(\text{D})-\sum\limits_{\text{v} \in\text{Values}(\text{A})}\frac{|\text{D}_{\text{v}}|}{|\text{D}|}\text{ Entropy}(\text{D}_{\text{v}})\) & (41) \\ \hline \hline \end{tabular}
\end{table} 
Table 7: _Cont._ \begin{table}
\begin{tabular}{c c} \hline \hline
**Component** & **Equation** & **NO. Equation** \\ \hline Root Mean Square Percentage Error (RMSPE) & \(\text{RMSPE}=\sqrt{\text{N}}\sum\limits_{i=1}^{\text{N}}{(y_{i}-\hat{y}_{i})^{2}}\)\(*\)\(100\) & (42) \\ Mean Absolute Percentage Error (MAPE) & \(\text{MAPE}=\frac{1}{\text{N}}\sum\limits_{i=1}^{\text{N}}{\left|y_{i}-\hat{y}_ {i}\right|}*100\) & (43) \\ Kling–Gupta Efficiency (KGE) & \(KGE=1-\sqrt{(r-1)^{2}+\left(\frac{\text{G}_{\text{rands}}}{\text{G}_{\text{rands}}}-1 \right)^{2}+\left(\frac{\text{G}_{\text{rands}}}{\text{P}_{\text{rands}}}-1 \right)^{2}}\) & (44) \\ Nash–Sutcliffe Efficiency (NSE) & \(NSE=1-\frac{\sum\limits_{i=1}^{\text{N}}{(y_{i}-\hat{y}_{i})^{2}}}{\sum\limits _{i=1}^{\text{N}}{(y_{i}-\hat{y}_{i})^{2}}}\) & (45) \\ Coefficient of Determination (R\({}^{2}\)) & \(R^{2}=1-\frac{\sum\limits_{i=1}^{\text{N}}{(y_{i}-\hat{y}_{i})^{2}}}{\sum\limits _{i=1}^{\text{N}}{(y_{i}-\hat{y})^{2}}}\) & (46) \\ \hline \hline \end{tabular}
\end{table} 
Table 8: Evaluation metrics equation. target variable, where the training set takes up 70% of the entire data and the remaining 30% is used for validation and testing. Printing these set sizes ensures that dataset proportions remain clear, which is crucial for model evaluation. To balance computational efficiency and model complexity, we used a meticulously planned two-hidden-layer architecture for the Artificial Neural Network model, with five neurons in each layer chosen through iterative testing. The Levenberg-Marquardt backpropagation algorithm was used in the training protocol, which had a strict performance goal (mean squared error \(\leq\)1 \(\times\) 10\({}^{-3}\)), a maximum of 2000 epochs, and a learning rate of 0.01. To avoid overfitting and guarantee optimal convergence, the training procedure included an early stopping mechanism that was activated after 20 consecutive validation failures. The Radial Basis Function network underwent specific optimization of its spread factor through an exhaustive grid search across the range of 0.1 to 2.0, with performance evaluated using k-fold cross-validation. The Autoencoder model focused on latent space optimization, where we systematically tested dimensions from 2 to 10 nodes to achieve the optimal balance between dimensionality reduction and feature preservation, measured by reconstruction error minimization, for up to 2000 epochs. For the ensemble tree methods (Random Forest, XGBoost, and Decision Tree), we used an advanced Bayesian optimization technique to simultaneously adjust a number of hyperparameters, such as the number of features to consider at each split, the minimum leaf size, the maximum tree depth, and, for ensemble methods, the number of trees in the forest (e.g., 100 trees for Random Forest). This strategy worked especially well for handling the bias-variance tradeoff while considering the various operating conditions found in the various campus buildings. The block diagram focused on the complex relationship between these elements and their collective impact on energy demand trends as shown in Figure 3. The steps for the optimization procedures method are given as follows:  
1.