CoChat

kNNDM CV: k-fold nearest-neighbour distance matching cross-validation for map accuracy estimation

Open access
Linnenbrink, Jan, Milà, Carles, Ludwig, Marvin, Meyer, Hanna · 2024 · Geoscientific Model Development

Published version of a preprint

The DOI matches its Crossref record; 42 of the 43 references it cites were found in a registry or an index; 14 of the 23 sources its claims cite were checked for support.

Abstract

Random and spatial cross-validation (CV) methods are commonly used to evaluate machine-learning-based spatial prediction models, and the performance values obtained are often interpreted as map accuracy estimates. However, the appropriateness of such approaches is currently the subject of controversy. For the common case where no probability sample for validation purposes is available, in Milà et al. (2022) we proposed the nearest-neighbour distance matching (NNDM) leave-one-out (LOO) CV method. This method produces a distribution of geographical nearest-neighbour distances (NNDs) between test and training locations during CV that matches the distribution of NNDs between prediction and training locations. Hence, it creates predictive conditions during CV that are comparable to what is required when predicting a defined area. Although NNDM LOO CV produced largely reliable map accuracy estimates in our analysis, as a LOO-based method, it cannot be applied to the large datasets found in many studies. Here, we propose a novel k -fold CV strategy for map accuracy estimation inspired by the concepts of NNDM LOO CV: the k -fold NNDM (kNNDM) CV. The kNNDM algorithm tries to find a k -fold configuration such that the empirical cumulative distribution function (ECDF) of NNDs between test and training locations during CV is matched to the ECDF of NNDs between prediction and training locations. We tested kNNDM CV in a simulation study with different sampling distributions and compared it to other CV methods including NNDM LOO CV. We found that kNNDM CV performed similarly to NNDM LOO CV and produced reasonably reliable map accuracy estimates across sampling patterns. However, compared to NNDM LOO CV, kNNDM resulted in significantly reduced computation times. In an experiment using 4000 strongly clustered training points, kNNDM CV reduced the time spent on fold assignment and model training from 4.8 d to 1.2 min. Furthermore, we found a positive association between the quality of the match of the two ECDFs in kNNDM and the reliability of the map accuracy estimates. kNNDM provided the advantages of our original NNDM LOO CV strategy while bypassing its sample size limitations.

Overview

CoChat Summary

TL;DR

The paper introduces kNNDM CV, a k-fold nearest-neighbour distance matching cross-validation method for map accuracy estimation that extends NNDM LOO CV to larger datasets. In simulations, kNNDM performed similarly to NNDM LOO CV and produced reasonably reliable map accuracy estimates across sampling patterns while greatly reducing computation time.

Key findings

  • kNNDM CV yielded reliable error estimates across all sampling patterns considered, similar to and sometimes more accurate than NNDM LOO CV; random 10-fold CV was reliable under random sampling but failed for clustered data, while spatial 10-fold CV overestimated mapping error except for RMSE in the strong clustering scenario and had the largest variability.
  • For 4000 strongly clustered training points, kNNDM CV reduced time spent on fold assignment and model training from 4.8 d to 1.2 min compared with NNDM LOO CV; for random samples, it reduced this from 3.2 h to 30 s.
  • The quality of the match between NND ECDFs, measured by the Wasserstein statistic \(W\), was positively associated with the quality of map accuracy estimates; in the first simulation this relationship was linear with at least 60 % explained variance, with regression \(R^2\) values of 0.66, 0.6, and 0.73 for RMSE, \(R^2\), and MAE, respectively.
  • Larger numbers of folds gave better matches for regular and random samples, but for strongly clustered designs \(k=2\) was overly pessimistic and \(k=4\) or 6 performed better.

Methods

  • The kNNDM algorithm seeks a k-fold configuration whose empirical cumulative distribution function of nearest-neighbour distances between test and training locations during CV matches the ECDF of nearest-neighbour distances between prediction and training locations; it uses clustering to create candidate fold configurations and selects the one minimizing the Wasserstein statistic \(W\), after a one-sided Kolmogorov–Smirnov test for clustering.
  • Simulation 1 used a virtual response surface for the Iberian Peninsula generated from WorldClim bioclimatic variables and the virtualspecies R package, with five sampling distributions and sample size 100; 100 iterations produced 500 fitted random forest models, and CV methods compared were random 10-fold CV, spatial 10-fold CV via k-means, NNDM LOO CV, and 10-fold kNNDM CV, evaluated with RMSE, MAE, and \(R^2\).
  • An additional simulation modelled above-ground biomass in Europe using 22 predictors and 5000 sample points across five sampling designs, comparing random 10-fold CV, spatial 10-fold CV, and 10-fold kNNDM CV; a run-time analysis used sample sizes from 100 to 4000 training points for strongly clustered and random designs.

Limitations

  • The paper states that kNNDM has lower flexibility than NNDM LOO CV because every observation must be assigned to a fold; matching may be impossible if the range of prediction NNDs differs from the range of training NNDs, especially under complete model transfer, so inspection of NND ECDFs is recommended.
  • The paper states that kNNDM may still fail to match predictive conditions for very clustered training data, and recommends allowing a greater maximum fold size, using a lower fold number \(k\), or restricting the prediction area to the area of applicability; it also notes that NNDM-based methods are purely geographical, ignore feature space, do not address slight error overestimation for regular samples, ignore location/direction of distances, require the prediction area not to change, and cannot be used when the prediction area is unknown.
  • The text makes evident that the \(W\)-accuracy relationship was weaker in the second, continental-scale simulation, where \(W\) explained only 28 % of the variance in absolute RMSE differences, and kNNDM gave overly optimistic estimates in the strongly clustered design; this suggests other factors such as feature-space distances may matter.

Model-written summary. Check it against the paper before relying on it.

Integrity signals

Registry

Crossref · 10.5194/gmd-17-5897-2024

Cites

42 of 43 references verified0 citation errors · 1 not checkable

Statistics

Nothing to recompute.

Figures

Image 1
CC-BY · From the PDF
Figure 2 Workflow of the kNNDM algorithm.
Figure 2 Workflow of the kNNDM algorithm.CC-BY · From the PDF
Image 3
CC-BY · From the PDF
Figure 4 Data used in the simulation: (a) bioclimatic covariates and response (all linearly stretched to [0 ; 1] for visualisation purposes) and (b) an example of one iteration of the sample simulation. Figure reproduced from Milà et al. (2022).
Figure 4 Data used in the simulation: (a) bioclimatic covariates and response (all linearly stretched to [0 ; 1] for visualisation purposes) and (b) an example of one iteration of the sample simulation. Figure reproduced from Milà et al. (2022).CC-BY · From the PDF
Figure 5 Differences between cross-validated and true RMSE, R 2 , and MAE by sampling distribution and CV method for the simulated virtual response variable.
Figure 5 Differences between cross-validated and true RMSE, R 2 , and MAE by sampling distribution and CV method for the simulated virtual response variable.CC-BY · From the PDF
Figure 6 Relationship in 10-fold kNNDM between the absolute value difference between the CV and true map accuracy statistics ( y axis) and W statistic ( x axis) for the RMSE (a) , R 2 (b) , and MAE (c) statistics. Colour represents the data point density. The black line shows the linear regression fit. The R 2 values of the regression models are 0.66, 0.6, and 0.73 for the RMSE, R 2 , and MAE, respectively.
Figure 6 Relationship in 10-fold kNNDM between the absolute value difference between the CV and true map accuracy statistics ( y axis) and W statistic ( x axis) for the RMSE (a) , R 2 (b) , and MAE (c) statistics. Colour represents the data point density. The black line shows the linear regression fit. The R 2 values of the regression models are 0.66, 0.6, and 0.73 for the RMSE, R 2 , and MAE, respectively.CC-BY · From the PDF
Figure 7 CV error estimates for kNNDM CV with different values of k (first three rows). The respective W statistic is shown in the fourth row. Points indicate median values, while error bars show the first and third quartile.
Figure 7 CV error estimates for kNNDM CV with different values of k (first three rows). The respective W statistic is shown in the fourth row. Points indicate median values, while error bars show the first and third quartile.CC-BY · From the PDF
Figure 8 Differences in computational time (log-scaled) between 10-fold kNNDM CV (red) and NNDM LOO CV (blue) for two different sample designs (rows).
Figure 8 Differences in computational time (log-scaled) between 10-fold kNNDM CV (red) and NNDM LOO CV (blue) for two different sample designs (rows).CC-BY · From the PDF
Figure A1. Data used in the AGB simulation. Panel (a) shows a subset of the 22 predictors, as well as the response raster. Rasters were linearly stretched to [0 ; 1] for visualisation purposes. Panel (b) shows one iteration of the different sampling designs. Data from de Bruin et al. (2022).
Figure A1. Data used in the AGB simulation. Panel (a) shows a subset of the 22 predictors, as well as the response raster. Rasters were linearly stretched to [0 ; 1] for visualisation purposes. Panel (b) shows one iteration of the different sampling designs. Data from de Bruin et al. (2022).CC-BY · From the PDF
Figure A2. Differences between cross-validated and true RMSE; 'kNNDM [tuned]' refers to the kNNDM split that yielded the lowest W statistic among different numbers of folds k 2 f 2 ; 4 ; 6 ; : : :; 20 g .
Figure A2. Differences between cross-validated and true RMSE; 'kNNDM [tuned]' refers to the kNNDM split that yielded the lowest W statistic among different numbers of folds k 2 f 2 ; 4 ; 6 ; : : :; 20 g .CC-BY · From the PDF
Figure A3. Relationship between the absolute value difference between the CV and true RMSE ( y axis) with the W statistic ( x axis). Here, W explained 28 % of the variation in the absolute value RMSE differences.
Figure A3. Relationship between the absolute value difference between the CV and true RMSE ( y axis) with the W statistic ( x axis). Here, W explained 28 % of the variation in the absolute value RMSE differences.CC-BY · From the PDF
Figure A4. The influence of different numbers of k on the difference between the cross-validated and true RMSE (upper row) and on the W statistic (lower row). Points indicate median values, while error bars show the first and third quartile. Note that the values of the W statistic are log-scaled.
Figure A4. The influence of different numbers of k on the difference between the cross-validated and true RMSE (upper row) and on the W statistic (lower row). Points indicate median values, while error bars show the first and third quartile. Note that the values of the W statistic are log-scaled.CC-BY · From the PDF

Verification

Claims the paper makes

8 Valid · 1 Not valid · 4 Not checked · 57 Own results and interpretations

33 more claims

Create a free account to see all 70 claims and every source verdict.

See all claims — free account
  • It may state two separate claims as one. 25
  • Probably not a substantial claim. 8

Create a free account to see these claims.

Self-check

Percentages, sums and reported differences re-computed from the paper’s own numbers.

Each contradiction between two passages listed here was confirmed by an independent check.

1 of 1

Citations

Cites

Cited by

See all 82

Metadata

Authors
Linnenbrink, J., Milà, C., Ludwig, M., & Meyer, H.
Affiliations
  • University of Münster (DE)
  • Universitat Pompeu Fabra (ES)
Corresponding author
Linnenbrink, Jan
Venue
Geoscientific Model Development
Published
2024-08-07
Volume
17
Issue
15
Pages
5897-5912
ISSN
  • 1991-959X (ISSN-L)
  • 1991-9603
OpenAlex
W4401399092
Cited by
82
References
32
Citations by year
2026: 45 · 2025: 28 · 2024: 9
FWCI
22.15
Type
journal article
Language
en
Open access
Locations
  • Geoscientific model development (publishedVersion, cc-by)
  • Repositori digital de la UPF (Universitat Pompeu Fabra) (acceptedVersion, other-oa)
  • DOAJ (DOAJ: Directory of Open Access Journals) (submittedVersion)
Funders
  • Bundesministerium für Wirtschaft und Klimaschutz
  • Westfälische Wilhelms-Universität Münster
Topics
  • Social Sciences › Economics, Econometrics and Finance › Economics and Econometrics › Spatial and Panel Data Analysis
  • Life Sciences › Agricultural and Biological Sciences › Soil Science › Soil Geostatistics and Mapping
  • Physical Sciences › Environmental Science › Ecological Modeling › Species Distribution and Climate Change
Keywords
k-fold cross-validation, spatial cross-validation, leave-one-out cross-validation, spatial prediction models, computational efficiency

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

The claim verdicts this report counts are experimental: their accuracy is not yet measured.

A language model drew the claims from the paper on 2026-10-15, under version 3 of the claim definition (model deepseek-v4.1-flash, prompt extract-v3).

A second model labelled each claim on 2026-10-15 (model jev-1.13-20260917, definition revision gold-guideline-v0.2).

Cited sources are checked with a language model’s help (gpt-6-sol).

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review

Data sources

Bibliographic data: Semantic Scholar, OpenAlex, Crossref.

Contains information from the Semantic Scholar Academic Graph Datasets, made available under the ODC Attribution License (ODC-BY 1.0).

Semantic Scholar’s data is described in: Kinney, R., et al. (2023). The Semantic Scholar Open Data Platform. arXiv:2301.10140.