资深面试官眼中的「数据科学」案例分析面试 (3)

Viewed 16

资深面试官眼中的「数据科学」案例分析面试 (1)

资深面试官眼中的「数据科学」案例分析面试 (2)

(接上文)

Q5: How to design & optimize your recommendation model?

对于一部分 data scientist 岗位和大部分 machine learning engineer 岗位, model theory 的考察是必不可少的. 就像我在上文提到的, 在这里面试官要考察的是对基础知识点的深刻理解. 两个关键词: "基础"和"深刻".

比如, 设计推荐系统模型时我们可以直接把它建模成一个 logistic regression 分类问题, 那么面试官可能会针对 logisitic regression 提出这样一个问题:

Q5.1. What’s the difference and correlation between ordinary linear regression and logistic regression?

这个问题回答的角度有很多, 算是一个开放式问题. 但是, 如果我们只回答"两者的 Model assumption 不同" 或者 "两种 model 对应的 label type 不同 (continuous vs. categorical)", 那么一般很难令面试官满意.

我建议的回答角度是, 在 Generalized Linear Model (GLM) 的框架下对两个 model 的assumption 进行比较. 当然完全没必要当场把 GLM 的复杂定义全写出来, 只要展示出两个这Model 是在 g(E(Y|X)) = X*beta 的框架下, 根据不同的 assumption 选用了对应的 link function g(). 就可以了.

可能很多朋友对 GLM 很不屑, 觉得它很土. 那咱们还是回来讨论推荐系统模型: How to design your recommendation model?

首先, 推荐系统至少包括两部分: candidates generation 和 fine-tune scoring. 前面提到的 logistic regression 模型是在 fine-tune scoring 阶段的一种基本方法, 我们回过头来讨论 candidates generation 这一步. 我们从简单到复杂有多种不同的模型选择:

  • K-nearest neighbor: 也就是 collaborative filtering 最简单的实现方法, 直接基于 item-based or user-based 方法找出用户可能喜欢的一组商品. 模型比较简单, 更新速度快.

  • Matrix Factorization: 综合 item & user 全部信息进行推荐, 精度较高. 但每次计算比较耗时, 不便于实时更新.

  • Neural Network: 可以整合更多 user profile 信息进入模型, 是比 Matrix Factorization 更加通用的方法, 计算精度更高. 但是模型更加复杂, 做实时预测时会有一些延时或者需要较多 computation resource.

对模型理论知识点的准备, 不需要过分追求很新很难/很高级的模型. 首先要把最基础的机器学习模型知识点掌握清楚, 其次要注意多对不同模型的特点做横向比较. 面试官希望你清楚为什么选用了这个模型, 它背后的 intuition 是什么? 你权衡了哪些不同的 tradeoffs, e.g. accuracy, latency performance, etc?

Q6: How to evaluate your recommendation model?

在这一步我们主要讨论的是利用 validation data set 做 offline evaluation 的问题. 除了 cross-validation 的具体操作方法之外, 需要了解常见的 evaluation metrics:

Regression problem: Mean Squared Error (MSE), Mean Absolute Error (MAE)
Classification problem: Accuracy, Precision, Recall, F1, AUC

其中 classification problem 的 metrics 相关问题是最常见的, 比如:
Q6.1. How to prioritize precision and recall metrics in different use cases?
Q6.2. How to explain AUC from a probability perspective?

这部分内容难度不大, 要求大家在面试时对相关知识点要足够熟悉.

Q7: How to evaluate business impact of this project?

这里主要涉及到的是 online evaluation, 即 A/B testing. 这是 Data Analyst 面试的绝对重点, 在一部分 Data Scientist 面试中也会考到. 要把相关问题答好, 首先要熟悉 experimental design 的基本框架, 这也是我前面提到的第二个需要总结的解决问题框架. 整个 A/B testing experiment pipeline 至少要包含以下5部分:

  • Treatment definition (i.e. objective definition)

  • Metrics definition and selection

  • Set up experiment, including sample size, randomization

  • Conduct hypothesis

  • Interpret experiment result

这里针对任何一个步骤, 面试官都可以展开一些针对基础知识点的深刻理解的考察. 比如:

  • What is p-value?
  • How to determine sample size?

最后, 在实际应用场景下的 A/B testing 问题处理也是常见考点, 比如以下几个问题:

Q7.1: What if your experiment p-value is 0.051? How would you explain this result to your product manager?

Q7.2: Given the sample size request, how do you choose between running your experiment for 1 week with 20% traffic and running your experiment for 2 weeks with 10% traffic?

Q7.3: Although your experiment needs 2 weeks to collect the long term effect, you are only allowed to run your experiment for 3 days. What can you do about that?

注意, Q7.3 并不是一道Behavior Question题...而是广告领域非常常见的实验分析问题.

(未完待续 ... )

0 Answers