Spatio-temporal extensions for mlr3.

This package extends the mlr3 package framework by spatiotemporal resampling and visualization methods.

Resampling methods

Currently, the following ones are implemented:

Literature Name R Package Reference mlr3spatiotemporal Name
Spatial CV sperrorest Brenning 2012 ResampleSpCVCoords
Spatial Blocking blockCV Valavi 2019 ResampleSpCVBlock
Environmental Blocking blockCV Valavi 2019 ResampleSpCVEnv
Spatial Buffering blockCV Valavi 2019 ResampleSpCVBuffer

Spatial tasks

  • Task “ecuador” -> mlr_tasks$get("ecuador")
  • Task “diplodia” -> mlr_tasks$get("diplodia")

Visualization methods

Generic S3 function autoplot() for all implemented spatial resampling methods.

The following example shows the resampling method "spcv-coords".

Visualization of all partitions

library(mlr3)
library(mlr3spatiotemporal)
library(ggplot2)

task = tsk("ecuador")
resampling = rsmp("spcv-coords", folds = 5)
resampling$instantiate(task)

autoplot(resampling, task)

Visualization of the first fold only

autoplot(resampling, task, fold_id = 1)

References

**Brenning**, A, 2012. “Spatial cross-validation and bootstrap for the assessment of prediction rules in remote sensing: The R Package sperrorest.” In *2012 IEEE International Geoscience and Remote Sensing Symposium*, 5372–5. .
**Valavi** R, Elith J, Lahoz-Monfort JJ, Guillera-Arroita G. blockCV: An R package for generating spatially or environmentally separated folds for k-fold cross-validation of species distribution models. Methods Ecol Evol. 2019; 10:225–232. doi.org/10.1111/2041-210X.13107