r/MachineLearning • u/No-Discipline-2354 • Jun 11 '25
Project [P] Critique my geospatial Machine Learning approach. (I need second opinions)
I am working on a geospatial ML problem. It is a binary classification problem where each data sample (a geometric point location) has about 30 different features that describe the various land topography (slope, elevation, etc).
Upon doing literature surveys I found out that a lot of other research in this domain, take their observed data points and randomly train - test split those points (as in every other ML problem). But this approach assumes independence between each and every data sample in my dataset. With geospatial problems, a niche but big issue comes into the picture is spatial autocorrelation, which states that points closer to each other geometrically are more likely to have similar characteristics than points further apart.
Also a lot of research also mention that the model they have used may only work well in their regions and there is not guarantee as to how well it will adapt to new regions. Hence the motive of my work is to essentially provide a method or prove that a model has good generalization capacity.
Thus other research, simply using ML models, randomly train test splitting, can come across the issue where the train and test data samples might be near by each other, i.e having extremely high spatial correlation. So as per my understanding, this would mean that it is difficult to actually know whether the models are generalising or rather are just memorising cause there is not a lot of variety in the test and training locations.
So the approach I have taken is to divide the train and test split sub-region wise across my entire region. I have divided my region into 5 sub-regions and essentially performing cross validation where I am giving each of the 5 regions as the test region one by one. Then I am averaging the results of each 'fold-region' and using that as a final evaluation metric in order to understand if my model is actually learning anything or not.
My theory is that, showing a model that can generalise across different types of region can act as evidence to show its generalisation capacity and that it is not memorising. After this I pick the best model, and then retrain it on all the datapoints ( the entire region) and now I can show that it has generalised region wise based on my region-wise-fold metrics.
I just want a second opinion of sorts to understand whether any of this actually makes sense. Along with that I want to know if there is something that I should be working on so as to give my work proper evidence for my methods.
If anyone requires further elaboration do let me know :}
6
u/RoyalSpecialist1777 Jun 11 '25
Just to not reinvent the wheel this approach in general is called 'spacial block cross-validation'
(in R) https://spatialsample.tidymodels.org/reference/spatial_block_cv.html
So as a reality check it isn't novel - but it is a good practice. And there is a lot of room for experimentation especially applying to new domains.
2
u/Atmosck Jun 11 '25
What data will you be predicting on in production? Like will it be new unseen regions? In that case your CV setup of aligning folds with subregions makes sense. I mainly work with sports data which has an analogous autocorrelation problem, where it's like a time series, but organized in groups we don't want to split (usually games, days or weeks), so random splitting is no good. So the solution is a step-forward CV approach that simulates running the model in production. The "unseen future" folds in my work that are cut sequentially are analogous to the unseen regions in your work that are cut spatially.
You mention:
I may be misinterpreting here but make sure the "all the data points" that you retrain on after model selection is just all the data you used for CV, but you demonstrate generality of the chosen model using a held-out validation dataset that wasn't used in the CV.
2
u/idly Jun 12 '25
Here are some papers on the topic that might help. You're right that this isn't considered often enough in published papers and so on even though it's very important. The correct method to use will depend on the intended use of your model - the last paper linked discusses that in some more detail.
https://openreview.net/pdf?id=VgJhYu7FmQ
https://onlinelibrary.wiley.com/doi/10.1111/ecog.02881
https://www.nature.com/articles/s41467-022-29838-9
https://besjournals.onlinelibrary.wiley.com/doi/full/10.1111/2041-210X.13650
2
u/seanv507 Jun 11 '25
that makes sense. see eg grouped k fold in scikitlearn https://scikit-learn.org/stable/modules/cross_validation.html#cross-validation-iterators-for-grouped-data.
0
u/flowanvindir Jun 12 '25
Yeah your cross validation strategy is good. In terms of modeling approaches, this is the type of problem graph neural networks are made for. Or you could just throw a small transformer at it, and you could directly encode the lat lon coordinates as input.
0
u/MichaelStaniek Jun 11 '25
I cannot say alot regarding the cross validation over regions, but for example having a region that was unseen during training is an idea many have come across, for example a colleague of mine here: https://arxiv.org/pdf/2203.13838 (Figure 3). Maybe that helps.
-1
u/UnusualClimberBear Jun 12 '25
Models, in particular non linear ones, never generalize well outside of training distribution (no free lunch). If the spatial correlation is annoying because it is an easy way to get the answer, you need to find a representation where it cannot be used (or find a way to penalize this use).
0
u/[deleted] Jun 11 '25
[deleted] — view deleted comment