Windowed Inference
Externalizes time-dependent feature computation into stream processing
Intent & Description
π― Intent
Handle time-dependent features (rolling counts, sums, rates) correctly and consistently at serving time, especially in real-time contexts where recomputing windows over history is impractical.
π Context
Some features are inherently time-dependentβaverage transaction amount over last 30 minutes, count of logins in past hour. Computing them correctly at serving time in real-time context is far harder than in training pipeline that can look back over historical data.
π‘ Solution
Externalize necessary state and window computation into stream-processing component that continuously maintains rolling aggregate as new events arrive. At prediction time, model simply reads current value of precomputed windowed feature rather than recomputing window over history per request.
Real-world Use Case
- Fraud detection with time-based features
- Anomaly detection with rolling aggregates
- Real-time personalization with recency features
- Any model using time-windowed features in real-time serving
Source
π TL;DR
Externalize time-windowed feature computation into stream processing to maintain rolling aggregates consistently for real-time serving
Advantages
- Consistent time-windowed features between training and serving
- Efficient real-time feature computation
- Handles real-time serving constraints
- Maintains rolling aggregates continuously
Disadvantages
- Requires real stream-processing infrastructure
- Careful engineering needed for training/serving consistency
- Added operational complexity
- Need to replicate windowing logic for historical training data