Shouldn't this be an `argsort` if indices are supposed to come out? Also, do you need to store the full training set, or could a summary statistic over axis 0 suffice?