## 3 Methodology
### Experimental Setup
#### 3.2.2 Validation Step  
Once the best hyperparameters have been obtained in the first step, the validation of the model is carried out. This consists of predicting each day of the validation subset, also using the sliding window strategy. To make this possible, the model is fed with information from the previous days (_tr_v_), defined by the \"past history\" factor, and the next day is predicted. Once the predictions have been obtained (_o_), they are compared to the actual price (_v_) to obtain the real effectiveness of each of the models.  
Concerning to metrics, the predictions are evaluated with MAE, WAPE, MASE and MAPE functions. All of these functions provide different information about the accuracy of the forecasted time series.  
Mean absolute error (MAE) is similar to MSE (Mean squared error), but instead of applying a square, it applies an absolute value. MAE uses the same scale as the data being measured and it is a standard measure to forecast error in time series analysis [34].  
\[MAE(v,o)=mean(|v-o|)=\frac{1}{n}\sum_{i=1}^{n}|v_{i}-o_{i}| \tag{1}\]  
Weighted average percentage error (WAPE) [35] is the most different metric of the chosen ones. WAPE is a variation of MAPE, where the error is rescaled dividing it by the mean. Due to this, the error is comparable across time series of varying scales. Thanks to these properties, scale-independency and interpretability, WAPE is widely used to measure the forecast accuracy, and it is very recommended for forecasting with intermittent and low-volume data.  
\[WAPE(v,o)=\frac{MAE(v,o)}{mean(v)}=\frac{mean(|v-o|)}{mean(y)} \tag{2}\]  
Mean absolute scaled error (MASE) is similar to MAE, but it has some properties that makes it a recommended metric to compare forecast accuracy. An example is the property  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Model** & **Parameters** & **Values** \\ \hline \multirow{4}{*}{Tree} & Splitter & best, random \\  & Max depth & 2, 4, 6, 8, 10 \\  & Min samples split & 2, 4, 6, 8 \\  & Min samples leaf & 1, 3, 5, 7 \\ \hline \hline \end{tabular}
\end{table}
Table 6: Grid of parameters used for regression tree models.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Model** & **Parameters** & **Values** \\ \hline \multirow{4}{*}{Random Forest} & Number of estimators & 100, 300, 600 \\  & Max depth & 2, 4, 6, 8, 10 \\  & Min samples split & 2, 4, 6, 8 \\  & Min samples leaf & 1, 3, 5, 7 \\ \hline \hline \end{tabular}
\end{table}
Table 7: Grid of parameters used for random forest models.  
of symmetry, which penalises positive and negative errors equally, as it does with the long and shorts forecast errors.  
\[MASE(\
u,o)=\frac{\frac{1}{n}\sum_{i=1}^{n}|v_{i}-o_{i}|}{\frac{1}{n-1}\sum_{i=2} ^{n}|v_{i}-v_{i-1}|} \tag{3}\]  
Mean absolute percentage error (MAPE) is calculated by averaging the absolute error divided by the observed values. This approach is useful when the size of a prediction variable is significant in evaluating the accuracy of a prediction [36].  
\[MAPE(\
u,o)=\frac{1}{n}\sum_{i=1}^{n}\left|\frac{v_{i}-o_{i}}{v_{i}}\right| \times 100 \tag{4}\]  
Finally, and given that time is also a variable to be taken into account when talking about Deep Learning and Machine Learning models, it has been decided to add the average time (T) taken to train each of the models as a validation metric.