A support desk wants to spot tickets that may still be open after two days. Its export looks substantial: 1,200 rows. Before a model can learn anything useful, someone has to ask whether those rows describe the information available when a new ticket arrives.
Before you start: be comfortable with spreadsheet rows, columns and percentages. No coding is required. Training means learning a prediction rule from past examples; validation helps choose that rule; a final test checks the chosen rule on examples kept out of those choices.
Before choosing an algorithm, check whether each row represents the right event, the inputs existed when a prediction would be made, and the outcome can be trusted.
Start with a prediction sentence
For our fictional support desk: “When a ticket arrives, predict whether it will remain unresolved after 48 elapsed hours, using information recorded at arrival.” State the prediction moment, outcome, unit, and information cutoff this precisely.
The grain is one row per ticket. The target, or label, is 1 for unresolved at 48 hours and 0 otherwise. Input columns are features. Several updates to one ticket must not become separate arrival examples.
Follow three records through the time check
These schematic records illustrate the checks; they are not extra observations added to the aggregate export below.
| Record | What is known | Readiness decision |
|---|---|---|
| A arrives 30 June at 20:00; the export is taken 1 July at 00:00. | Only four hours have elapsed. | The 48-hour outcome is unknown. Set it aside rather than calling it resolved. |
| B arrives 1 June at 09:00 and resolves 40 hours later. | It is resolved before the 48-hour cutoff. | Its historical label is 0. Use only the fields saved at arrival as inputs. |
| C arrives 1 June at 09:00 and resolves 60 hours later. | It is still unresolved at hour 48. | Its historical label is 1. Do not give the model its later resolution time. |
If B’s category changes at 11:00, that update is too late for a prediction made at 09:00. The label can use later history to describe what happened; an input feature cannot use information that would have been missing at the prediction moment.
Audit a synthetic export
These figures are invented for this lesson. The export covers January through June and was extracted on 1 July.
| Check | Finding |
|---|---|
| Exported rows | 1,200 |
| Extra duplicate copies | 20 |
| Unique tickets | 1,180 |
| Tickets with incomplete 48-hour observation windows | 30 |
| Tickets with known 48-hour outcomes | 1,150 |
| Unresolved at 48 hours | 230 of 1,150 |
| Missing arrival product category | 115 of 1,150 |
| Available fields | Arrival channel, arrival category, final resolution hours, closing-agent notes |
Initial decision: repair before training. The export contains duplicate rows, unfinished outcome windows, and fields that reveal the future.
Check the outcome and its timing
Confirm and remove the 20 duplicate copies. Set aside the 30 tickets whose outcomes are unknown. An open ticket aged 12 hours cannot yet be labelled “unresolved at 48 hours.” Do not replace its missing target with zero.
Define “resolved,” including how reopened tickets count, and check examples against event histories. Today's closing status may differ from the status at hour 48. Automatically generated labels still need review. Google's guide to labels explains these quality checks.
Exclude future information
Exclude final resolution hours and closing-agent notes from the inputs because they are unavailable at arrival. Resolution information can construct historical labels but must stay outside the feature set.
Verify that “arrival category” is the saved arrival value, not a later edit. Allowing information unavailable at prediction time to influence the model is data leakage. scikit-learn's leakage guidance describes why it creates misleading results.
Choose the split before learning transformations
For future incoming tickets, use earlier months for training, a later month for validation, and the latest months for the final test. Validation supports development choices; the final test stays untouched until those choices are settled. At each simulated training date, include only labels already knowable then. Allow for the 48-hour outcome window around boundaries.
If the intended use is new customers, keep each customer's tickets in one partition. A time split alone does not guarantee this. Enforce both constraints when both matter. scikit-learn documents time-based and grouped splitting.
Here is one possible chronology for this teaching example. It deliberately leaves gaps so every outcome used for a decision has had time to mature.
| Stage | Example arrivals | When the evidence can be used |
|---|---|---|
| Initial training | January–March | Fit on 3 April, after the last March ticket’s 48-hour window has closed. |
| Validation | 3–27 April | Compare development choices on 30 April, after the last validation window has closed. |
| Final test | 1 May–28 June | Freeze choices before these predictions. Evaluate once the required outcomes are known. |
This is a sample schedule, not a universal split recipe. Document the boundary records excluded by its gaps and the unknown outcomes excluded from the export. Do not silently move inconvenient records into a different partition.
The listed export fields do not establish a customer grouping key. If the intended claim concerns unseen customers, obtain a permitted grouping identifier and design the grouped, time-respecting split. Otherwise, do not claim that the ordinary time split measured performance on new customers.
Learn replacement values, scaling and category vocabularies from training data only, then apply those rules unchanged elsewhere.
For example, a replacement value fills a missing measurement; scaling changes a numeric range; a category vocabulary records which category names the model recognises. Choose those rules from the training partition. Applying them to validation and test data should not teach the process anything new about those partitions.
Explain missingness and permitted use
The missing-category rate is 115 ÷ 1,150 = 10%. Investigate whether blanks cluster by channel or month. Automatically dropping these rows could remove a particular kind of customer request. Consider an explicit “unknown” category when it represents what the live system will actually receive. Check impossible timestamps and inconsistent category spellings too. Google's data-cleaning guidance covers common defects.
Confirm permitted training use with the data owner. Record the source, extraction date, access restrictions and retention requirements. Exclude unnecessary names and contact details.
Make a bounded readiness decision
After repairs, the 1,150 labelled tickets are candidates for an initial experiment, subject to split-boundary exclusions. Begin with a simple baseline: always predict the training set's most common class. DummyClassifier implements such comparisons. Also preserve the current operational rule for comparison.
Readiness does not establish that 1,150 examples are sufficient or representative. Inspect coverage of channels, products and seasons. More rows cannot repair leaked inputs or unreliable labels.
Try it
A ticket arrives at 09:00. Its channel is known immediately; an agent changes its category at 11:00. Which value belongs in an arrival-time model?
Check the arrival-time inputs
Answer: Use the channel and the category recorded at 09:00, including a genuine missing value. The 11:00 category is too late.
Further reading: Google's dataset characteristics lesson.