{"slug": "cross-validation-why-one-train-test-split-lies", "title": "Cross-Validation: Why One Train/Test Split Lies", "summary": "A developer demonstrates why a single train/test split can be misleading in machine learning, advocating for k-fold cross-validation to obtain a more reliable performance estimate. The interactive visualization shows how k-fold cross-validation rotates through folds, providing a mean accuracy with standard deviation, compared to the variance of a single split. The project is part of the MachineLearningFromZero series.", "body_md": "You split your data 80/20, get 91% accuracy, and ship it. But was that 91% luck or skill? A single split can fool you. Cross-validation gives you a trustworthy number. Here's k-fold, visualized.\n\n🔁 **Watch the folds rotate:** [https://dev48v.infy.uk/ml/day18-cross-validation.html](https://dev48v.infy.uk/ml/day18-cross-validation.html)\n\nOne train/test split is high-variance: a lucky test set flatters your model, an unlucky one trashes it. You're judging on a single roll of the dice.\n\nSplit the data into k equal folds. Then, k times: train on k−1 folds, validate on the held-out one. You get **k scores** — report the **mean ± std**. Every data point gets used for both training and validation (in different rounds), so the estimate is stable.\n\nThe demo rotates each fold through validation, fits a real model per fold, fills in the per-fold scores, and shows the average — next to a single split you can reshuffle to watch it swing.\n\nCost: k× the training. Worth it for an honest score.\n\n🔨 Built from scratch (split into folds → train/score each → mean±std → grid-search) on the page: [https://dev48v.infy.uk/ml/day18-cross-validation.html](https://dev48v.infy.uk/ml/day18-cross-validation.html)\n\nPart of MachineLearningFromZero. 🌐 [https://dev48v.infy.uk](https://dev48v.infy.uk)", "url": "https://wpnews.pro/news/cross-validation-why-one-train-test-split-lies", "canonical_source": "https://dev.to/dev48v/cross-validation-why-one-traintest-split-lies-4e3m", "published_at": "2026-06-27 12:13:51+00:00", "updated_at": "2026-06-27 12:33:38.389398+00:00", "lang": "en", "topics": ["machine-learning", "developer-tools"], "entities": ["MachineLearningFromZero"], "alternates": {"html": "https://wpnews.pro/news/cross-validation-why-one-train-test-split-lies", "markdown": "https://wpnews.pro/news/cross-validation-why-one-train-test-split-lies.md", "text": "https://wpnews.pro/news/cross-validation-why-one-train-test-split-lies.txt", "jsonld": "https://wpnews.pro/news/cross-validation-why-one-train-test-split-lies.jsonld"}}