產品數據分析熱門面試問題(上) — Product Case Interview Framework

A Summary of Product Interview Questions for Data Scientist: Part 1

Bert Lee // 李慕家
23 min readJun 2, 2021

已過的假日,趁著疫情關在家的時間,我把A Collection of Data Science Take-Home Challenges的40 Product Questions讀過,學習到許多以資料科學家的角度解決產品問題的方法,決定在此將本書的知識點和套路寫一份總結。

A Collection of Data Science Take-Home Challenges是前AirBnb資料科學家Giulio Palombo整理的一份資料科學家面試經典題庫,其中包含20個Take-Home Challenges,40個Product Questions以及6個SQL題組,有興趣的人可以直接到Data Masked官網了解:https://datamasked.com

此書中的40個題目其實並不是很好分類,因為一個知識點會穿插在多個題目中,一個題目中又包含多個知識點,簡單來說就是一個多對多關係。不過我還是盡力以我的理解整理出幾個框架和自己改編的範例:

上篇:Product Case Interview Framework
一、Business Improvement框架
二、Product Improvement/Add Feature框架
三、Problem Identification/Metric went down框架
四、Fraud Detection
五、Ads & Marketplace Specific
中篇:A/B Testing Challenge with Python下篇:A/B Testing Interview Questions

首先,我們需要知道在資料科學家的Product Case Study中,絕大多數情況,面試官不會直接告訴你要優化的Metric,而是會告訴你模糊的Business Goal,譬如:Improve Retention、Growth、Mobile Usage,你的工作就是要將這些Business Goal轉換為可量化的Metric。身為一位數據專家,如果你沒有做到這點,基本上你的面試已經失敗了;相反地,如果你達到這個任務,90%的問題也解決了。

Ok,那麼怎麼選取合適的Metric?怎麼找到影響指標的重要Variables(變數)?怎麼找到可行的改善方法?這本書透過40個例子一一示範給我們看。

看好了,世界🐶。

一、 Business Improvement框架

如何提升[某個網站]的[某個商業目標]? (e.g. 如何提升微信的用戶參與度?)

第一題,作者就以一個Business Improvement的題目開場,作者提出的解題框架如下:

1. 將Business Goal轉化為Metric2. 找到可能影響此Metric的Variables3. 選擇一個Model來用[②Variables]預測[①Metric]4. 設想一些可能的Model結果5. 提出Next Step

作者核心的概念,就是透過Data Science的方法找到影響商業目標的重要因素,再著手改善這些因素。我們一步一步的分解每個步驟:

1. 將Business Goal轉化為Metric

在本書中提到選取Metric有幾個要點:

① Concrete(具體):

  • [知乎上的問題回答率]
  • [知乎上的問題在一天內得到至少一個回答的比例] ⭕️

② Related to Company Mission:

  • 微信著重使用者之間的互動:考慮互動因素
  • 知乎著重高水平的內容質量:考慮質量因素

③ Related to Company Growth:

  • User Retention(/Engagement): [使用者每天平均訊息量]
  • User Acquisition: [每天的註冊量(在註冊後兩天至少有傳一封訊息)]

④ 避免Vanity Metric(虛榮指標): Metric A bot could improve

  • 如果一個機器人創造了一堆假帳號,你的Metric會上升嗎?

⑤ 使用者比例/百分位通常是比較Robust(穩固)的Metric

  • [16小時內得到回覆的比例]

優點:¹不受Outlier影響 ²考量到整體狀況

缺點:無法反應回覆時間「15小時➡️1小時」的進步,建議使用多個比例Metric。

  • [平均回覆時間(16小時內有回覆的情況下)]

假設平均回覆時間原本是8小時,後來一些原本不會回覆的店家開始很低效的回覆(平均回覆時間15小時),那麼整體平均回覆時間就被拉長了,但顯然整體回覆的狀況是在進步的才對。

  • 然而,若該Business Model很大程度依賴Outlier (e.g. Freemium, Gaming),用比例相關的Metric就不適用了,會抓不到Outlier。

⓺ 多數情況下,記得加入時間條件

  • [每個用戶的平均按讚數]
  • [每個用戶每天的平均按讚數] ⭕️

將Long-Term Metric轉化為Short-Term Metric

  • 當被要求評估長期效益時,我們需要建預測模型來判斷有什麼短期指標能夠很大程度上反映長期效益,如果沒有這樣的短期指標,我們就要用整個預測模型去評估長期效益。(e.g. Retention Rate, Lifetime Value)

2. 選取適當的(Feature) Variables

要選取哪些Variables作為Model的Input,與我們所想做的分析任務和產品背景有密切的關連,相當考驗我們對該產品的熟悉度和直覺,不過作者還是給了一些建議,我整理如下:

  • 最General的做法,就是考慮user characteristics/demographic(age, sex, country, etc.)和behavioral(related to their browsing behavior)。
  • 如果被問說user characteristicsbehavioral哪個比較重要(特別是Ads相關),behavioral通常會是更有用的變數,原因是:①使用者經常會幫家人、朋友買東西,這個是user characteristics無法猜測的。②以廣告來說,時機是最重要的,這同樣不是user characteristics可以表達的

"Famously, Facebook revenue spiked when they moved from demographic-based ads to using browsing data."

  • 處理Missing Values:這是Feature Engineering非常常見的問題,作者的說法是 ①用Median/Mean填充❌:在互聯網公司,出現缺失值通常是使用者的一種選擇(e.g. not filling out her profile, changing her privacy settings),我們應當保留這個資訊。 ②用模型預測❌:如果可以用其他Variables判斷該Missing Variable,那何不直接將其他Variables丟進可以處理高相關性Feature的模型(e.g. Tree Based)做預測。③直接填上“-1”表示缺失⭕️:這是作者認為最合理的做法。這邊補充一下我之前看過Random Forest處理缺失值的做法提供參考:

後續我有整理一些作者用到的Variables,大家可以參考。

3. Modeling & 4. Result Analysis & 5. Define Next Step

以產品分析的角度而言,Tree-Based Model會是我們的最佳夥伴,因為他們具有很高的可解釋性、很清楚地顯示變數與預測之間的關係、甚至表達變數的重要性,因此本書在做Supervised任務時,全部都是用Tree-Based Model。(當然我們還是要考慮到問題適不適合用Supervised的模型預測、某些情況或許應該用Anomaly Detection,e.g. Fraud)

① Random Forest使用場景:

優點:¹ High Accuracy。² Works well in high dimensions。³ Works well with categorical variables。⁴ Works well with outliers。⁵ Works well with correlated variables。⁶ Identify partial dependence。⁷ Identify variable importance。

  • 找到提升微信使用者參與度的方法
Ⓐ Input Variables:
¹ User characteristics (sex, age, country, # of friends, etc.)
² Browsing/online behavior (device, they came from ads/SEO/direct link, session time, etc.)
Ⓑ Label
Users who take at least one action per day: 1
Ⓒ Result Analysis & Next Step
Try to always have one "good" segment and one "bad".
"Bad" segment: users from Argentina are not very engaged
➡️ Check the Spanish translation that Argentinians see.
"Good" segment: Indians <30 yrs old are very engaged
➡️ Marketing team reach more of them via ads or specific marketing campaigns.
  • 預測LinkedIn使用者何時換工作
Ⓐ Input Variables:
¹ User profile (school, major, previous companies, job titles, job level, how long they have been at their previous/current companies, when they graduated, skills, relevant keywords from job description.)
² Time (Month)
³ User behavior (last time they have updated their job descriptions, skills, or asked for recommendations. Number of connection requests especially to HR or hiring mangers and, if available, even variables related to searching for jobs in the specific LinkedIn section.)
⁴ Demand about jobs in a similar field/level of the LinkedIn user.
Ⓑ Label
Changed Job in the given month: 1

② Decision Tree使用場景:

  • 分析為何臉書使用者中,iOS用戶用Instagram比例遠高於Andriod用戶(=Find discriminant variables.)
Ⓐ Input Variables
¹ User-related variables (age, country, education, engagement, etc)
² OS
Ⓑ Label
Use Instagram: 1
Ⓒ Result Analysis & Next Step¹ If tree choose other variables(real reason) first:
➡️ OS is acting as a proxy for those variables.
² If the problem is OS:
➡️ Collect all variables about the app (such as loading time, user clicks, bug reports) and see if you can find any significant difference between the two apps.
  • 分析本週抖音新用戶拉低平均參與度的原因
Ⓐ Input Variables:
¹ Behavioral
² Demographics related variables
Ⓑ Label
New user(this week): 1
Previous week users: 0
Ⓒ Result Analysis & Next Step
Look at where the tree splits to create a leaf with higher proportion of 1s.Those splits will tell you the characteristics of the additional new users.
¹ Way more users from China this week. This might depend on a marketing campaign there that got a huge number of users, but these users are less engaged.² All these new users come from very few different IP addresses. That would mean that all these users are probably fake accounts.

二、Product Improvement/Add Feature框架

你會怎麼提升我的產品?你會增加什麼功能?

告訴我你最喜歡的App,你會怎麼優化它?

微信朋友圈是否應該增加慶祝按鈕?

這種問題很容易誘導我們竭盡所能地發揮創意跟直覺,不過作為一個資料科學家的面試,面試官考察的其實是我們會怎麼一步一步地從可能有的數據中找到解答。

作者提出最安全的解題框架:

1. Look for Demand

Find something users are already performing today but inefficiently.

  • 對於訊息軟體來說,我們可以進行語意抽取和分群,找到經常出現的語意,通常對話開頭和結尾是最重要的。(e.g. 經常表達[喜愛])

2. Figure out Features to Simply the Action

舉例來說:

  • 經常在訊息中問對方看/收到了沒 ➡️ 已讀/已傳送功能
  • 經常在訊息中約講電話/視訊 ➡️ 電話/視訊功能
  • 經常問對方在哪裡 ➡️ 傳送位置功能
  • 經常將同一則訊息傳給多人 ➡️ Broadcast廣播功能

3. Verify [Feature Success ➡️ Business Success]

找到一個對於Business重要的Metric,評估Feature若是成功,是否能幫助提升此Metric,譬如:

  • 如果許多人使用微信朋友圈慶祝功能,使用者參與率會增加。
  • 如果許多人的貼文被慶祝,這會鼓勵使用者多發文,再次增加參與率。

4. A/B Testing for the Feature

三、Problem Identification/Metric went down框架

本週微博使用者的平均按讚數YoY驟減,你會怎麼找出原因?

突然間,我們的Dashboard顯示今日IE使用者的圖片上傳量降為零,有什麼可能的原因?

其實Problem Identification有部分跟Business Improvement是Overlap的:在找Business Improvement機會時,我們會希望找到表現差的Segment進行改善,找到表現好的Segment進一步擴張,這個過程中我們就會找到發生問題的地方。這邊針對「某個Metric驟降」這類題目做一個整理:

Step 0. 判斷Root Cause: [ⒶTechnical Problem] or [ⒷUser Behavior改變]

Metric驟降的原因不外乎這兩種情形。如果Metric突然降為0,也就是某群使用者全部停止進行該行為,我們基本上可以直接推測是技術問題。

Ⓐ Technical Problem

Step 1. 列舉可能的技術問題

如果是技術問題,那我們就要拆解工程上的每個環節,以上面舉的「圖片上傳」例子來說,可能原因會是:

  • ¹ IE使用者在上傳照片到網站上有問題(User-facing bug)
  • ² 使用者可以上傳照片,但我們儲存記錄和照片的code出問題
  • ³ 照片有正常儲存,但我們抓取上傳數據的Query出問題
  • ⁴ 抓取的數據沒問題,但Dashboard顯示出問題

(Step 2. 提出未來應對的可能方法)

對於User-facing bug,一個常用的處理方法是:

  • ¹ 建立一套即時蒐集客戶問題提單機制
  • ² 用NLP抽取提單中的Bug並進行分類
  • ³ 自動發信給負責該產品的工程團隊

Ⓑ User Behavior改變

Step 1. 逐步拆解該Metric的組成,逐一分析。

以上面舉的「使用者的當週平均按讚數YoY」驟降為例,可能原因是:

  • [本週使用者平均按讚數驟降](分子⬇)
  • [去年本週使用者平均按讚數陡升](分母⬆)

假設[本週使用者平均按讚數驟降]:

可能原因是:

  • [本週按讚數驟降](分子⬇)&[使用者數量不變](分母➡)
  • [本週按讚數不變](分子➡)&[使用者數量增加](分母⬆)

Step 2. 找到可能原因&提出解決方法

假設[本週按讚數驟降](分子⬇)&[使用者數量不變](分母➡):

可能原因是:

  • 某個Segment表現驟降,趨於0則可能是技術問題 ➡️ 解決該技術問題。

假設[本週按讚數不變](分子➡)&[使用者數量增加](分母⬆):

可能原因是:

  • 本週增加了許多新客戶,但這些新客戶參與度很低 ➡️ 進一步用模型分析這些新客戶的特性,找出可以改善的方法。(這個例子在前面Decision Tree的地方有寫。)

四、Fraud Detection

判斷蝦皮上的Fake Listing有哪些重要的Variables?

如何判斷LinkedIn上假冒的學歷?

進行Fraud Detection有幾個通則:

1. 理論上為Unique的Variables對於判斷詐騙很有幫助。

“People hardly commit just one fraud. They do as many as possible, once they find a successful strategy. However, a user, in order to commit multiple frauds on a site, needs to keep changing user_id and create new accounts. Therefore, all those variables that should be unique by ID can be very useful to identify fraudulent behavior. This is because they allow to track the same user across different profiles. For instance: device ID, IP address, physical address, credit card number, etc.

2. Anomaly Detection是評估詐騙很好的做法。

我們應該可以相信多數人是不會進行詐騙的,因此詐騙通常是一種異常行為,若我們能夠判斷哪些行為是Anomaly,我們就很有機會抓出詐騙行為。

在這裏說一下用Supervised Learning處理Fraud的問題

  • 需要很多Fraud Labeled Data讓模型學習,但Fraud資料通常不多。
  • 若過去我們Label有錯,沒有正確偵測到Fraud,模型會持續犯錯。
  • 詐騙行為與時俱進,模型無法找到新的Fraud Pattern。

而用Anomaly Detection會有的問題

  • High Dimension的情況下,幾乎每筆資料都會是至少一個維度的Outlier,需要花大量時間定義Anomaly。

最好的做法是,同時用Supervised Learning偵測與過去Fraud Pattern相似的行為,並且用Anomaly Detection偵測異常行為。

3. 實務上,針對Segment進行Product Re-design可以提高效率。

為了防止詐騙行為,許多產品會設置Two-step authentication,這樣會同時擋掉一些詐騙者和非詐騙者,因此我們要評估[漏掉一個Fraud的代價]和[擋掉一個合法使用者的代價]。到這裡,其實就與Choose the right threshold, Pick the best point in ROC Curve是同樣的解法。

實務上,最有效率的方法不是讓所有人都做或不做雙重驗證,而是先評估該行為/使用者是Fraud的可能性,比如說低於10%直接通過,高於50%直接擋下來,介於10–50%就做雙重驗證。

以下舉幾個Fraud的例子:

  • 判斷蝦皮上的Fake Listing之重要Variables
1. Characteristics of the listing
* Pictures characteristics (low resolution)
* Price (too low)
* Words used in the description (copy)
2. Characteristics of the seller
* Device ID, IP address, bank/Paypal account, any personal information provided during the sign-up flow
* Ratings (No Ratings)
* Browsing behavior that led to the seller creating the account
  • 判斷LinkedIn上假冒的學歷
1. Safest approach: Validate school email2. Efficient approach: Anomaly Detection
* Variables:
Extract information about the user themselves, as usual, a combination of user info from their profile + how they interacted with LinkedIn. For instance, in this case, it would be very useful variables that show how many connection requests they sent, how they were distributed over time, acceptance rate, whether they visited other people profiles before sending the connection request. Add variables about their connections, such as school, location, as well as their connection connections.
* Possible Fraud:
They have very few connections who went to NTU.
They have several NTU connections, but they had a very low acceptance rate, i.e. to get 100 connections from NTU people, they had to send way more connection requests.
Their connections are not connected to each other, meaning they randomly sent connection requests to other NTU users, instead of classmates or lab-mates who should be all connected with each other.

五、Ads & Marketplace Specific

淘寶上的牛仔褲賣不好,你會怎麼評估是Demand問題還是Supply問題?

在沒有Labeled Data的情況,你會怎麼判斷一個廣告是不是在釣魚(標題黨)?

如果你在Google工作,你會怎麼提升他們的廣告點擊營收?

最後我節錄幾個廣告跟商場相關的題目:

1. 淘寶上的牛仔褲賣不好,是Demand問題還是Supply問題?

Demand:

  • 看牛仔褲的Ads click-through-rate (CTR)
  • 看搜尋牛仔褲並且有用到篩選功能的人
  • 看搜尋牛仔褲並且session time高於一定數值

(添加一些條件能夠排除掉Noise)

Supply:

  • #Conversions/#Searches
  • Filter usage:頻繁使用價格篩選 & Low Conversion ➡️ 價格過高

2. 在沒有Labeled Data的情況,怎麼判斷廣告是不是標題黨?

所謂的Clickbait(標題黨/誘餌式標題),就是一種典型的短期正效益,長期負效益行為。

① 以[CTR][CTR兩週內變化(已點擊過的使用者)]做為兩個Dimension進行分群,[CTR]高 ⬆️ & [CTR變化]低⬇️(效果驟降)的Cluster就是Clickbait。

② 當我們已經判斷出哪些是Clickbait,以後就可以用Supervised Learning去防止這種情況出現。

3. 怎麼提升Google的廣告點擊營收?

廣告點擊營收組成:

① Ad click through rate (CTR)

  • Better targeting:¹ Build products to collect better and more specific data about user intent. ² Improve CTR predictive models with more advanced techniques.

② Total number of times ads are shown to a user

  • Increase number of page views:Faster browsing.
  • Increasing the number of users or increasing page views per user:網頁無限下拉,不需換頁(減少瀏覽阻力)

③ Cost per click

  • Maximizing probability of a user converting on the advertiser site: ¹Focusing on probability of conversion on the advertiser site ²working with the advertisers to improve the user flow after people click on an ad.

上半篇就先寫到這邊了,下半篇我會再整理A/B Testing的部分。我沒想過在Medium寫Summary會這麼累,以後一定會謹慎評估要不要做這種事😇。

--

--

Bert Lee // 李慕家

Seek & Find | MSDS @Yale | Former Data Scientist @Disney+ & @DBS Bank | NTU Alumni | LinkedIn: https://www.linkedin.com/in/bertmclee/