# Comparing PlanetScope and Sentinel-2 Imagery for Mapping Mountain Pines in the Sarntal Alps, Italy
## 2 Materials and Methods
### Methods
#### 2.3.3 Random Forest Classification and Validation  
We selected a Random Forest model [50] to map the mountain pine stands in the Sarntal Alps. Random Forest is a non-parametric machine learning algorithm that can handle high-dimensional datasets and was shown to be highly capable of accurately classifying alpine tree species [10; 23; 24; 25; 29]. For the individual feature spaces of each classification scheme (Table 1), we trained a Random Forest model with identical training data (Figure 3) using the R package \"caret\" [51]. The number of trees was kept constant at 500, as suggested in previous studies [23; 24], and confirmed by our initial classification tests, which did not show a notable influence of the number of trees on the model output accuracies. To find the optimal number of features at each decision node for each feature space, we tuned the respective parameter using a 10-fold cross-validation approach. A majority filter (3 \(\times\) 3) was then applied to each model output to reduce classification noise.  
To assess the accuracy of the different mountain pine classifications, we compared the classification maps visually and derived the confusion matrix for each classification result using the validation dataset (Section 2.2.4). We calculated the overall accuracy (OA) (Equation (1)), Kappa coefficient, user's accuracy (UA) (Equation (2)), and producer's accuracy (PA) (Equation (3)) (Tables A1-A10):  
\[\text{Overall accuracy (OA)}=\frac{N_{00}+N_{11}}{N} \tag{1}\]  
\[\text{User}^{\prime}\text{s accuracy (UA)}=\frac{N_{11}}{N_{10}+N_{11}} \tag{2}\]  
\[\text{Producer}^{\prime}\text{s Accuracy (PA)}=\frac{N_{11}}{N_{01}+N_{11}} \tag{3}\]  
with \(N\) equivalent to the total number of reference points and \(N_{00}\) and \(N_{11}\) the number of correctly classified reference points for the other land cover class (class 0) and mountain pine class (class 1). The formulae of UA and PA are displayed for class 1 with \(N_{10}\) equivalent to the number of reference points falsely not classified as mountain pine (false negative) and \(N_{01}\) the number of reference points falsely classified as mountain pine (false positive).  
Additionally, receiver operating characteristic (ROC) curves and the respective area under the curve (AUC) [52] were calculated for each classification result. ROC visualizes the tradeoff between true positive and false positive rates, which helps to assess the actual predictive power of a model [52]. AUC is a measure for the area between a model's ROC curve and the diagonal representing a random classification result. High AUC values indicate a high class separability of the model [52].  
We selected the classification with the highest OA to map and analyze the spatial pattern of mountain pines in the Sarntal Alps. To reduce the effects of the topographic relief in mountainous regions [53], we calculated the real surface area using the software SAGA GIS Version 8 [54] using the function \"Real Surface Area\" and the slope derived from the DTM. Additionally, we derived spatial statistics considering elevation, slope, aspect and patch size to better understand the distribution of mountain pines in our final classification result.