Regimes You Can Find Without Labels: Mechanism Clustering for Geographic Transfer

A crop classifier trained on satellite pixels from Kenya often fails in Brazil, and a poverty regressor trained on some African countries degrades on others. Part of the reason is that the rule linking what the satellite sees to the thing we want to predict changes across the landscape. The same spectral signature can mean maize in one rainfall regime and something else in another. A family of methods, which we will call relationship-based clustering, groups data by which input-to-output rule it follows rather than by where its inputs sit. These methods are well suited to finding such rules. They have one crippling flaw for geographic deployment: to decide which rule a new point follows, you need its label. In a new region there are no labels.

We propose to discover mechanism regimes from labeled source regions, but to force each regime's membership to be a simple function of environmental context: climate reanalysis, elevation, and similar covariates that exist everywhere on Earth without anyone labeling anything. Regimes are defined by how pixels map to labels. Membership is decided by climate and terrain. That combination lets a model trained in Togo and Kenya pick the right prediction head for an unlabeled Brazilian field. It also gives a label-free warning when a target region matches no regime seen in training. The two-sentence version: cluster training locations by the rule they obey, but only allow partitions that can be read off label-free environmental maps. Then route unseen regions to the matching rule.

Core Claim

We claim that constraining a mechanism partition to be predictable from environmental covariates $z$ turns relationship-based clustering from a descriptive tool into a transfer method. We further claim that this constrained partition transfers to held-out regions better than two simpler options. The first feeds $z$ into a single network. The second clusters on $z$ alone. The advantage should be concentrated in target regions that are geographically far from all training data but environmentally similar to some part of it.

The motivating evidence comes from both directions. On the clustering side, Measure the Predictive Heterogeneity defines predictive heterogeneity as the extra predictive information gained by splitting data into $K$ groups, each with its own predictor from a fixed model class. It optimizes this by alternating between fitting per-group predictors and reassigning points. On NOAA weather and crop-yield data it separates wheat and rice mechanisms that line up with geography, without being given locations. Clustering of causal graphs to explore drivers of river discharge runs causal discovery on 358 European catchments and clusters the resulting causal effect vectors. It places Alpine and Scandinavian catchments in the same snowmelt-driven regime even though they are thousands of kilometers apart. Both show that mechanism regimes exist in geographic data and are not the same as spatial neighborhoods. Neither can assign a new, unlabeled location to a regime. The first needs labels to reassign points. The second needs 30 years of discharge records per catchment.

On the geographic side, WILDS: A Benchmark of in-the-Wild Distribution Shifts and Extending the WILDS Benchmark for Unsupervised Adaptation show that invariance and adaptation methods rarely beat plain pooled training on real geographic shifts. They also show that those methods depend on coarse administrative domains such as countries and continents. Trusting Small Training Dataset for Supervised Change Detection finds that ecological diversity in training matters more than proximity to the test site. That is what one would expect if transfer is governed by environmental regime rather than distance.

The Method

Let $x$ be a location's satellite input (for example a Sentinel-1/2 pixel time series), $y$ its label, and $z$ its environmental covariates. A shared encoder $\phi$ maps $x$ to features. There are $K$ low-capacity prediction heads $h_1,\dots,h_K$, one per regime. A gate $g$ assigns each location to a regime using $z$ only, never $x$ or $y$. The gate is drawn from a deliberately simple class $\mathcal{G}$, such as shallow decision trees or multinomial logistic regression on $z$. We choose the partition to maximize predictive heterogeneity in the sense of Measure the Predictive Heterogeneity, restricted to partitions the gate can express:

$$ \max_{g \in \mathcal{G},\ \phi,\ h_{1..K}} \; \sum_{i} \log p_{h_{g(z_i)}}\!\big(y_i \mid \phi(x_i)\big) \;-\; \lambda\, K, $$

Here $g(z_i)$ is the regime assigned to location $i$ and $\lambda$ penalizes extra regimes.

Optimization alternates three steps, extending the bi-level scheme of that paper. First, with heads fixed, each training location gets the head that best explains its label. This is the relationship-based assignment, and it uses $y$. Second, those assignments are projected onto $\mathcal{G}$ by fitting the gate to predict them from $z$, weighted by how decisively each head won. Third, heads and encoder are refit under the gate's assignments rather than the label-based ones. Step three is what separates the method from ordinary clusterwise regression. The partition the model trains on is the one it will be able to use at test time.

We select $K$ and $\lambda$ by spatially blocked cross-validation over held-out source regions. Pinning down $K$ this way addresses the fixed-$K$ problem that both the predictive heterogeneity paper and Clustered Invariant Risk Minimization leave to the user. The same procedure also removes the need for target labels during tuning, which Extending the WILDS Benchmark for Unsupervised Adaptation identifies as a core obstacle for adaptation methods.

At test time, a target location's $z$ selects a head. The gate's confidence, together with the distance of $z$ from all regime supports, gives a label-free flag for locations that belong to no known regime.

Relation to Prior Work

Several papers supply parts of the method. Clusterwise linear regression and its predictive variant, in Novel Prediction Techniques Based on Clusterwise Linear Regression, train a classifier on $x$ after clustering to assign test points. We change both the input to that classifier, using $z$ instead of $x$, and its role: the classifier is inside the training loop rather than fitted afterward. The paper itself notes that assignment fails when $x$ separates regimes poorly. Under geographic shift, $x$ is also exactly the variable whose distribution moves, so a classifier on $x$ inherits the shift. Clustered Invariant Risk Minimization supplies the architecture of a shared representation with per-cluster linear heads. However, it assumes data arrives already split into discrete environments and has only been tested on synthetic and MNIST variants. We have no given environments, only a continuous $z$.

Other work constrains our design. Heterogeneous Risk Minimization proves that clustering on unstable, spurious features is best for learning a single invariant predictor. That might seem to contradict clustering on environmental context. It does not, because the goals differ. HRM wants environments that expose spurious correlations so one rule can be learned. We want regimes whose rules genuinely differ, so that a different head is correct in each.

Statistically-Guided Deep Network Transformation to Harness Heterogeneity in Space (Extended Abstract), known as STAR, is the closest geographic method. It scans a global model's error map on a spatial grid, branches the network where errors cluster, and uses a coordinate-based moderator to weight branches in new regions. STAR clusters errors in geographic space and transfers by coordinates. We cluster rules, partition in environmental space, and transfer by covariates. A coordinate-based moderator cannot send Scandinavia to the Alpine branch. A climate-and-elevation gate can.

TIML: Task-Informed Meta-Learning for crop type mapping conditions a meta-learned network on coordinates and crop type through feature-wise modulation. We treat it as the strongest continuous-conditioning competitor rather than as a component.

Research Program

The work has three stages, ordered from a known-answer check to the hard benchmark.

The first stage is recovery. On the European catchment data from Clustering of causal graphs to explore drivers of river discharge, we predict discharge from temperature and precipitation histories. The covariates $z$ are catchment elevation and long-term climate means. We ask whether our $z$-gated partition recovers the snowmelt regime that the causal-graph clustering found, measured by agreement with its four-cluster assignment. We then ask whether gauges held out in spatial blocks, including held-out Scandinavian catchments when training contains Alpine ones, are routed to the right regime and predicted better than by a pooled model. The appeal of this test is that the answer is known from independent causal analysis.

The second stage is crop mapping. CropHarvest pairs Sentinel-1/2 pixel time series with ERA5 climate and elevation, so $x$ and $z$ come ready-made. We exclude latitude and longitude from $z$ so the gate cannot memorize geography. We use the Togo, Kenya, and Brazil-coffee transfer tasks from TIML: Task-Informed Meta-Learning for crop type mapping, both zero-shot and with the few-shot target labels that paper uses. We add a leave-one-agroecological-zone-out protocol to probe environmentally novel targets.

The third stage is poverty regression. On PovertyMap-WILDS we attach ERA5 climate and elevation at each survey location and train with the official country-fold splits. This tests whether the approach survives a regression target where pseudo-labeling adaptation broke down.

Across all three, we analyze regime stability across random seeds and $K$, whether regimes cut across country and continent boundaries, and whether the no-known-regime flag predicts where errors are large.

Baselines

The naive reference is pooled training: one network trained on all source regions with ordinary loss minimization, using the same encoder, augmentations, and tuning budget as our method. We tune it by the same spatially blocked source validation. WILDS shows this is the bar most methods fail to clear. On PovertyMap-WILDS it reports an out-of-distribution Pearson correlation of 0.45 for this baseline, down from 0.60 in-distribution (WILDS: A Benchmark of in-the-Wild Distribution Shifts). We will reproduce it rather than rely on the reported figure. Beating it means a higher out-of-distribution Pearson correlation averaged over the official folds, with the gap exceeding fold-to-fold standard deviation.

The strongest existing competitor on crop transfer is TIML (TIML: Task-Informed Meta-Learning for crop type mapping). It achieved the highest average AUC ROC and F1 across the three tasks and was the only transfer method to beat random initialization on Brazil coffee. That paper does not report absolute numbers, so we found no reported result on Lacuna for TIML's absolute AUC or F1. We will rerun it with the released task definitions and give it the same few-shot labels and tuning budget. Because TIML can condition on $z$ as well as on coordinates, we run both versions. The version conditioned on $z$ is the true continuous-conditioning competitor.

STAR (Statistically-Guided Deep Network Transformation to Harness Heterogeneity in Space (Extended Abstract)) reports weighted F1 rising from 0.49 to 0.67 over a standard network on California land cover. We will run its grid-scan branching on CropHarvest by gridding point locations, knowing that this disadvantages it on irregular data. We report it as a reference rather than as the decisive comparison.

Three ablations isolate the key ingredient. The first is unconstrained predictive heterogeneity clustering with a post-hoc classifier on $x$ for test assignment, which is the clusterwise-regression recipe. It tests whether gating on $z$, rather than on $x$, is what matters. The second is $k$-means on $z$ followed by per-cluster heads. It tests whether the label-driven mechanism objective adds anything beyond environmental zoning. The third is a soft mixture of experts gated on $z$ and trained end-to-end without the assignment-and-projection loop. It tests whether the alternating procedure matters or whether any $z$-gated mixture suffices.

Why not just…?

Why not just train one network on all regions? Pooled training is hard to beat on WILDS, and we take that seriously by tuning it as carefully as our own method. Its known failure is that it averages across rules. STAR's branched model improved weighted F1 from 0.49 to 0.67 over a global network in California, which suggests real rule heterogeneity in satellite crop data. If our method cannot beat pooled training in stage two, the claim fails.

Why not just feed the environmental covariates into a single network, or condition it on them as TIML does? This is the most serious threat. A flexible network given $z$ can in principle learn any regime interaction itself. Our bet is narrower: when target $z$ falls outside the training range in some directions, a low-capacity gate snaps to the nearest learned regime, whereas a smooth conditioning network extrapolates arbitrarily. TIML's own finding that simply concatenating metadata did not help on Brazil coffee hints that raw conditioning is fragile, but it does not settle the question. The leave-one-zone-out protocol does settle it. If $z$-conditioned TIML matches us within seed variance there, we will report that the clustering adds interpretability and an out-of-regime flag but no accuracy, and we will recast the contribution around those.

Why not just cluster on climate and terrain, such as climate zones, and fit local models? This is also a real threat, because environmental zones may already be good regime proxies. The difference is that $k$-means on $z$ splits wherever climate varies, whether or not the pixel-to-label rule changes there. It can therefore fragment data across regimes that share a rule, and it can merge climates that differ in rule. The $k$-means ablation measures this directly, as does agreement with the causal snowmelt regime in stage one. We will concede the point if the ablation matches us.

Why not just use unsupervised adaptation or invariance training with country labels? Extending the WILDS Benchmark for Unsupervised Adaptation found that adaptation methods gave no consistent gain over pooled training on real shifts, broke down on PovertyMap regression, and need target labels for tuning. Clustered Invariant Risk Minimization argues that single-rule invariance fails when environments hold distinct rules. As a secondary experiment, we will hand our discovered regimes to Group DRO as environment labels, alongside country labels. This tests the related question of whether invariance methods failed on WILDS because of coarse administrative domains.

Decisive Checks

Three results decide the proposal. In stage one, the $z$-gated partition must recover the Alpine–Scandinavian snowmelt regime and improve held-out-gauge discharge error over pooled training. Failure here means the gate cannot find known mechanisms and the rest is moot. In stage two, under leave-one-zone-out on CropHarvest, the method must beat both $z$-conditioned TIML and $k$-means-on-$z$ in AUC ROC and F1 by more than seed variance. This is the test that separates mechanism-clustered routing from continuous conditioning and from zoning. In stage three, on PovertyMap-WILDS, the method must exceed our reproduced pooled baseline on out-of-distribution Pearson correlation, against the reported 0.45. Separately, the out-of-regime flag must show a positive correlation with per-location error in every stage, or the label-free diagnostic claim is dropped.