## 4 Materials and Methods
### Feature Selection and ML-Based Predictive Analytics on the Cloud  
For feature selection, we preferred a wrapper-based approach to a filter-based approach. Because of this choice, we performed the feature selection step in conjunction with the machine-learning-based data analytics step of the proposed data-mining method. In particular, we implemented the recursive feature elimination (RFE) method [22] to perform feature selection on the integrated dataset. RFE is an instance of the backward feature elimination method, which consists of an iterative process that implies training a classifier or regressor, computing the ranking criterion for all features involved and removing the feature with the smallest ranking criterion. \begin{table}
\begin{tabular}{c c c} \hline
**Variable** & **Description** & **Unit of Measurement** \\ \hline Average temperature\_spring & Average temperature during spring–summer production cycle. & Degrees Celsius \\ Average temperature\_autumn & Average temperature during autumn–winter production cycle. & \\ Days with hail activity\_spring & Days with hail activity during spring–summer production cycle. & \\ Days with hail activity\_autumn & Days with hail activity during autumn–winter production cycle. & Days \\ Days with fog occurrence\_spring & Days with fog occurrence during spring–summer production cycle. & \\ Days with fog occurrence\_autumn & Days with fog occurrence during autumn–winter production cycle. & \\ Days with storm activity\_spring & Days with storm activity during spring–summer production cycle. & \\ Days with storm activity\_autumn & Days with storm activity during autumn–winter production cycle. & \\ Total rainfall\_spring & Total rainfall during spring–summer production cycle. & Millimeters \\ Total rainfall\_autumn & Total rainfall during autumn–winter production cycle. & Millimeters \\ \hline \end{tabular}
\end{table} 
Table 5: Variables in climate dataset. Furthermore, we used the linear regression and k-nearest neighbors (KNN) regression machine-learning algorithms in the core of the RFE algorithm as we selected them for the implementation of machine-learning-based predictive analytics in this work. In regard to the latter, we experimentally set the number of neighbors (k) at 5. We carried out the following iterative procedure to select the optimal \(k\) value:  
1. Initialize a random \(k\) value between 2 and N-1 (where N is the number of samples in our dataset);
2. Train the prediction model using the selected \(k\) value. Use the trained model to make predictions for the data in the dataset reserved for validation;
3. Calculate the Root-Mean-Square Error (RMSE) for the predictions computed;
4. Repeat the process selecting a different \(k\) value. We finally created a plot between the RMSE values and the \(k\) values to select the \(k\) value with the minimum error rate, which was 5 (\(k=5\)). Linear regression and KNN regression are, respectively, easy and simple parametric and nonparametric machine-learning algorithms ([PERSON], 1995; [PERSON], 1995), and they were judged as theoretically appropriate for the nature of both the problem that we faced and the data that were available. We sought to significantly reduce the number of features to employ to build prediction models using these algorithms; therefore, we experimentally set the threshold of relevant features at nine by carrying out the following iterative procedure:  
1. Initialize a random value between 2 and F-1 (where F is the total number of features in our dataset) for the number of features to be selected (\(f\));
2. Perform recursive feature elimination (RFE) to select the \(f\) most relevant features from the set of features in our dataset;
3. Train the prediction model using the selected \(f\) most relevant features. Use the trained model to make predictions for the data in the dataset reserved for validation;
4. Calculate the Root-Mean-Square Error (RMSE) for the predictions computed;
5. Repeat the process selecting a different \(f\) value.