## 2 Materials and Methods
### Sampling of Training Patch
#### 2.2.2 Defining Class Homogeneity of Study Area  
The class purity of a training patch measures a degree of homogeneity of class compositions in a training patch. The compositional homogeneity within a training patch can vary across the study area according to the landscape heterogeneity [22; 39]. Therefore, the spatial heterogeneity of the study area should be considered to better understand the effect of the class purity of a training patch on the performance of patch-based classification.  
In this study, class homogeneity was first quantified in a patch unit and then used to quantify the spatial heterogeneity over the study area. First, local class homogeneity (LCH) was defined using class information within each patch in the study area. The class information is readily available from the ground truth data of the study area. More specifically, LCH was defined by modifying the homogeneity index used to evaluate the compositional homogeneity in a previous study [22]. The homogeneity index in [PERSON] et al. [22] was calculated in a specific region, whereas the LCH in this study was calculated in a patch with a fixed size as follows:  
\[\text{LCH }=\frac{\ln(m)+\sum_{i=1}^{n}P_{i}\ln(P_{i})}{\ln(m)} \tag{1}\]  
where \(m\) and \(n\) denote the total number of crop types in the study area and that present in a patch, respectively; \(P_{i}\) is the proportion of the \(i\)th class within a patch.  
The LCH ranges between 0 and 1. A higher LCH value indicates that a patch has a more homogeneous class composition and vice versa. LCH is 1 when only one crop type exists in a patch.  
As the LCH can vary across the study area, another index, called global class homogeneity (GCH), is newly defined to quantify class homogeneity over an entire study area as a global statistic. The GCH is defined as the average of LCH values computed within all the patches in the study area:  
\[\text{GCH }=\frac{\sum_{k=1}^{K}\text{LCH}_{k}}{K} \tag{2}\]  
where \(K\) denotes the total number of patches in the study area and LCH\({}_{k}\) is an LCH value of the \(k\)th patch. As a patch configuration with a predefined size is applied to all pixels in the study area, \(K\) corresponds to the number of all crop pixels in the study area. Similar to LCH, GCH has a value between 0 and 1. A GCH value closer to 1 indicates that the overall class composition in the study area is homogeneous.  
As mentioned above, the LCH may vary significantly across the study area; however, GCH is a location-invariant global statistic. Consequently, it may be difficult to compare GCH values between any study areas with significant differences in class homogeneity. To quantify relative variations of the LCH with respect to the GCH for comparison with GCH values, a coefficient of variation (CV) of the LCH was also computed using the LCH and GCH:  
\[\text{CV }=\frac{\sum_{k=1}^{K}(\text{LCH}_{k}-\text{GCH})^{2}/(K-1)}{\text{ GCH}} \tag{3}\]  
where the numerator is the standard deviation of all LCH values in the study area.  
The higher the CV, the greater are the variations of the LCH over the study area, indicating that the variations in the LCH are more significant, and that there are many patches including boundaries between different crop parcels. In this study, both GCH and CV values were used to quantify the spatial characteristics of the study area.