## 2 Materials and Methods
### Feature Engineering
#### 2.4.3 Feature Selection  
Feature selection is key to the performance of supervised machine learning models. Reducing feature space dimensions and removing redundant or irrelevant features can facilitate the model generalisation capacity and can result in a lower computational cost [92; 93]. Feature importance measures can serve the purposes of feature selection [94]. In this study, we selected a subset from the 11 VIs and 14 textural features based on their relative importance with respect to their relevance to discriminate cocoa from the other land types. For this purpose, the permutation-based feature importance measure was employed (hereafter referred to as permutation), which was initially introduced for the random forest by [95]. We opted for permutation instead of the commonly used Gini index because permutation can be applied to any dataset whilst Gini is performed exclusively on the training dataset [95]. In our study, we applied permutation on the held-out validation data of the raw dataset and the refined dataset, after training the random forest on the respective training samples.  
Permutation measures the accuracy when the values of a particular feature are randomly permuted and computes the difference in accuracy before and after the permutation [95]. A decrease in accuracy indicates that the model's performance relies on that particular feature. The rationale behind this concept is that the relationship of the permuted feature with the true outcome breaks, as well as with the remaining features [94; 96]. However, it has been reported that correlation between features can have a great impact on permutation [94; 96], as the actual importance may be diffused when correlated features hold similar information. We ensured to eliminate the strongly correlated textural features by applying hierarchical clustering in the previous step.  
We estimated the importance of the 11 VIs and 14 textural features separately since they relate to different types of measurement. Permutation was repeated 20 times for each feature and the decrease in accuracy was averaged. Based on the mean decrease in accuracy, the features were ranked in decreasing importance order for the raw dataset (Figure 2a,b) and the refined dataset (Figure 2c,d), respectively. We performed permutation using the Scikit-learn package [88] in Google Colaboratory [89].  
The interpretation of the output was straightforward, e.g., NDVI yielded a 13% mean decrease in accuracy when it was randomly permuted and it was ranked first in importance for the refined dataset (Figure 2c). Ultimately, for the final selection, we considered the features that yielded a considerable decrease in accuracy. We selected the VIs with a mean decrease in accuracy greater than 8%, and the textural features with a mean decrease in accuracy greater than 6%. We ended up selecting the following:  
* TCI, NDVI, GNDVI and B6_savg for the raw dataset;
* NDVI, TCI, B12_savg and B8_savg for the refined dataset.  
The features that did not yield a decrease in accuracy were not taken into consideration. This was an indication that the feature set with the permuted feature happened to achieve higher accuracy than the original feature set, which was caused by random chance [97].