Feature Engineering

Creating or refining input variables so a model can learn more effectively.

When is a waiting-time feature actually available?

A visitor arrives at 10:05 and is served at 10:17. The difference is a useful twelve-minute measure, but the time at which the model makes its prediction determines whether that measure is usable.

Predicting at arrival

The visitor’s completed wait is still unknown at 10:05. The queue length and the number of open desks are available if the system recorded them then.

Describing a completed visit

At 10:17, both timestamps exist. Subtracting arrival from service start produces an observed wait of twelve minutes, suitable as a training target for future predictions.

Can the training feature be rebuilt in production?

Try reconstructing one training row using only records available by its prediction timestamp. Computing the average wait of previously completed visits is plausible. Including the visitor’s own later service time would leak the answer.

Two clocks sit above a service ticket at a counter.
Arrival and service start are distinct events. A prediction made at arrival can use only what was known then.

Why the definition of a feature matters

“Queue length” might count people, appointments or parties. Define the unit and observation time so a busy group booking does not silently change what the model sees. Missing timestamps also need an explicit handling rule.

Follow the idea

Data Preprocessing · Normalize raw records before deriving variables.

Model Evaluation · Examine how later information can enter training.

Examples in the AI guides

Source · Google’s guide to working with numerical features

Return to Feature Engineering in the A–Z glossary