Skip to content
codeyourself.
All field guides

A feature can be accurate and still arrive too late.

Audit a small repair-risk dataset by prediction time, split boundary and preprocessing lineage before trusting a model score.

WHAT YOU’LL TAKE AWAY

Check when a feature becomes available, not only whether it predicts the label.

Fit preprocessing on training data and preserve the fitted transformation.

Evaluate the decision population that will actually receive predictions.

Start with the moment of the decision

A neighborhood repair desk wants to prioritize appointments likely to be cancelled. The prediction runs at 09:00 on the appointment day. The outcome is whether the appointment is cancelled before the desk closes. The first contract is temporal: every input must be available to the service at 09:00. A column being present in a historical table does not make it a legitimate feature.

Here is a fictional audit sample. It illustrates information timing; it is not a model benchmark or customer data.

appointmentreminder sent by 09:00refund recorded atcancelled by close
R1yes17:10yes
R2nononeno
R3yes16:40yes
R4nononeno

A rule that predicts cancellation whenever a refund exists scores four correct rows out of four in this tiny table. It is unusable at 09:00 because the informative refunds have not happened. The problem is not excessive model complexity. The rule is learning from the future.

Build an availability ledger

For every candidate feature, record its definition, event time, ingestion time and earliest time the scoring service can retrieve it. A reminder sent at 08:50 but ingested at 09:15 is also unavailable for the 09:00 decision. Reconstruct features using the same availability rule during training and evaluation. If historical ingestion times are missing, state that limitation rather than silently treating event time as proof of availability.

A useful audit asks two different questions: could the feature exist by the decision, and could this particular service access it then? Permissions, synchronization delays and refresh schedules affect the second answer. Offline access to a warehouse can be broader than access available to the deployed scorer.

Split before learning a transformation

Suppose two training measurements are 2 and 4, and the held-out measurement is 8. Using the population convention, training mean is 3 and standard deviation is 1. The held-out standardized value is therefore 5. Computing the mean across all three observations changes the transformation using evaluation information.

Fit imputation, scaling and feature selection on the training partition. Apply their fitted parameters to validation and test partitions. Save those parameters with the model artifact. A pipeline can enforce this boundary, but it cannot determine whether a column was knowable at prediction time. Both audits are needed.

Choose the split that answers the deployment question

A random row split can place appointments from the same customer in both partitions. If deployment serves entirely new customers, that split may answer the wrong question. A later-time evaluation can instead test future appointments for known customers. A customer-held-out evaluation tests generalization to unseen customers. Neither is universally correct: define the intended population and document the chosen boundary.

Inspect duplicates and repeated entities after splitting. A duplicated record with a new row identifier is still a duplicated observation. Keep selection decisions on validation data; repeatedly choosing features after inspecting test results makes the test set part of development.

Create a release checklist with observable evidence

Keep a versioned feature ledger, an example reconstructed at the scoring cutoff, the split rule, fitted preprocessing parameters and a baseline result. Add a deliberately late feature to a test fixture and confirm that the feature builder excludes it. Test an eligible but missing input and define whether scoring falls back or declines to predict.

After removing leakage, a lower evaluation score can be a more honest result. Do not restore a future-derived feature to recover an attractive number. Investigate what information can legitimately improve the decision and measure it on the intended population. This four-row example proves the timing contradiction, not the quality or fairness of a real cancellation model.

PAUSE. THINK. EXPLAIN.

Check your understanding

A booking model predicts cancellations at 09:00, but uses a refund status first recorded at 17:00. Does dropping the target column remove leakage?

Reveal the reasoning

No. The refund status is information from after the prediction time. Removing the label does not repair future-derived features; rebuild the feature as it was knowable at 09:00 and reevaluate.

Sources & further reading

Created with AI assistance. Examples are educational; verify platform-specific behavior against the linked documentation. Found something unclear? Contact us.

READ → PRACTICE → BUILD

Put this idea to work.

Use a related exercise, then continue with a guided course. Your account's Free or Pro access applies.

System design simulations require Pro. Free exercises are marked in the lab catalog.
FROM UNDERSTANDING TO DOING

Make the next step a small one.

Create a Free account for six coding challenges and nine starter labs. Advanced labs and Architecture Studio are Pro features.

Explore free practice
Save your own workPractice with browser fixturesClear Free & Pro accessSQL practice uses local DuckDB fixtures. System-design simulations model assumptions; they do not provision real cloud services.