# Predicting the Gap in the Day-Ahead and Real-Time Market Prices Leveraging Exogenous Weather Data
## 5 Simulation Results
### Hyper-Parameter Tuning  
To perform day-ahead, real-time gap predictions, the hyper-parameters of each learning method presented in Section 2, are optimized. Hyper-parameters control the learning process, and they have to be optimized so that the predefined loss function is minimized for a given dataset. A grid search with nested cross-validation is used to tune hyper-parameters. A grid search is a brute force algorithm that calculates the output for all subsets of predefined parameters and picks the best estimator. The performance of the estimators \begin{table}
\begin{tabular}{c c} \hline \hline
**Feature** & **Importance Coefficient** \\ \hline GAP LMP price 24 h before & 3.32 \\ \hline DAM LMP price 24 h before & 1.9 \\ \hline RTM LMP price 24 h before & 1.3 \\ \hline Solar Zenith Angle & 1.0 \\ \hline Demand Forecast Day-Ahead & 0.78 \\ \hline Relative humidity & 0.67 \\ \hline Perceptible Water & 0.61 \\ \hline Cloud Layer & 0.54 \\ \hline Dew point & 0.53 \\ \hline Wind Speed & 0.47 \\ \hline Wind Direction & 0.46 \\ \hline Demand Forecast 2 Days Ahead & 0.46 \\ \hline DHI & 0.39 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Selected feature importance for gap predictions. is evaluated using time-series nested K-Fold cross-validation, where \(k=5\). The time-series nested cross-validation divides the existing dataset into \(k\) inner loops, and each inner loop is split into a training subset and a validation set. Then, the parameters that minimize the error on the validation set are chosen. The outer loop splits the dataset into multiple different training and test sets, and the error on each split is averaged to compute a robust estimate of the model's error. K-fold cross-validation helps mitigate the risk of overfitting and provides a more reliable assessment of how well the model is expected to perform on unseen data. The Lasso algorithm presented in (1) has only one hyper-parameter: \(\lambda\). To find the optimal value for \(\lambda\), a set of arbitrarily chosen values, {0.0001, 0.0002, 0.0003, 0.0004, 0.0005, 0.001, 0.002, 0.003, 0.004, 0.005, 0.01}, is examined. The highest accuracy or minimal loss is acquired using a grid search when the hyper-parameter \(\lambda\) is 0.0003. The SVR model is optimized for four different hyper-parameters, including \(C\); \(\epsilon\); the kernel function, \(K\); and the kernel coefficient, \(\gamma\). The optimal value found using the grid search for the constant \(C\) is \(C=1000\), while the margin of the tube \(\epsilon=0.001\) turned out to give the most accurate estimator. In addition, different kernel functions, including linear, sigmoid, and RBFs, are tested, and the most accurate results are obtained using an RBF with \(\gamma=0.1\). Similarly, the Random Forest algorithm is also tuned for hyper-parameters. Generally, an increase in the number of trees in the forest can only benefit the algorithm. However, this increment also introduces significant overhead in computation time, so only forests with 50 and 100 trees were tested, and 100 trees turned out to give more accurate results. In addition, the maximum number of features considered when looking for the best split turned out to be equal to the total number of features. Moreover, different maximum depths of the trees are passed to the grid search, and the optimal value is found when the nodes are expanded until all the leaves are pure. Finally, the algorithm is tuned for the methods of sampling the data points, and sampling with replacement turned out to be the optimal option. The LSTM network is optimized for the number of units, loss function, optimizer, and lookback period, which represent several previous timestamps that are considered for a prediction at each time unit. The following set of values, {\(10,20,50,100\)}, is examined for the number of units, while the MAE and MSE are tested for the loss function, and Stochastic Gradient Descent (SGD), Root Mean Square Propagation (RMSProp), and Adaptive Moment Optimization (ADAM) are utilized for optimizer choices.