#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
✂️ FREE · STRATIFIED & K-FOLD

Train Test Split Calculator: Plan Your Data Split

Enter your dataset size and percentages to see exact rows for each set.

  • 📊 Train, validation, test
  • ⚖️ Stratified class counts
  • 🔁 k-fold fold sizes

How to use the Train Test Split Calculator

  1. 1. Enter total rowsType how many rows your dataset has.
  2. 2. Set percentagesChoose test and validation shares; training gets the rest.
  3. 3. Add classes and kOptionally enter class counts and k to plan stratified and k-fold splits.

How the rows are counted

Test and validation sizes are rounded up and training gets whatever is left: test = ⌈N × test%⌉, validation = ⌈N × validation%⌉, train = N − test − validation. This matches how scikit-learn's train_test_split sizes the test set.

Worked example: 1,000 rows with 20% test and 10% validation give 200 test rows, 100 validation rows and 700 training rows. With 5-fold cross-validation each fold holds 200 rows, and each training round uses about 800.

Choosing a split

  • Small data (under a few thousand rows): prefer k-fold cross-validation so every row is used for both training and testing.
  • Large data: a single split is fine, and the test share can be small; 1% of a million rows is still 10,000.
  • Imbalanced classes: stratify so each set keeps the same class mix. Enter class counts above to see the expected rows per class.
  • Time series: never shuffle. Train on the past and test on the most recent period.

Keep the test set locked until the very end. Tuning against it, or scaling features using all rows, leaks information and makes results look better than they are. In code: train_test_split(X, y, test_size=0.2, stratify=y, random_state=42). After training, evaluate with the confusion matrix calculator.

Frequently asked questions

Do I always need a validation set?

You need one when tuning hyperparameters. Cross-validation on the training set can replace a fixed validation split.

Why are stratified counts decimals?

They show the expected share. Real splitters round each class to whole rows.

Is the Train Test Split Calculator free?

Yes, the Train Test Split Calculator is free. The first time you see your first result, you are asked for your name and WhatsApp number once. After that, this and every other Uncodemy tool opens straight away without the form.

More free tools

See all free tools