技术指南

分位数回归

分位数回归根据可用输入预测结果的选定百分位。

听听这个指南AI叙述 · ~3 min

在本页3 分钟阅读
  1. 概述
  2. 深入探讨
  3. 现实世界的实施
  4. 分位回归的未来
  5. 付诸实践
  6. 不断探索
  7. 常见问题

概述

当中位数或上尾估计比均值预测更能回答规划问题时,这种方法非常有用。

深入探讨

Ordinary least-squares regression targets a conditional mean. Quantile regression targets another point in the conditional outcome distribution, such as the median or the 90th percentile. The inputs might describe a parcel's route and dispatch time; the output could be a delivery-time percentile for parcels with those characteristics. The median is the 50th percentile. For a continuous outcome with a well-estimated conditional 90th percentile, roughly 90% of comparable outcomes should fall at or below that value. This is a statement about a distribution of outcomes. It is not a claim that the predicted value itself is correct with 90% probability. Quantile regression uses an asymmetric penalty called pinball loss. At a high quantile, underprediction costs more than an equally large overprediction. This pushes the fitted estimate upward relative to the median. Choosing a quantile therefore makes the planning objective explicit instead of hiding it inside an average. Separate lower and upper quantile estimates can form a prediction range. Estimates of the 10th and 90th percentiles suggest a nominal central 80% interval. The word nominal matters: a fitted model can be wrong. Evaluate the fraction of held-out outcomes covered by the interval and examine its width. Also inspect relevant groups rather than relying only on an overall average. Scikit-learn's QuantileRegressor provides a linear model with regularization. Quantile methods also exist for other model families. Predictions from separately fitted quantiles can cross, producing an upper estimate below a lower one. Check for that failure explicitly. Quantile regression gives a useful way to describe variation, but neither the training objective nor an attractive interval chart guarantees reliable uncertainty estimates.

现实世界的实施

交付团队预测具有相似特征的包裹的中位到达时间和第90百分位。上位百分位可用于提供更为审慎的计划估计,但需核实实际覆盖情况。

在假设的弹子机损失计算中,若第90百分位的实际结果为12而预测为10,则损失为1.8;若预测为14,则损失为0.2。

服务台预测解决时间的第10和第90百分位。它检查后续结果落在这些估计之间的频率,以及该区间是否过于宽泛。

分析师使用 scikit-learn 的 QuantileRegressor 构建线性分位数模型,然后用相同的留出数据和分位数损失与合适的非线性模型进行比较。

分位回归的未来

预测接口可以通过解释每个估计对应的计划问题,使分位数更易理解。预留服务容量的团队可能关注上位百分位,而另一团队可能需要典型时长。报告应将这些选择与观察到的覆盖率以及提前或延迟的成本关联起来。随着运营条件的变化,团队需要重新评估百分位预测及其区间。更好的不确定性沟通应通过展示假设、评估期间和实际结果与预测一起呈现,而不是仅显示更多小数位。

付诸实践

为什么这很重要

  • 成本与预算. 多年来,架构决策决定着性能和运营成本。
  • 更清晰的判决. 技术教育帮助团队选择正确的堆栈,而不仅仅是最新的堆栈。
  • 质量控制. 更好的工程选择可以减少生产中的可靠性事故。

留意

  • 优化一项基准测试可以隐藏更广泛的系统弱点。
  • 基础设施和维护成本常常被低估。
  • 随着系统变得更加复杂,安全性和可观察性差距可能会扩大。

后续步骤

  1. 在实施之前定义延迟、质量和成本目标。
  2. 在实际负载和数据条件下进行基准测试。
  3. 仪器监控错误、漂移和用户影响。
  4. 在扩展之前准备回滚和事件响应路径。

不断探索

免费通讯

获取每日AI简报

每个工作日早晨提供三条经过验证的AI故事,使用简明英文撰写。永久免费,无广告。

每个工作日发送一封邮件。一键退订。我们永不出售或分享您的地址。

测试一下自己

参加分位回归测验

每个答案即时反馈,课程通过后可获得可验证ID的可分享证书。

开始测验

支持免费AI教育。AI Understanding是一家501(c)(3)非营利组织——无广告,无付费墙,永不收费。 捐款

常见问题

什么是分位数回归?

分位数回归根据可用输入预测结果的指定分位数。当中位数或上尾估计比均值预测更能回答规划问题时,它非常有用。

交付模型估计有条件的第 90 个百分位数。哪种解释与连续结果和良好估计模型的指南相匹配?

条件分位数在给定输入的结果分布中定位一个点;这并不是单个数字预测准确的概率。

在分位数 0.9 处,预测 10 后的结果为 12。适用哪种弹球损失?

残差是正二,因此损失是二的 0.9 倍,即 1.8。

为什么拟合高分位数比拟合中位数更有利于更高的估计值?

弹球损失的不对称性使得在高分位数水平下预测不足的成本更高。

第 10 个和第 90 个条件百分位数形成哪个名义中心区间?

如果正确估计这些分位数,则第 10 个百分位数和第 90 个百分位数之间的概率质量为 80 个百分点。

模型名义上的 80% 区间仅涵盖 60% 的保留结果。得出以下哪个结论?

训练分位数并不能保证覆盖率;保留的结果显示评估数据的覆盖率不足。