How do I test a predictive model on held-out data?
A step-by-step method for testing a predictive model on held-out data: split first, set a baseline, score once, pick honest metrics and know what the test cannot show.
In this article
- Step 1: Decide what you are predicting and when
- Step 2: Split before you look at results
- Step 3: Train on the training rows only
- Step 4: Set a baseline before you score
- Step 5: Score the sealed rows once
- Step 6: Choose metrics that fit the outcome
- Step 7: Write down what the test does not prove
- How YourCloudGroup Model Manager automates these steps
- Limitations
To test a predictive model on held-out data, set aside part of your labelled data before you do any modelling, train the model only on the remaining rows, then score the sealed rows once and compare the result with a simple baseline. Report metrics that suit your outcome, not just accuracy, and state what the test cannot show. The steps below take you through that in order, with the mistakes that most often spoil each one.
For the concept first, see what held-out evaluation is. This article is the practical how-to.
Step 1: Decide what you are predicting and when
Write down the outcome column (the target column) and the moment the prediction will be needed in real use. "Will this customer cancel?" asked at the time of renewal is a different problem from the same question asked after the customer has already phoned to cancel.
This matters because every column you use must exist at that moment. A field that is filled in only after the outcome is known will make the model look excellent in testing and useless in practice. That failure is called target leakage, and a held-out test will not catch it if the leaked column sits in both the training and held-out rows. Check your columns before you split, and see what target leakage is for a measured example.
Step 2: Split before you look at results
Divide the labelled rows into two groups before any model is built:
- Training rows are the only rows the model may learn from.
- Held-out rows stay sealed. Nobody uses them to choose columns, tune settings or decide which model to keep.
There is no universal percentage. What matters is that the held-out set is large enough to contain a meaningful number of every outcome you care about. If only 50 of 28,000 rows are the rare outcome, each missed case moves your recall by two percentage points, however many rows there are in total.
Choose the split style to suit the data:
| Situation | Split style |
|---|---|
| Rows are independent, no important time order | Random split, keeping outcome proportions similar in both parts |
| Data arrives over time and you will predict the future | Time-based split: train on earlier rows, hold out later ones |
| The same customer, machine or patient appears in many rows | Group split: keep all rows of one entity on the same side |
A random split on time-ordered or repeated-entity data lets the model see near-copies of held-out rows during training. That is train/test contamination, and it inflates the score without any visible sign.
Step 3: Train on the training rows only
Everything that learns from data, including filling in missing values, scaling numbers and choosing columns, must be fitted on the training rows alone and then applied to the held-out rows. If you calculate an average over the whole file and then split, a little information from the held-out rows has already leaked into training.
If you want to compare several candidate models or tune settings, do that comparison inside the training rows, for example with cross-validation, or on a third slice kept for the purpose. The sealed rows are not for choosing.
Step 4: Set a baseline before you score
A score means little without something to beat. Pick the simplest sensible rule and score it on the same held-out rows:
- For a category outcome, always predict the most common category.
- For a number outcome, always predict the training average.
- For a business decision, use whatever you do today, such as contacting everyone or inspecting nothing.
If the model cannot clearly beat the baseline, the honest finding is that the data holds little signal for this question.
Step 5: Score the sealed rows once
Have the model produce predictions for every held-out row and record them. Only then compare them with the true outcomes. Do this once. If you look at the result, adjust the model and test again on the same rows, the held-out set slowly becomes part of the training process, and the final number is no longer an honest estimate. If you must iterate, say how many times you scored the same rows, because repeated reuse qualifies the claim.
Step 6: Choose metrics that fit the outcome
Accuracy is the share of predictions that were right, and it rewards a model for always guessing the majority class. Where one outcome is rare, a model that flags nothing can score very high. Why 99.9% accuracy can mislead works through a real example, and balanced accuracy versus accuracy explains the alternative.
| Outcome type | Metrics to report |
|---|---|
| Category, balanced classes | Accuracy, plus per-class recall |
| Category, rare class | Balanced accuracy, macro F1, per-class recall and a confusion matrix |
| Number | R-squared, mean absolute error and root mean squared error |
Always show the baseline score beside the model's score, and give a range of uncertainty where you can. A single number from a few hundred held-out rows can move noticeably if you draw a different sample.
Step 7: Write down what the test does not prove
A held-out score describes how the model handled the held-out population. It does not show that:
- Future data will look the same. Customers, markets and equipment change.
- A leaked column present in both parts is harmless. The test cannot see it.
- The model is worth deploying. That depends on what the decision costs and what the prediction is worth, which the metrics alone do not tell you.
State these limits next to the score.
How YourCloudGroup Model Manager automates these steps
YourCloudGroup Model Manager is a browser-based platform that builds, evaluates, certifies and schedules classification and regression models from a customer's own structured data, such as a CSV file. According to its product page, it freezes a training and blind split before any model is built, screens columns for information that would not exist at prediction time using the training rows only, trains twelve candidate models and scores them on the same blind rows. It picks the winner on balanced accuracy and macro F1 rather than raw accuracy.
It also checks the blind set before opening the answers: if a declared outcome class is missing, balanced accuracy, macro F1 and per-class recall read NOT MEASURABLE instead of showing a misleading figure. A certificate grades the measured improvement over an explicit baseline with a 90% bootstrap confidence range. For AI agents, the agent guide describes a dry-run split that writes nothing and returns a hash, so the split that is committed is exactly the one reviewed.
Limitations
- This method suits tabular data with known past outcomes. It does not cover images, audio or free text.
- A single held-out split gives one estimate. With small data, repeated or cross-validated splits give a steadier picture.
- Time-based and group splits need a date or an entity column; without one you must reason about the risk yourself.
- Certification, where used, describes how a score was earned on a stated blind set. It is not a forecast of future performance and is not a third-party audit.
Build predictive models from your own data
YourCloudGroup Model Manager builds, evaluates, certifies and schedules predictive models from your CSV or spreadsheet data — point and click, on your own dedicated server.
Learn about Model Manager →Published by YourCloudGroup. Read our editorial standards and corrections policy.