I'm not sure this needs special-casing, as it's the domain of `sklearn.utils.resample`. Instead, you should probably change that function to handle circular sampling and reuse it here and below.