mlr3spatial

tic Coverage status CodeFactor Lifecycle:experimental

Package scope

The handling of (large) spatial objects ({terra}, {raster}, {stars}, {sf} in ML is an error-prone and time consuming task. Users often need to extract the “raw” values from the spatial objects (detaching the spatial metadata), train a model, predict and then recreate the spatial object again.
In addition, predictions on large raster files (i.e. multiple GB in size) often leads to memory issues on consumer grade machines. {mlr3spatial} tries to help here by

Spatiotemporal resampling / cross-validation

For spatiotemporal resampling within mlr3 see {mlr3spatiotempcv}.

FAQ

Do I need to use TaskClassifST/TaskRegrST with {mlr3spatial}?
No, you can use TaskClassif and TaskRegr. However, their *ST equivalents will also work. When we introduced the *ST tasks, we had no support for spatial backends yet and there was a need to store the spatial information somewhere.
Why is {mlr3spatial} faster when predicting compared to the native spatial packages?
{mlr3spatial} makes use of the parallel prediction heuristic within {mlr3}. This one makes use of the {future} and {data.table} packages for parallelization and data handling. If {mlr3spatial} is faster, than this way seems to be more efficient than the parallelization built into the respective other packages.
Can I make use of parallel predictions during nested resampling/tuning?
Yes, {mlr3} supports (nested) parallelization via the {future} framework. Watch out for required resources when having multiple parallelized layers.
Will {mlr3spatial} support spatial learners?
Eventually. It is not yet clear whether these would live in {mlr3extralearners} or in {mlr3spatial}. So far there are none yet.
Why are there two packages, {mlr3spatial} and {mlr3spatiotempcv}?
{mlr3spatiotempcv} is solely devoted to resampling techniques. There are quite a few and keeping packages small is one of the development philosophies of the mlr3 framework. Also back in the days when {mlr3spatiotempcv} was developed it was not yet clear how we want to structure additional spatial components such as prediction support for spatial classes and so on.

Articles