Prediction time and data provenance
Quick answer
A dataset for supervised learning must describe the observation unit, prediction moment, target and origin of each value. In a fictional support queue, predict the routing category of one incoming request from the text available on arrival. The category is assigned later by a reviewer. Provenance is the record of where data came from and how it changed. A timestamp describing an event is not necessarily the time at which its value became accessible to the model. Examples use local Python 3.13.5 and scikit-learn 1.8.0 where imported. All fixtures are synthetic; ByteMind library execution is unverified.
Audit feature availability
Times are integer minutes on a shared clock; prediction occurs at minute 10. A feature is usable only if its event and ingestion times are both at or before that cutoff.
fields = [('text', 8, 9), ('final_route', 12, 13), ('device_log', 7, 11)]print([name for name,event,available in fields if max(event,available) <= 10])Expected output:
['text']The device log occurred early but arrived late. The final route is the target, not an input.
Check label maturity
A separate target predicts whether resolution occurs within 60 minutes. A request that has not completed its observation window cannot safely be called a negative. Use a conservative maturity rule that waits for the full horizon for every row.
arrival = [0, 30, 90]snapshot = 100print([t for t in arrival if t + 60 <= snapshot])Expected output:
[0, 30]The third request is not mature. An event time, recorded time, prediction cutoff and target horizon must be separately documented.
Common mistakes
Do not reconstruct training features from a current database snapshot without checking historical availability. A corrected route recorded after prediction may leak the answer. Unknown labels are not automatically negatives. Document source version, transformations, time zone, ingestion delays, and whether records were backfilled. The toy integer clock avoids timezone complications; production timestamps require explicit normalization and point-in-time joins.
Practice and next steps
Write a contract for routing at arrival versus predicting resolution within an hour. Identify one feature excluded from each task and one reason a label may be unavailable. Next, examine how collecting and annotating requests changes the dataset. The separate pure-Python exercise assesses the underlying calculation, not library execution.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Prediction time and data provenance — knowledge check
Apply data collection, labeling and provenance reasoning to synthetic examples.
Which feature is available at minute 10 if its event was at 8 and ingestion at 11?
What is the observation unit for routing one incoming request?
Why wait for a full target horizon in a conservative labeling policy?
Which field is leakage for routing at arrival?
What should provenance record?