## 2 Materials and Methods
### Machine Learning Techniques
This type of algorithm requires a very large dataset for training because increasing the number of layers significantly raises the number of parameters that need to be optimized. The final step in the process was to optimize the hyperparameters of each model. Several combinations of hyperparameters were tested for each subset of features. Therefore, the combinations that produced lower errors with a certain subset may not have been the best combination when applied to another subset. For the RF model, the parameters tested included the number of trees, a criterion to measure the quality of a split, the maximum tree depth, the minimum number of samples required to be at a leaf node, the maximum number of features to consider when looking for the best split, and whether bootstrap samples were used when building trees. Regarding the SVM, four different kernels were tested, along with different values for the regularization parameter, and finally, different gamma and epsilon values were also tested. Moreover, in the case of the polynomial kernel, several polynomial degrees were tested. Finally, different hyperparameters were also tested for the NN. The parameters tested were different numbers of hidden layers, the neurons present in these layers, and the batch size given to the NN. It is also worth noting that the NN had a maximum number of epochs of 100 and incorporated a monitor function, stating that if the validation loss increased in more than 5 epochs, the training was stopped, and the best model was saved. All models were trained during this process, and the weights were saved at the end of the training, so the same trained model could be applied to the testing set and the results would stay consistent. The NN configuration that achieved the best result for the forecasting of day 4 had three hidden layers with 64, 32, and 16 neurons, respectively, and a single-neuron output layer. Data samples were processed in batches of eight. The loss function used was the MSE, and the learning technique applied was the adaptive moment estimation method (ADAM). As for the forecasting of day 7, the configuration of the NN consisted of 2 hidden layers with 128 and 64 neurons, an output layer with 4 neurons (the prediction was the average between the 4), and a batch size of 4. The loss function used was once again the MSE, and the learning technique applied the ADAM method. Table 1 summarizes the hyperparameters selected for each model for forecasting the MEL concentration on day 4 and day 7 of the fermentation process. To evaluate the performance of the models, two different metrics were chosen, the mean squared error and the mean absolute error (MAE), represented by the following equations:  
\[MSE=\frac{1}{n}\sum_{i=1}^{n}(y_{i}-\hat{y}_{i})^{2} \tag{4}\]\[MAE=\frac{1}{n}\sum_{i=1}^{n}|\hat{y_{i}}-y_{i}| \tag{5}\]  
where \(y_{i}\) and \(\hat{y_{i}}\) are the observed value and the predicted value, respectively. All the code in this study was implemented in Python version 3.11.4. The SVM and the RF were applied using the library scikit-learn [42], while the NN was constructed using the libraries tensorflow [43] and keras [44]. The experiments were run on a computer with an Intel i7 7 th quad-core processor with an NVIDIA 1060 GPU and 16 GB of RAM. The source code, as well as the dataset, is available in the GitHub _MELs-forecasting_ (further details are given in the data availability statement).