# Sugarcane Yield Mapping Using High-Resolution Imagery Data and Machine Learning Technique
## 2 Materials and Methods
### Yield Data and Predictive Models  
The sugarcane yield maps used as a reference for modeling were generated for both sugarcane growing seasons by an on-board commercial sensor-system (Solinftec, Aracatuba, Sao Paulo, Brazil) that measures the difference in hydraulic pressure of the harvester chopper calibrated to the real total yield. A Global Navigation Satellite System (GNSS) receiver with Real-Time Kinematic (RTK) differential correction signal (GPS L1/L2 + Glonass) was installed on the harvesters for georeferencing the data every five seconds (0.2 Hz). The base station was fixed in a georeferenced point at the sugar mill, which is commonly used for other agricultural operations. Two harvesters generated the data for each season with an average speed of 1.6 m s\({}^{-1}\). The machine cuts each row at a time following an auto-steering file previously available from mechanical planting. The original data were converted to sugarcane yield based on the weight distribution of the haulage and filtered, according to the methodology described by [PERSON] and [PERSON] [44]. The removal of a significant amount of points is expected due to the associated error on the yield data due to the sugarcane flow stabilization time and elevator time [44]. Although filtering yield data is a common practice in PA for any crop, issues related with high spatial density and data noise make the adequate filtering of yield monitor data, which is especially important for sugarcane, with a significant amount of raw data being possibly deleted as a result [44]. The semivariogram and the interpolation of the data were carried out using Vesper 1.6 software [45] with the ordinary kriging method (spatial resolution of 10.0 m \(\times\) 10.0 m). The input parameters for the variogram calculation of both datasets were: 30 lags, 50% lag tolerance, and a maximum distance of 200 m, which were considered the best adjustment parameters for semivariogram calculation. Aware of the uneven availability of orbital images from year to year, the average value of the orbital imagery data that composed each phenological stage was used. For example, in season 2017/2018, the value set to the ripening stage 1 (R1) was the average value of the images from \"08/13,\" \"08/18,\" \"08/23,\" and \"08/28.\" Thus, as the four fields present the same variable predictors (imagery data), the datasets from both seasons were grouped. For developing the predictive yield models, the spectral bands, VIs, and sugarcane yield data from each field were combined into an entire dataset. The number of observations from the entire dataset was randomly divided into the training (2/3) and testing (1/3) dataset considering both cropping seasons. All statistical analyses and yield prediction models were performed using the R 3.5.5 software [46] with the built-in function \"_lm_\" for the MLR model, and \"_randomForest_\" from the random forest package [47] for RF regression. As it is required, the results are reproducible and the function \"_set.seed_\" was used with the value 123 before fitting the predictive models. The predictive yield model based on MLR was fitted for each type of predictor variables (spectral bands, GNDVI, NDVI, NDRE, and WDRVI). Aiming to improve MLR prediction accuracy, the variable selection was carried out by relying on the \(p\)-value < 0.05, and that process was conducted until all the predictor variables that had a \(p\)-value > 0.05 were eliminated. To find the \(p\)-value, the built-in function \"_summary_\" from R 3.5.5 software [46] was used. An additional exploratory analysis was the spatial correlation between the VIs for each period of the sugarcane development cycle and yield data using [PERSON]'s correlation coefficient (r). The synthesis of the methodology is shown in Figure 2.  
For the RF regression predictions, it was necessary to fine-tune two parameters: (a) _ntree_, the average result of many trees, and (b) _mtry_, predictor subset value.