Condense KFold validation set code to avoid duplication