# Earth Observation and Biodiversity Big Data for Forest Habitat Types Classification and Mapping
## 2 Materials and Methods
### Classification
#### 2.4.2 Supervised Machine Learning Model  
For classifying all of the forest habitats, RF was used as supervised machine learning model [93], which has been successfully applied for classification purpose in the context of vegetation remote sensing (see [PERSON] et al. [52] for an exhaustive list of reference). RF is a decision tree algorithm and is currently the most popular ensemble method for classifying and predicting forest habitat types [96]. Because RF produced several independent trees by intensive resampling of different subset of predictors, it is natural to consider this adapted bootstrapping scheme for big data context [97]. In addition, in some studies of comparison between different classification algorithms, RF was found to be the most performing [30; 96; 98; 52], or at least comparable with other. Hence, when considering that the proposed study was not a comparison of classification methods, but a demonstrative procedure, the final choice was to apply the RF classifier. To build and grow trees, RF involves several hyperparameters that control both the structure of each individual tree (e.g., _nodesize_) and the structure and the size of the forest (e.g., _mtry_, _utree_). Despite that it is well known that RF works reasonably well with the default set of hyperparameters, their tuning can improve the performance of RF [99]. R package'mlr' [100] was used to tune the best RF hyperparameters combination, evaluating the following value ranges: _mtry_ from squared root of the number of variables predictors to the number of variables predictors minus 1; _min.node.size_ from 1 to 3; and, _utree_ from 401 to 1001. The best set of hyperparameter was chosen selecting the higher Cohen's kappa coefficient calculated using five-fold cross-validation with 20 repetitions.  
A two-stage hierarchical classification scheme using 'ranger' R-package [94] was built by training a total of 4 RF models, each one setup with a distinct set of predictors and hyperparameters. The first stage RF model classified EUNIS II level forest classes: deciduous broadleaved, evergreen broadleaved, and needleleaved (T1, T2, and T3, respectively). At the second stage, the other three RF models classified EUNIS III level for each EUNIS II class identified in the first stage.  
Each RF model was trained using a stratified random sample of 70% of data, and the model performance was tested using the remaining 30% (internal evaluation). The accuracy assessment of the procedure depends on a confusion matrix (error matrix) and the following accuracy measures derived from that: the Overall accuracy, the User's and Producer's accuracy, and their Standard error. The formulas to obtain the accuracy metrics and the standard error were presented in Stehman & Foody, 2019 [101]. The computing of the Cohen's kappa was also made.  
The trained RF models were applied to the selected sets of environmental, spectral, and temporal predictors in order to classify the forest habitat types for the entire Italian national territory. The Gini index was calculated to evaluate the importance of each predictor.  
The model classification was spatialized for the entire Italian territory to produce maps of habitat forest types according to EUNIS II and III levels. An additional qualitative check of the obtained results was done by expert judgment and the validity/accuracy was confirmed.