Skip to main content

A prediction-domain adaptive approach to spatial machine learning model evaluation

This blog post introduces prediction-domain adaptive evaluation, an approach that adapts model evaluation to the places and conditions where predictions will be used.
spatial
spatial-machine-learning
rstats
paper
Author
Published

December 6, 2026

Spatial machine learning is used to predict phenomena at locations where we do not have observations. It uses information about the phenomenon at observed locations (the outcome variable) and relationships between the outcome and its predictors to make predictions at new locations.

Spatial machine learning can be used for various purposes, including prediction and understanding spatial patterns or relationships between variables. Here, I focus on prediction: our goal is to create a continuous map of the phenomenon of interest based on information from observed locations.

NoteReferences

This blog post summarizes the main ideas from our recent paper, Moving beyond spatial and random cross-validation in environmental modelling: a call for prediction-domain adaptive evaluation.

It also uses figures from my talk at the Machine Learning for Earth Observation (ML4EO) 2026 conference. You can find my slides and a recording of the talk online.

Evaluation

When making spatial machine learning predictions, our goal is often to create the most accurate map possible. This requires good measurements of the phenomenon, high-quality and well-selected predictors, and a model that captures the relationships between the phenomenon and its predictors. Even when we have all of these1, we still need one more thing: we need to know how much we can trust the predictions. That is the role of model evaluation.

An example of sampling locations and the prediction domain

Model evaluation needs to reflect the goal of the model. If we want to make predictions for a specific area (the prediction domain), then we need to evaluate performance in a way that represents that area.2 An important aspect of model evaluation is that we usually have observations at only some locations, but want to assess performance across the whole prediction domain.

NoteTL;DR

In (spatial) machine learning, it is easy to misestimate model performance when the validation data do not represent the conditions encountered across the prediction domain. Instead, we should evaluate the model in the context of its goal. Here, the goal is to make predictions for a specific area, and we want to know how well the model will perform there. To do this, we need to match the evaluation approach to our prediction goal and account for how the locations of our observations relate to the prediction domain.

Relationship between the prediction domain and the locations where we have observations

Let’s start with a fairly simple case: we have randomly distributed observations across the prediction domain and want to make predictions for the whole area. Instead of focusing only on the locations where we have observations, we can focus on the locations where we want to make predictions. In this case, we want to make predictions for many raster cells in the prediction domain.

Random sampling locations (left) and the distribution of distances to the nearest observation for sampling locations (sample-to-sample) and prediction raster cells (prediction-to-sample) (right)

We can characterize both the prediction domain and the observed locations by their distances to the nearest observation. For example, we can measure how far each raster cell is from the nearest observed location. Here, we use distance as a proxy for prediction difficulty: we assume that predicting at a raster cell farther from an observation is more difficult. With random sampling, the distributions of distances from raster cells and from observed locations to their nearest observation are similar. We can therefore expect model performance at the observed locations to resemble performance at the prediction locations. In this case, evaluation at observed locations held out from model training can represent performance at the locations where we want to make predictions.

Now, take a look at a different situation: we have clustered observations, and we want to make predictions for the whole area.

Clustered sampling locations (left) and the distribution of distances to the nearest observation for sampling locations (sample-to-sample) and prediction raster cells (prediction-to-sample) (right)

Here, distances from raster cells to the nearest observation are usually much greater than distances from observed locations to their nearest observation. Thus, many raster locations are far from the nearest observation, and we can expect the model to perform worse at those locations than at the observed locations. In this case, evaluation at the observed locations will not represent performance at the locations where we want to make predictions. So, how can we evaluate the model appropriately in this case?

Evaluation approaches

An independent probability sample of the prediction area is preferable for estimating map accuracy. However, such a sample is often unavailable, and we need to evaluate the model using the available observations. Then, one common option is k-fold cross-validation, in which we split the data into folds. We train the model on some folds and evaluate it on the remaining fold, repeating this process until each fold has been held out. We can then combine the held-out predictions from all folds and calculate an error metric.

The main question is how to split the data into folds. One option is to split the data randomly, a common approach in machine learning. Observations are assigned to folds without considering their locations. Another option is to create folds based on spatial proximity. Nearby observations may be grouped together so that farther-away observations are in different folds. The first approach is called random cross-validation, and the second is called spatial cross-validation3.

Importantly, there is an interplay between the spatial distribution of the observed locations and the choice of validation method.

Relationship between sampling pattern and validation method. Colors represent different folds.

If observations are randomly distributed across the prediction domain, random cross-validation is appropriate because it provides an evaluation representative of model performance at the prediction locations. However, with clustered observations, random cross-validation will often place nearby observations in different folds. Nearby observations are often more similar than observations farther apart. Held-out observations close to the training observations can therefore be easier to predict than locations farther away, making the evaluation overly optimistic for the prediction domain as a whole.

Conversely, with clustered observations, spatial cross-validation4 can provide an evaluation representative of performance at the prediction locations. Grouping nearby observations in the same fold can increase the distance from held-out locations to the training data. With random sampling, spatial cross-validation may instead create folds whose held-out observations are farther from the training data than most prediction locations (raster cells) are. In that case, the evaluation can be overly pessimistic.

In short, the choice of validation method should depend on the sampling pattern in relation to the prediction domain. Real sampling patterns often fall between these two examples, so the separation needed between training and held-out locations depends on where we want to predict.

Adaptive evaluation

Prediction-domain adaptive evaluation uses the intended prediction task to guide how we evaluate a model. There are several ways to put this into practice. These include NNDM (nearest-neighbor distance matching), kNNDM (k-fold nearest-neighbor distance matching), DA-CV (dissimilarity-adaptive cross-validation), and others.5

Let’s focus on kNNDM here. The kNN distance matching approach compares how far prediction locations (e.g., raster cells) are from observed locations with how far held-out observations are from the training data. It then creates folds so that the distances for held-out observations resemble those for prediction locations. In other words, we want to evaluate the model under conditions with similar difficulty to the prediction task. Here, we use distance to the nearest observation as a measure of that difficulty.

The figure below shows how kNN distance matching works in practice. With random sampling across the prediction domain, distances to the nearest observation are similar for observed and prediction locations. The folds created by kNN distance matching are therefore similar to those from random cross-validation. With clustered sampling, distances to the nearest observation are generally greater for prediction locations, so the resulting folds are more similar to those from spatial cross-validation.

Folds assigned by kNNDM for random and clustered sampling

Comparison of evaluation methods

To compare cross-validation methods, I created a separate simulation in which the true outcome is known across the entire prediction domain. This makes it possible to compare each method’s error estimate with the actual prediction error across all raster cells, as well as with errors at sampled locations. The prediction domain is Germany, and the simulated outcome is generated from four predictors: temperature, precipitation, elevation, and slope. In each of 99 runs, random and clustered sampling designs each consist of 500 observations. A random-forest model is evaluated using 10-fold random, spatial, and kNN distance matching cross-validation, and RMSE is calculated for each method. The figure compares each estimated RMSE with the true RMSE across the full domain. A value of zero on the y-axis indicates that the cross-validation estimate equals the true RMSE. Positive values mean the estimate is larger (too pessimistic), and negative values mean it is smaller (too optimistic).

Relationship between cross-validation estimates and true RMSE for different sampling designs and cross-validation approaches

In this simulation, random cross-validation estimates were close to the true RMSE with random sampling and overly optimistic with clustered sampling. The spatial cross-validation method used here came closer to the true RMSE than random cross-validation with clustered sampling but was overly pessimistic with random sampling. The kNN distance matching approach adapts to the sampling pattern in relation to the prediction domain and is designed to evaluate the model at a difficulty similar to that of the prediction task. The kNNDM estimates were centered near the true RMSE for both sampling designs, with more variation under clustered sampling. However, when predictions involve conditions that cannot be represented by the available observations, such as full extrapolation to a substantially different area, even adaptive evaluation may not provide a reliable estimate of prediction performance.

Conclusions

The evaluation of spatial machine learning models should reflect the final goal, which is often to make predictions for a specific area. In such cases, the evaluation approach should be adapted to the prediction domain and designed to evaluate the model at a difficulty similar to that of the prediction task. Several approaches can do this, including kNN distance matching, which creates cross-validation folds that resemble the prediction task. As a result, the evaluation is intended to represent model performance at the locations where we want to make predictions.

Prediction-domain adaptive evaluation is a general approach that can be applied to various types of prediction domains, including geographic space, predictor space, and others. However, it is not a silver bullet6, and it does not replace the need to carefully consider the sampling design, predictors, model, evaluation metrics, uncertainty quantification, and interpretation of the results.

For a more detailed discussion of prediction-domain adaptive evaluation, read our recent paper Moving beyond spatial and random cross-validation in environmental modelling: a call for prediction-domain adaptive evaluation. The paper includes a reproducible appendix demonstrating prediction-domain adaptive evaluation in practice, available online. I also presented this work at the Machine Learning for Earth Observation (ML4EO) 2026 conference. You can find my slides and a recording of the talk.

Footnotes

  1. …and often we don’t↩︎

  2. Similarly, if we want to make predictions in other areas or under different conditions, we need an evaluation approach that represents those areas or conditions.↩︎

  3. There are many ways to create spatial folds, so spatial cross-validation is actually a family of methods.↩︎

  4. (With well-designed spatial folds.)↩︎

  5. Visit the PDAV repository for a list of methods and their implementations in R.↩︎

  6. Sadly.↩︎

Citation

BibTeX citation:
@online{nowosad2026,
  author = {Nowosad, Jakub},
  title = {A Prediction-Domain Adaptive Approach to Spatial Machine
    Learning Model Evaluation},
  date = {2026-12-06},
  url = {https://jakubnowosad.com/posts/2026-12-06-predictiondomain-bp1/},
  langid = {en}
}
For attribution, please cite this work as:
Nowosad, Jakub. 2026. “A Prediction-Domain Adaptive Approach to Spatial Machine Learning Model Evaluation.” December 6. https://jakubnowosad.com/posts/2026-12-06-predictiondomain-bp1/.
You can support my work with a coffee: ko-fi