  This paper considers the problem of model selection under domain shift. In
this setting, it is proposed that a high maximum mean discrepancy (MMD) between
the training and validation sets increases the generalisability of selected
models. A data splitting algorithm based on kernel k-means clustering, which
maximises this objective, is presented. The algorithm leverages linear
programming to control the size, label, and (optionally) group distributions of
the splits, and comes with convergence guarantees. The technique consistently
outperforms alternative splitting strategies across a range of datasets and
training algorithms, for both domain generalisation (DG) and unsupervised
domain adaptation (UDA) tasks. Analysis also shows the MMD between the training
and validation sets to be strongly rank-correlated ($\rho=0.63$) with test
domain accuracy, further substantiating the validity of this approach.
