## 2 Materials and Methods
### Model Training  
To train the machine learning model for the random forest classification of land cover types, Sentinel-2 image composites were created for 12 Sentinel-2 tiles (Table 2) from the least cloud-covered images acquired in the calendar year 2019 over Mato Grosso (Figure 4). Figure 3: High-level workflow from the Sentinel-2 Earth observation data through the PyEO algorithm, generating an analyst report. The report is uploaded to the Agrimetrics platform where it is merged with the farm location data by a customer, producing a company report with input from a ForestMind Analyst. Each tile has an area of 100 km \(\times\) 100 km = 10,000 km\({}^{2}\). To collect training data, polygons of known land cover types were visually delineated using the QGIS geographic information system [21] and a land cover class was assigned to the attribute table (Table 1). The training polygons were saved in a shapefile for each Sentinel-2 image tile. During the model training step, all polygons from all Sentinel-2 image composites across the 12 tiles were read into a data table together with their assigned land cover class codes and rasterised to the Sentinel-2 spatial resolution of 10 m. Random forest model training was carried out for 500 decision trees with the scikit-learn library [22], and the trained model was saved to a Python standard pkl file. Figure 4: Overview map of the Sentinel-2 Tile IDs of the 100 km \(\times\) 100 km granules used for training the random forest model on image composites of the 30 least cloud-covered images acquired in the year 2019 over Mato Grosso State, Brazil. Background map OpenStreetMap. In total, 75% of the training pixels were used for random forest model training, and 25% were held back for validation. An initial model training with all pixels from all polygons resulted in a low classification accuracy of 56% for the independent validation pixels, even though the accuracy of the 75% training pixels was 99.9%. The distribution of training pixels by class was found to be heavily unbalanced: class 1 had 1,708,257 training pixels, class 3 had 1,464,283, class 4 had 388,431, class 5 had 57,269, class 11 had 540,293, and class 12 had as few as 36,085 training pixels. To achieve a more balanced distribution of training pixels per class, a limit of a factor of 10 in the sample size ratios was introduced. From each land cover class that had more than 10 times the number of training pixels compared to the least frequent class, a random sample of pixels was drawn; in this case, 360,850 pixels. This more balanced random forest classification model achieved a validation accuracy of 92.8% when compared to the 25% of independent validation pixels, and 99.9% for the 75% of pixels that were used to train the model. The feature importance \(f\) of the model shows that band 4 was the most important spectral band for discrimination of the land cover types (\(f_{4}\) = 0.38), followed by band 8 (\(f_{8}\) = 0.29), band 3 (\(f_{3}\) = 0.19), and band 2 (\(f_{2}\) = 0.13). Table 3 shows the confusion matrix and Table 4 the spectral signatures of the classes from the training data. The achieved accuracy of 92.8% was considered sufficiently high to use this model in the due diligence application. \begin{table}
\begin{tabular}{c c} \hline \hline
**Granule ID** \\ \hline T21 LTD \\ T21 LTF \\ T21 LTG \\ T21 LUD \\ T21 LUE \\ T21 LUF \\ T21 LUG \\ T21 LVD \\ T21 LVE \\ T21 LVG \\ \hline \hline \end{tabular}
\end{table} 
Table 2: List of Tile IDs of the Sentinel-2 image composites used for training the random forest model ‘mato_rf_toby_1’. All image composites were made from the median bottom-of-atmosphere radiance of the RGB and NIR bands at 10 m resolution from the 30 least cloud-covered images acquired during the calendar year 2019.