M6-002Medium从零实现统计 · Implement from scratch🔥 大厂高频出现 8 次

手写 bootstrap 求人均指标的置信区间,并说明 B 取多少。

Implement a bootstrap confidence interval for a per-user metric, and say how many resamples you use.
💡 考场高分一句话答案:

有放回重抽样 B 次计算统计量,取 2.5%/97.5% 分位数;B 取 1000–10000,报告时说明。

Resample with replacement B times, compute the statistic, take the 2.5 and 97.5 percentiles. B between 1,000 and 10,000, stated explicitly.

📌 核心考察要点 (Key Points)

  • B 的选择:CI 端点估计的 Monte Carlo 误差约 $1/\sqrt B$;B=1000 已够,B=10000 更稳
  • 分层 bootstrap:A/B 场景应按组分别重抽样,保持组样本量固定
  • 偏态修正:分布偏斜时用 BCa 而非 percentile
  • 相关数据:序列相关时用 block bootstrap,块长 ≈ 自相关长度
  • Choice of B: Monte Carlo error at the endpoints scales as $1/\sqrt B$; 1,000 is adequate, 10,000 is safer
  • Stratified bootstrap: resample within each arm separately so arm sizes stay fixed
  • Skew correction: use BCa rather than percentile when the distribution is skewed
  • Dependence: block bootstrap when observations are serially correlated

🔍 大厂面试官连环追问 (Follow-ups)

  • B 太大会有什么问题?
  • 如何用 bootstrap 检验而非估区间?

🎯 关联大厂考题实战训练 (6 题)

嫌字多看太累?进入苏格拉底式对话推演实验室

零打字负担,以大厂考官真实困境切入,通过点选直觉选项暴露思维盲区,手把手推导 Why。

💬 开启对话式破冰 ➔
⚡
Test muscle memory on this topic via 3-Layer Flashcards
Active Recall: Mentally formulate Prompt ➔ Math Derivation ➔ Benchmark Implementation in 3 minutes.
🎯 Drill This Card Now➔