M2-088M2: Classical Machine LearningEvaluation Metrics & Hyperparameter TuningMedium
⚡Flashcard Drill➔Mastery:

Hyperparameter Importance Hierarchy and Efficient Tuning Strategies

🎯 Active Recall Self-Check (Draft First, Verify After)
Login-free practice tracker: recall core answer, audit pitfalls, and log review status.
Step 1 · Draft your concise answer & assumptions
Step 2 · Check Pitfalls & Follow-up Inquiries
Next: M2-089 →
📐 Mathematical Definition
importancei=Varhi[E[perf∣hi]]\text{importance}_i=\mathrm{Var}_{h_i}\big[\mathbb E[\text{perf}\mid h_i]\big]
⚡ One-Sentence Core Answer
Prioritize learning rate and regularization first, architecture second, and secondary parameters last; employ coarse-to-fine search and early-pruning strategies.

📌 Key Takeaways

  • •
    Tier 1: Learning rate, optimizer type, batch size (determine convergence dynamics)
  • •
    Tier 2: Regularization (weight decay, dropout, tree max depth, min child weight)
  • •
    Tier 3: Secondary architecture parameters (kernel sizes, activation functions, warmup schedules)
  • •
    Strategy: Coarse-to-fine random search combined with early-stopping heuristics (ASHA/Hyperband)

📐 Mathematical Derivations

Sensitivity Analysis: The response surface of objective metric y=f(θ1,…,θd)y = f(\theta_1, \dots, \theta_d) exhibits highly unequal variance across parameters. Using functional ANOVA (fANOVA), total variance is decomposed into marginal parameter contributions: Var(y)=∑iVi+∑i<jVij+…\text{Var}(y) = \sum_{i} V_i + \sum_{i < j} V_{ij} + \dots. Empirical benchmarks (e.g., Bergstra & Bengio) demonstrate that Learning Rate accounts for >50%>50\% of performance variation across optimization algorithms. Setting learning rate on a logarithmic scale (e.g., 10−510^{-5} to 10−110^{-1}) is mathematically mandatory because gradient descent step sizes scale multiplicatively.

🏭 Production Trade-offs

Efficient practical workflow: ① Stage 1 (Coarse Screening): Run 50–100 trials of Random Search or TPE across broad logarithmic bounds using aggressive early stopping (pruning after 20% of epochs). ② Stage 2 (Fine Tuning): Narrow bounds around the top 3 configurations and search with higher fidelity (more epochs, multiple random seeds). ③ Coupled Parameters: Tune jointly coupled parameters (e.g., learning rate and batch size, or tree depth and learning rate) rather than varying one at a time.
⚠️ Common Interview Pitfalls
  • ✕
    Tuning learning rate on a linear scale instead of a logarithmic scale
  • ✕
    Tuning low-impact secondary parameters (e.g., epsilon in Adam) while leaving learning rate unoptimized
🎯 Interviewer Follow-up Inquiries
  • ?
    Why must learning rate searches be conducted across logarithmic scales rather than uniform intervals?
  • ?
    How does the linear scaling rule relate batch size increases to learning rate adjustments in distributed SGD?
⚡
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➔
📚

Associated Knowledge Base Guides & Mindmaps

← PreviousM2-087: Comparing Grid Search, Random Search, and Bayesian Optimization📋 Back to BankNext →M2-089: Handling Randomness and Seed Variance in Hyperparameter Tuning
中文速览与面试要点

什么是超参的重要度排序?如何高效调参

用 fANOVA/消融估计各超参对性能的贡献,优先调重要超参(学习率、正则、深度)。

核心要点

  • 重要度估计方法:① fANOVA(函数方差分析) ——把性能的方差分解到各超参(及其交互),得到每个超参解释的方差比例;这是 Optuna、SMAC 等工具内置的分析。② 基于随机森林/GBM 的重要度 ——用已评估的配置训练一个模型预测性能,用其重要度近似超参重要度(简单有效)。③ 单变量消融 ——固定其他超参,只变一个,观察性能变化(直观但忽略交互)。 典型结论 (跨任务的经验规律): 学习率最重要 (常解释 30–50% 的方差),其次是正则强度(weight decay/dropout)、模型容量(层数/宽度)、batch size、优化器参数。 为什么学习率最重要 ——它直接决定优化的步长与收敛质量:过大导致发散/震荡,过小导致收敛慢或陷入差的局部解;且学习率与其他超参存在强交互(大 batch 需大学习率、强正则需更长训练)。
  • 高效调参策略:① 按重要度排序调参 ——先调学习率(用 LR range test 或对数网格),再调正则强度,最后调容量与次要参数;这样能在有限预算内获得最大收益。② 分阶段(粗到细) ——第一阶段用随机搜索在大范围粗筛(找有希望的区域),第二阶段在局部精细搜索。③ 早停与连续减半 ——用 Hyperband/ASHA 提前淘汰差配置(见上题)。④ 迁移与热启动 ——相似任务/相似规模上的最优超参作为起点;或利用'超参迁移'(如 μP 参数化使小模型的最优学习率可迁移到大模型)。⑤ 一次调一组相关参数 ——如'学习率 + batch size'、'学习率 + 调度'常需联合调(它们交互强)。⑥ 减少搜索维度 ——用领域知识固定一些参数(如优化器选 AdamW、激活选 GELU),把预算集中在少数关键参数上。⑦ 评估的稳定性 ——用 K 折或多次种子平均减少噪声;若评估噪声大于超参间的真实差异,调参就是拟合噪声。
  • 学习率通常最重要
  • 分阶段调参(先粗后细)

常见陷阱

  • 平均用力地调所有超参(忽略重要度差异)
  • 在评估噪声大时依赖单次结果调参