Data Science

Cross-Validation: More Reliable Evaluation

Senior Data Analyst
May 13, 2026
5 min read

The Code

from sklearn.model_selection import cross_val_score

scores = cross_val_score(model, X, y, cv=5)

print(f"Mean Accuracy: {scores.mean():.2%} (+/- {scores.std()*2:.2%})")

Why 5-Fold?

Data is split 5 ways. Train on 4, test on 1. Repeat 5 times. Average the score.

*Day 134: Hyperparameter Tuning.*

Ready to put your knowledge into practice?

Join SQL Mastery and learn through interactive exercises.