ML System Design
How can a forecasting system support multiple prediction horizons, and what does it mean that SHAP is model-agnostic?
Ответить самому
Сначала сформулируйте ответ как на собеседовании, затем откройте разбор и оцените себя.
Короткий ответ
Multiple horizons can be handled by separate models, a multi-head model, direct multi-output prediction, or recursive forecasting. SHAP estimates feature contributions from changes in predictions under feature coalitions, so it can wrap many model classes.
Полный разбор
For multiple horizons, avoid forcing one fixed label if the business needs predictions for 1 hour, 6 hours and several days. Options include training one model per horizon, training a multi-output model with one head per horizon, or recursively feeding shorter-horizon predictions into longer-horizon forecasts. Direct multi-horizon models are usually easier to validate than recursive approaches because errors do not compound as silently.
Choose the design based on data volume, latency and consistency needs. Separate models are simple and debuggable; multi-head models share representations and can exploit related horizons; recursive models are flexible but vulnerable to accumulated error. Metrics should be reported per horizon because short-term and long-term accuracy have different product value.
SHAP is called model-agnostic in the KernelSHAP sense because it can treat the model as a black box and query predictions under different subsets of features. It estimates each feature’s marginal contribution averaged over coalitions. TreeSHAP is a faster model-specific variant for tree ensembles, but the conceptual idea is still attribution from prediction changes.
Типичные ошибки
- Use one horizon because it is convenient and ignore downstream decisions.
- Describe SHAP as reading model weights directly.
- Report one aggregate metric across all horizons.