Skip to main content

Train / Validation / Test Split Calculator

Plan your ML dataset splits with precision. Calculate sample counts per split, check class distribution, configure k-fold cross-validation, and get warnings when splits are too small.

✓ Standard & custom split ratios ✓ Class distribution & stratification ✓ K-fold cross-validation sizing ✓ Time series split guidance ✓ Scientific standards reference

Dataset Configuration

Enter the total number of labeled examples in your dataset.

Class Distribution

Cross-Validation

Enable k-fold cross-validation on training set

Time Series Data

My dataset is time series / sequential data

Split Results

Scientific Standards Reference

Dataset Size Recommended Split Validation Strategy Notes
< 500 80 / 0 / 20 Leave-one-out or 5-fold CV Every sample counts; skip fixed val set
500 – 5,000 60 / 20 / 20 5-fold or 10-fold CV on train Larger val/test for reliable metrics
5,000 – 50,000 70 / 15 / 15 Fixed val set or 5-fold CV Classic split, widely accepted
50,000 – 500,000 80 / 10 / 10 Fixed val set 10% still gives 5,000–50,000 val/test samples
> 500,000 90 / 5 / 5 Fixed val set 5% = 25,000+ samples; diminishing returns on more val data
Time series (any) Temporal order Walk-forward validation Never use random splits; preserve chronology

Frequently Asked Questions

What is the standard train/validation/test split ratio?▼

The most common split for general-purpose datasets is 70/15/15 (train/val/test) or 80/10/10. For very large datasets (100K+ samples), you can use 90/5/5 since even 5% gives thousands of examples. For small datasets (<1,000 samples), 80/20 (train/test only) with cross-validation on the training set is often preferred. The key principle: your test set must stay completely unseen until final evaluation to give an honest estimate of generalization performance.

What is stratified splitting and when is it necessary?▼

Stratified splitting ensures each split has the same class distribution as the full dataset. For example, if 10% of your data is class A and 90% is class B, a stratified split keeps that 10/90 ratio in train, validation, and test sets. It is essential for imbalanced datasets — without it, a random split might give your test set zero examples of a rare class. Most ML libraries (scikit-learn's train_test_split with stratify=y, sklearn's StratifiedKFold) support this. Always use stratification for classification tasks unless your dataset is perfectly balanced and very large.

What is k-fold cross-validation and when should I use it?▼

K-fold cross-validation divides the training data into k equal folds, trains k models (each time using k-1 folds for training and 1 fold for validation), then averages the validation metrics. It makes maximum use of limited data — every sample is used for both training and validation across different folds. Use k=5 or k=10 as defaults. K-fold is especially valuable when your dataset is small (<5,000 samples) or when you need a reliable estimate of model performance. Keep a separate held-out test set for final evaluation — never use cross-validation folds as your test set.

Why can't I use random splits for time series data?▼

Random splits for time series data cause data leakage: your model trains on future data and predicts the past, which is impossible in production but makes validation metrics look artificially good. Instead, use temporal splits — train on earlier data, validate/test on later data, preserving chronological order. For example, train on months 1-8, validate on months 9-10, test on months 11-12. For rolling evaluation, use walk-forward validation: train on t=1..n, predict t=n+1, then expand the window. The gap between train and validation sets should match your real deployment lag.

What is the minimum recommended sample count per split?▼

As a rule of thumb: at least 30 samples per class per split for basic statistical validity. For reliable model evaluation, aim for 100+ samples per class in your validation/test sets. With fewer than 30 samples in a class per split, your metrics (accuracy, F1, AUC) will have very high variance and may not be trustworthy. For very small datasets, k-fold cross-validation is preferable to a fixed split. If you have fewer than 10 samples per class in the full dataset, consider data augmentation, transfer learning, or few-shot methods instead of traditional train/test splits.

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Fake Data Generator YAML Validator Pro YAML to JSON Converter TOML to JSON Converter TOML Validator XML Formatter & Validator YAML Diff Viewer SAML Request Decoder HTML to Markdown Converter JSON ↔ YAML Converter YAML to TOML Converter YAML to TOML Converter TOML to JSON Converter XML Prettifier HTML Entity Encoder / Decoder HTML Formatter & Minifier YAML Validator & Formatter Markdown to HTML Converter Mock Data Generator NFT Metadata Generator SQL ERD Diagram Generator Helm Values Generator EVM Calldata Decoder Neon DB Query Builder Turso Edge DB Explorer Docker Compose Generator Kubernetes Manifest Generator OpenAPI Validator GitHub Actions YAML Linter SQL Index Advisor Kubernetes YAML Validator Helm Chart Linter CI/CD Pipeline Generator Prisma Schema Visualizer Database Schema Visualizer OpenAPI Mock Generator Pulumi Stack Config Generator Helm Values Validator Embedding Storage Calculator RAG Chunk Size Optimizer Helm Chart Values Generator Database Schema Diff PlanetScale Branch Manager Base64 Encoder & Decoder Base64 Encode / Decode Code Tools GitHub Actions Workflow Generator Image to Base64 Converter JSON to CSV Converter Markdown Preview & Editor SVG Editor & Optimizer Unicode Character Lookup UUID v7 Generator JSON-LD Schema Generator ArgoCD App Health Checker OpenTelemetry Config Generator Prometheus Alert Rules Validator Grafana Dashboard JSON Validator Zod Schema Generator Kubernetes Resource Quota Calculator GitHub Actions Workflow Validator OpenAPI Schema Validator pnpm Workspace Generator K8s Resource Limits Calculator OpenAPI Spec Validator Ansible Playbook Builder AI Model Benchmark Comparator Database Index Analyzer Helm Values Builder Terraform Variable Builder npm Package Stats Sitemap.xml Validator SQL to TypeScript Types Database Index Advisor AI Agent Memory Planner RAG Chunking Calculator IPFS CID Version Converter Ansible Playbook Linter ArgoCD Application Generator GitHub Actions Matrix Builder Kubernetes Resource Request Calculator GitHub Actions Cron Builder HTML5 Canvas API Playground Particle System Config Generator LLM Benchmark Calculator CrewAI Agent Config Generator Kubernetes RBAC Builder SWR Config Generator RAG Chunking Calculator TypeScript Discriminated Union Builder Token Counter & Cost Estimator AI Model Comparison Table AI API Rate Limit Calculator LLM Prompt Template Builder PostgreSQL Connection String Builder

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →