Jan Linnenbrink looks at spatial data:
This document shows the application of caret for spatial modelling at the example of predicting air temperature in Spain. Hereby, we use measurements of air temperature available only at specific locations in Spain to create a spatially continuous map of air temperature. Therefore, machine-learning models are trained to learn the relationship between spatially continuous predictors and air temperature.
When using machine-learning methods with spatial data, we need to take care of, e.g., spatial autocorrelation, as well as extrapolation when predicting to regions that are far away from the training data. To deal with these issues, several methods have been developed. In this document, we will show how to combine the machine-learning workflow of caret with packages designed to deal with machine-learning with spatial data. Hereby, we use
blockCV::cv_spatial()
andCAST::knndm()
for spatial cross-validation, andCAST::aoa()
to mask areas of extrapolation. We use sf and terra for processing vector and raster data, respectively.
Click through to see how it all works. H/T R-Bloggers.