/
report-defoliation.Rmd
executable file
·179 lines (136 loc) · 4.67 KB
/
report-defoliation.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
---
title: "Prediction maps of defoliation at trees"
output:
workflowr::wflow_html:
includes:
in_header: header.html
editor_options:
chunk_output_type: console
author: "Patrick Schratz, Marc Becker, Friedrich-Schiller-University Jena"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(
fig.retina = 3,
fig.align = "center",
out.width = "100%",
echo = FALSE
)
source(here::here("code/99-packages.R"))
sourceDirectory("R")
# load drake objects
loadd(defoliation_raster,
defoliation_raster_relative,
defoliation_df,
defoliation_df_relative,
tune_xgboost
)
library("rgdal")
```
# Predicted defoliation (absolute)
Predicted defoliation by XGBOOST on 20 m spatial resolution in the Basque Country.
With an RMSE of 36 % (for a range of 0 - 100), the model focuses its prediction to the mean of the response range (0 - 100) to achieve acceptable performance results on the test set.
The following vegetation indices have been used, selected by the internal variable importance rating of XGBOOST:
- EVI
- GDVI4
- GDVI3
- GDVI2
- D1
- mNDVI
- mSR
# Optimization path of hyperparameter tuning
The following shows the optimization path (RMSE) of the hyperparameter tuning for the XGBOOST model using 20 MBO iterations (with a starting design of 30).
```{r}
suppressMessages(getOptPathY(tune_xgboost$opt.path))
```
Some more details on the optimization path are presented below:
```{r}
suppressMessages(plotOptPath(tune_xgboost$opt.path))
```
# Predicted Defoliation (relative)
Since these absolute values do not reflect the truth, we decided to create a relative Index from the predicted absolute values.
This was done by calling
```{r , eval=FALSE, echo = TRUE}
scale(data$defoliation, center = FALSE,
scale = max(data$defoliation, na.rm = TRUE)/100)
```
which re-scales the data from 0 - 100.
The code was adapted from [this](https://stackoverflow.com/a/19462405/4185785) Stackoverflow answer.
# Defoliation evaluation {.tabset .tabset-fade}
## Absolute defoliation {.tabset .tabset-fade}
### Maps
#### 2017
```{r defoliation-map-2017, fig.height = 5.5, fig.width = 8.5}
plot = create_defoliation_map(defoliation_raster[[1]],
algorithm = "XGBOOST",
limits = c(35, 60), title = "Defoliation of trees [%]"
)
suppressWarnings(suppressMessages(print(plot)))
```
#### 2018
```{r defoliation-map-2018, fig.height = 5.5, fig.width = 8.5}
plot = create_defoliation_map(defoliation_raster[[2]],
algorithm = "XGBOOST",
limits = c(35, 60), title = "Defoliation of trees [%]"
)
suppressWarnings(suppressMessages(print(plot)))
```
### Histograms
2017
```{r}
hist = suppressWarnings(suppressMessages(ggplot(defoliation_df[[1]], aes(x = defoliation)) +
geom_histogram() +
labs(x = "Defoliation (%)") +
theme_pubr()
))
suppressMessages(print(hist))
```
2018
```{r}
hist = suppressWarnings(suppressMessages(ggplot(defoliation_df[[2]], aes(x = defoliation)) +
geom_histogram() +
labs(x = "Defoliation (%)") +
theme_pubr()
))
suppressMessages(print(hist))
```
## Relative defoliation {.tabset .tabset-fade}
### Maps
#### 2017
```{r defoliation-map-relative-2017, fig.height = 5.5, fig.width = 8.5}
plot = create_defoliation_map(defoliation_raster_relative[[1]],
algorithm = "XGBOOST",
limits = c(65, 100), title = "Relative defoliation of trees"
)
suppressWarnings(suppressMessages(print(plot)))
```
#### 2018
```{r defoliation-map-relative-2018, fig.height = 5.5, fig.width = 8.5}
plot = create_defoliation_map(defoliation_raster_relative[[2]],
algorithm = "XGBOOST",
limits = c(65, 100), title = "Relative defoliation of trees"
)
suppressWarnings(suppressMessages(print(plot)))
```
### Histograms
2017
```{r}
hist = suppressWarnings(suppressMessages(ggplot(defoliation_df_relative[[1]], aes(x = defoliation)) +
geom_histogram() +
labs(x = "Relative defoliation of trees") +
theme_pubr()
))
suppressMessages(print(hist))
```
2018
```{r}
hist = suppressWarnings(suppressMessages(ggplot(defoliation_df_relative[[2]], aes(x = defoliation)) +
geom_histogram() +
labs(x = "Relative defoliation of trees") +
theme_pubr()
))
suppressMessages(print(hist))
```
```{r echo = FALSE}
system("rsync -rlptDivzog --chown=*:www-data --chmod=g+r,o+r /home/patrick/papers/2019-feature-selection/docs/figure/report-defoliation.Rmd/defol* patrick@jupiter.geogr.uni-jena.de:/home/www/life-healthy-forest/action-B1-spatial-mapping/defoliation-maps/"
)
```