Generic functions for cross-validation
