概述
选择与决策相匹配的指标,在相同的评估窗口内比较预测,并包含朴素基线,而不要仅依赖百分比分数。
深入探讨
Forecast accuracy metrics turn prediction errors into summaries, but each emphasizes different properties. Mean absolute error averages absolute errors in the target's units. MAPE averages absolute error divided by the absolute actual value, often multiplied by 100. It is easy to read as a percentage, but it is undefined when actual values are zero and can be dominated by small actuals. It also treats over- and under-forecast errors asymmetrically in some settings because actuals appear only in the denominator. sMAPE attempts a symmetric percentage by scaling absolute error relative to the magnitudes of actual and forecast. Several formulas exist, some use a factor of two and others not, and zero-over-zero cases require conventions. Despite its name, sMAPE can behave unexpectedly around zero and does not guarantee fair comparisons across all scales. Always state the exact implementation. Mean absolute scaled error (MASE) divides a model's test-set MAE by the in-sample MAE of a naive forecast, typically the one-step persistence forecast for nonseasonal data. For seasonal data, a seasonal-naive denominator may be more appropriate. A MASE below one means the model's average absolute error on the evaluation cases is lower than the chosen naive in-sample scale. It does not mean the model always beats the baseline on every observation, and the denominator can be zero for perfectly constant training data. Use an evaluation period that reflects the intended forecast horizon, preserve time order and compare models on identical cases. Report metric definitions, units, treatment of zeros, aggregation weights and baseline. If many series are combined, averaging percentage errors may give tiny-volume series disproportionate influence. Pair a headline metric with error distributions and business costs, such as stockouts versus overstock. No single metric captures calibration of prediction intervals, bias, tail risk and operational impact at once.
现实世界的实施
假设某预测值为 90 个单位,而实际需求为 100。绝对百分比误差为 10%,计算方法是用绝对误差除以实际值。
当实际需求为零时,MAPE 的分母为零,百分比误差未定义;用一个小常数替换零会改变该指标,且应予以披露。
一位分析师使用 MASE,将测试集 MAE 除以样本内一步法朴素 MAE。低于 1 的数值意味着在评估案例中误差低于该朴素尺度,但这并不保证未来的优越性。
一个团队在发布结果前比较了 sMAPE 的实现公式,因为不同定义在分母和缩放上存在差异;来自不同惯例的数值可能不可比。
预测精度指标的未来:MAPE、sMAPE 和 MASE
预测仪表板可以通过在每个结果旁边展示指标公式、评估范围、零值处理和朴素基线来更加诚实。在比较产品或地区时,团队应同时展示以单位表示的尺度依赖误差和无尺度度量。随着需求模式的变化,仅使用每个预测来源当时可用的信息重新计算基线。当高估和低估预测的后果不同时,决策加权成本可以补充统计指标。明确的指标选择使得比较模型变得更加容易,而不会暗示一个百分比数字能捕捉预测质量的各个方面。
付诸实践
为什么这很重要
- 成本与预算. 多年来,架构决策决定着性能和运营成本。
- 更清晰的判决. 技术教育帮助团队选择正确的堆栈,而不仅仅是最新的堆栈。
- 质量控制. 更好的工程选择可以减少生产中的可靠性事故。
留意
- 优化一项基准测试可以隐藏更广泛的系统弱点。
- 基础设施和维护成本常常被低估。
- 随着系统变得更加复杂,安全性和可观察性差距可能会扩大。
后续步骤
- 在实施之前定义延迟、质量和成本目标。
- 在实际负载和数据条件下进行基准测试。
- 仪器监控错误、漂移和用户影响。
- 在扩展之前准备回滚和事件响应路径。
不断探索
常见问题
什么是预测精度指标:MAPE、sMAPE 和 MASE?
预测指标总结了预测值与观测值之间的差异,但 MAPE、sMAPE 和 MASE 对尺度和零值的处理方式各不相同。选择与决策相匹配的指标,在相同的评估窗口内比较预测,并包含朴素基线,而不要仅依赖百分比分数。
实际需求为 100,预测值为 90。在 MAPE 下,绝对百分比误差是多少?
绝对误差为 10,除以实际值 100,得到 0.10 或 10%。
当实际值为零时,MAPE 会出现什么问题?
MAPE 除以实际幅度,因此实际值为零会使百分比未定义。
在其通常定义下,MASE 低于 1 表示什么?
MASE 将测试 MAE 与选定的样本内朴素尺度进行比较;低于 1 表示平均误差低于该尺度。
为什么要在报告中说明确切的 sMAPE 公式?
不同的 sMAPE 变体和零值处理选择可能产生不可比的数值。
为什么 MAPE 可能会过度强调低量观测值?
除以较小的实际值会使相同的绝对误差成为更大的百分比贡献。