## 3 The Vectorized Earth Observation Retrieval Classifier
### Feature Selection  
The percentile grid should include features with strong classification skills. This minimizes the number of cells with the mixed classes, as depicted in Figure 1. On the contrary, if the features have weak classification skills, many grid cells contain mixed classes and the derived probability field is not decisive, as depicted in Figure 2. In order to determine the optimal feature subset, VEOR applies an iterative forward selection procedure (see Figure 3 and Algorithm A2 in Appendix B) where the features are progressively added whenever the kappa score is improved. Forward selection starts with a single feature for which the percentile grid is simply a 1D histogram with classification probabilities. Then, for each grid cell (i.e., histogram bin), the K-nearest cells and Euclidean distances \(d_{k}\) are determined using a fast cKDTree nearest neighbor search method [74]. The selected K-nearest cells  
Figure 1: The derivation of classification probability for two clearly separable classes. The gray grid denotes the 0%, 10%, 20%, 30%,..., 90%, 100% percentiles for each feature. Figure 2: The derivation of classification probability for two weakly separable classes. The gray grid denotes the 0%, 10%, 20%, 30%,..., 90%, 100% percentiles for each feature. are used to reconstruct the classification probability \(P_{x}^{t}\) for cell \(x\) (Equation (2)). This is achieved by dividing two sums weighted by inverse Euclidean distances between cell coordinates expressed as percentile numbers (8-bit values). The first sum is computed as the weighted total number of samples labeled with 1 within the \(K\) cells. The second sum is the weighted total number of samples \(N_{k}\) within the \(K\) cells. The reconstructed probability value describes each sample within cell \(x\) and is ultimately rounded to a reconstructed binary label \(c_{i}^{\prime}\) for all samples within cell \(x\). \[P_{x}^{\prime}=\frac{\sum_{k=1}^{K}\frac{1}{d_{k}}\sum_{i=1}^{N_{k}}c_{i}}{ \sum_{k=1}^{K}\frac{1}{d_{k}}N_{k}} \tag{2}\]  
where:  
\(P_{x}^{\prime}\)--reconstructed probability value for cell \(x\);  
\(K\)--number of nearest neighbouring cells in the vicinity of cell \(x\);  
\(d_{k}\)--Euclidean distance between cell \(k\) and cell \(x\) expressed as a percentile number;  
\(N_{k}\)--number of samples within cell \(k\);  
\(c_{i}\)--binary label of a sample within cell \(k\). This allows for the computation of a confusion matrix between the original \(c\) and reconstructed \(c^{\prime}\) binary labels, and consequently for a derivation of the kappa score for a particular feature or combination of features. The next parameter to be optimized is the number of nearest neighbors (\(K\)) used to reconstruct the probability value. The higher the \(K\), the smoother the reconstructed classification probability field, which, on the one hand, reduces the impact of mislabeled samples (i.e., reduces noise effects), but, on the other, decreases the accuracy of correctly labeled data. Optimal \(K\) is derived iteratively for each feature combination by repeating the probability reconstruction procedure with increasing even numbers \(K\in\{2,4,6,\dots\}\). It was found that, for small odd \(K\) values, asymmetry is introduced around the class separation border. In particular, if \(K\) = 3 and the main cell is exactly at the class separation border, then two cells from one class and only one cell from the other class are used for reconstruction of the probability value. This obviously introduces bias into the reconstructed value. The optimal \(K\) number is derived whenever adding more neighbors starts to decrease the kappa score. After the kappa score is computed for all single features, then the feature with the highest kappa is selected, and within the following iterations, features are added to it. After the best two-feature subset is selected, single features are added again, and so on.