查看: 17915| 回复: 17
跳转到指定楼层
上一主题 下一主题
收起左侧

AB test复习笔记及面试考点梳理分享

   
全局:

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
附件包含两个文件:第一个文件是我自己整理的Google 的 ab test课程的笔记,第二个是根据设计一个ab test,面试可能会涉及的知识点以及坑
文字版如下,因为新手不能发图片,note里有大量截图无法上传,推荐直接下载附件。欢迎进群和准备数据分析面试的小伙伴一起讨论,进群方式在这里. 1point 3 acres


AB Testing
Introduction
What you cannot do with ab testing
e.g. add premium service- users need to opt-in to the service, cannot do randomly assigning (the willing in control and test group need to be the same)
referral- will take too long. .и
update logo – surprisingly emotional, user need some time to get used to it

Business Example
Goal – if change the start button’s color
Metric – click-through-probability (measure impact) instead of CTR (measure usage)
Distribution – Binomial
Hypothesis testing – H0:P control = P experiment , cut-off=0.05. 1point 3 acres
..
pick significant boundary-. check 1point3acres for more.
practically significant(business) vs statistically significant (repeatedly)
medicine 10~15% change, for online world, 2% is important

statistical power- Size vs power trade off       -baidu 1point3acres

我们把第一类错误出现的概率用α表示。这个α,就是Significance Level。
第二类错误(Type II error),用β表示。根据条件概率的定义,可以计算出β = 1 – power. From 1point 3acres bbs
第一类错误α(false positive)不超过5%。也就是说,Significance Level = 5%。
第二类错误β(false negative)不超过20%。也就是说,Statistical Power = 1 -β = 80%。
Baseline Rate-当baseline很大(接近1)或者很小(接近0)的时候,实验更容易检测出差别(power变大),如果保持power不变,那么所需要的样本数量变小。
Minimum Detectable Effect-参数越大(比如10%),说明我们期望实验能够检测出10%的差别即可。检测这么大的差别当然比较容易(power变大),所以保持power不变的情况下,所需要的样本量会变小。


. 1point3acresCalculate result.google  и


.1point3acres
Choose Metrics

Two types of checks
•        Invariant checking: Metrics that shouldn’t change between your test and control. 1point3acres.com
•        Evaluation: High level business metrics, user experience with the product
How do we go about making a definition of a metric (for sanity checking)?

1.        High level concept of metrics (e.g active users, CTR)
2.        Details (e.g. how do you define user activity)-baidu 1point3acres
3.        Take a set of metrics and summarize them into a single metric (e.g. overall evaluation criterion (OEC))

High-level concept for metrics



some metrics may be difficult to measure. In such case, we can compare with external data or use internal data. With internal data, we can do. 1point 3acres
•        Retrospective analysis: Look at historic data to look at changes and see the evaluation.google  и
•        Surveys and User experience research: This helps you develop ideas on what you want to research
You can gather additional data by
1.        User Experience Research (UER) - high depth on a few users. This is good for brainstorming. You can also use special equipment in a UER (e.g. eye movement camera) that you cannot use on your website. You may want to validate the results using retrospective analysis. Waral dи,
2.        Focus groups: Medium depth and # of participants. Get feedback on hypotheticals, but may run into the issue of groupthink
3.        Surveys have low depth but high # of participants: Useful for metrics you cannot directly measure. Can’t directly compare with other metrics since population for survey and internal metrics may be different.



Define the metric
.--
Filter the traffic and Segment
The goal is to filter out those bots and crawler traffic. To avoid bias, we need to find the baseline. we can do slicing by country, or other categories, and look at the pattern week by week or day by day.

Summary Metrics

4 categories of metrics
•        Sums and counts (e.g. # of users who visited a page)
•        Distributional metrics - means, medians, percentiles (do a retrospective analysis, if normal distribution, then mean or median, if skewed distribution, percentiles).
•        Probabilities and rates.1point3acres
•        Ratios (e.g. revenue/click)

Sensitivity and Robustness
e.g. mean is sensitive to outliers, median is robust but not sensitive to changes to small group of users.
This can be measured by using prior experiments

(assume the videos are comparable)
Another alternative is to do A/A tests to see if the metric picks up any spurious differences

(assume 5 has the highest resolution)


Absolute vs Relative
The simplest way to compare metrics for test and control is to take a difference.
If you are running a lot of experiments you want to use the relative difference i.e the percentage change. The main advantage of computing the percentage change is that you only have to choose one practical significance boundary to get stability over time. If you are running a lot of experiments over time, your metrics are probably changing over time. Using relative difference helps here by having to use one practical significance boundary rather than change it as the system changes. The main disadvantage is variability, relative differences such as ratios are not as well behaved as absolute differences

Calculating variability
To calculate the confidence interval, you need
•        Variance (or standard deviation)
•        Distribution

Non-parametric methods. 1point 3 acres
通常对样本进行统计分析的时候,首先要假设他们来自某个分布,然后用样本中的数据去estimate这个分布对应的参数,之后再做一些test之类。比如你假设某个样本来自同一个正态分布,然后用样本数据估算和,再用估算出来的这两个值做test。non-pararmetric则不然,不对总体分布做假设,自然也就不必estimate相应的参数。一个比较简单的例子是Sign test,可以用来检验两个分布X和Y的中位数是否相等。在这里不必介意X和Y分别是什么分布,只在意样本中每对x, y的相对大小。如果中位数相等(),那么 P(X>Y) = 0.5,所以去除刚好相等的情况之后,x > y 的样本数量应该是符合二项分布的。像这样就可以在在不对X和Y的分布做任何假设的情况下检验X和Y的中位数是否相等。

At Google, it was observed that the analytical estimates of variance was often under-estimated, and therefore they have resorted to use empirical measurements based on A/A test to evaluate variance. If you see a lot of variability in a metric in an A/A test, it is probably too sensitive to be used. Rather than do several multiple A/A tests, one way is to do a large A/A test, and then do bootstrap to generate small groups and test the variability.

With A/A tests, we can
•        Compare result to what you expect (sanity check).--
•        Estimate variance empirically and use your assumption about the distribution to calculate confidence
•        Directly estimate confidence interval without making any assumption of the data

Designing an Experiment

Choose subject (unit of diversion). .и
User id.google  и
Anonymous id(cookie)
Event
Device id.--
IP address

1)User consistence –users visibility or Measure learning effect (if load is slower, will users use less, need to see across time)
2)Ethical consideration.--
3)variability – empirical variability may be much higher than analytical variability.
Because when unit of analysis (the denominator of metrics) is different from unit of diversion. E.g. unit of analysis is pageview and unit of diversion is cookie.
When you’re doing event-based diversion, every single event is different random draw. When you’re using cookie- based diversion, they are correlated,which increase the variability.

Choose population: What population are you going to use (US only?). 1point3acres.com
.

Size - unit of diversion 不同,size 不同


. From 1point 3acres bbs
Targeting the experiment to the appropriate traffic can reduce the size of experiment
But we need a pilot first to determine which cohort will be impacted mostly
. Χ
Duration
How long to run the experiment, when run


Analyzing result
Sanity check : invariant .1point3acres
Single Metric:CTR
Because CTR distribution is more like poisson other than binomial, we use empirical SE
Confidence interval is 0.022~0.038 .1point3acres
. 1point3acres.com






Simpson’s paradox
..
从结果看,control的CTR比exp高,但是分别看new user 和experienced user,都是exp组更高,这是因为new user的CTR比较高,而更多的new user在control组


Multiple Metrics. 1point 3 acres
The more things you test, the more likely you are to see significant difference just by chance. This is a problem, but since it is not repeatable for the same metric across multiple attempts, there is a way out. One can do multiple runs of the experiment, or alternately bootstrap. There is another technique called multiple comparison that adjusts your significance levels that accounts for how many metrics or tests you are doing.. 1point3acres.com

. Waral dи,
Final project

Choosing invariant metric—not impact by the test ..

Choosing evaluation metrics – from high level (company’s goal define metrics)

Calculating standard deviation – you need to know the dis.1point3acres

Calculating number of page –
影响样本量的4点. 1point3acres.com
我们把第一类错误出现的概率用α表示。这个α,就是Significance Level。.
第二类错误(Type II error),用β表示。根据条件概率的定义,可以计算出β = 1 – power
第一类错误α(false positive)不超过5%。也就是说,Significance Level = 5%。
第二类错误β(false negative)不超过20%。也就是说,Statistical Power = 1 -β = 80%。
Baseline Rate-当baseline很大(接近1)或者很小(接近0)的时候,实验更容易检测出差别(power变大),如果保持power不变,那么所需要的样本数量变小。
Minimum Detectable Effect-参数越大(比如10%),说明我们期望实验能够检测出10%的差别即可。检测这么大的差别当然比较容易(power变大),所以保持power不变的情况下,所需要的样本量会变小。

Choosing duration and exposure –
如果一周有起伏,起码要持续一周,population or cohort?
.1point3acres
Sanity check –
Invariant metrics

. 1point3acresEffect size- statistical significant, practical significant

Sign test

面试考点

基本概念. check 1point3acres for more.
treatment factor – 要检验的,比如奖励的门槛
treatment level – 门槛的不同等级
response variables – 去检验的结果,比如顾客的反应
background factor – 周围的因素,比如天气
biased factor – 对结果造成影响的background factor
confounded factor - 对结果造成影响的treatment factor

哪些因素会对实验的有效性产生影响
成熟度 – 实验对象越来越熟悉实验.1point3acres
测试 – 反复测试
自选择 – 如顾客主动加入会员.google  и
实验对象流失. 1point3acres.com
相关性误认为是因果
jone herry效应 – 因为知道自己在实验组所以更加努力.
丧气效应 -因为知道自己在实验组所以更加不努力

what to test in ads industry?
•        targeting – customer segment
•        frequency - impression#
•        flighting – when to scheduling the ads
•        channel . 1point 3acres
•        content


design an experiment
1.        have clear objective

2.        define the metric (invariant checking vs evaluation)
2.1.        High level concept of metrics (e.g active users, 结合公司目标)
2.2.        Details (e.g. how do you define user activity-DAU…)
2.3.        Measurement
2.3.1.        Sums and counts (e.g. # of users who visited a page)
2.3.2.        Distributional metrics - means, medians, percentiles (do a retrospective analysis, if normal distribution, then mean or median, if skewed distribution, percentiles)
2.3.3.        Probabilities and rates
2.3.4.        Ratios (e.g. revenue/click)
2.4 one metric or a suite of metrics (The more things you test, the more likely you are to see significant difference just by chance. There is another technique called multiple comparison that adjusts your significance levels that accounts for how many metrics or tests you are doing)


a.       Long-term use short-term proxy
b.       Invariant is for sanity check
c.       Think about how spam/bots would influence your metric. .и
d.       Sensitivity and Robustness- when choosing metrics, make sure the directional change of the metric is in line with your expectation and the change is unlikely due to bot behavior and it would not take too long to evaluate.
e.g. mean is sensitive to outliers, median is robust but not sensitive to changes to small group of users. can use a/a test to measure the robustness

Calculating variability – 统计学or estimate the variance empirically with a/a test.
如果样本量够大:n*p>=5 and n*(1-p)>=5
近似normal distribution
. 1point 3acres


3.        Choose population
Inter-user (两组用户)
Intra-user (一组用户,前后实验)
Control variables (demographic, behavior in the past…)
US only?

4.        check unit of diversion – consistent experience, user visibility. 1point3acres.com
User id
Anonymous id(cookie)
Event. ----
Device id
IP address
1)User consistence –users visibility or Measure learning effect (if load is slower, will users use less, need to see across time)
2)Ethical consideration
3)variability – empirical variability may be much higher than analytical variability. . 1point 3 acres
Because when unit of analysis (the denominator of metrics) is different from unit of diversion. E.g. unit of analysis is pageview and unit of diversion is cookie.
When you’re doing event-based diversion, every single event is different random draw. When you’re using cookie- based diversion, they are correlated,which increase the variability.
.
5.        Control variables
. check 1point3acres for more.
randomized experiment,
when volume is high enough volume to avoid bias
in web traffic experiment. because you cannot control what traffic will come in,
可以后期过滤 如过滤新用户

Matched pair experiment. From 1point 3acres bbs
List potential variables
Is the data available?
Logical connection between control and target variables
Test correlation between control and target variables
Test correlation between control variables and delete repeated ones

How to select pairs---distance score

6.        sample size
第一类错误α(false positive)不超过5%。也就是说,Significance Level = 5%。
第二类错误β(false negative)不超过20%。也就是说,Statistical Power = 1 -β = 80%。
Baseline Rate-做实验之前的指标数值。当baseline很大(接近1)或者很小(接近0)的时候,实验更容易检测出差别(power变大),如果保持power不变,那么所需要的样本数量变小。
Minimum Detectable Effect-参数越大(比如10%),说明我们期望实验能够检测出10%的差别即可。检测这么大的差别当然比较容易(power变大),所以保持power不变的情况下,所需要的样本量会变小。考虑business perspective,online有2% change就很高
根据软件算出的是每组样本量

7.        duration. 1point 3 acres
总样本量/每天量
考虑weekday/weekend不同

8.        analyze the result
. From 1point 3acres bbs
Sanity check (make sure test and control are comparable, e.g. test of mean for invariant variables with t test)

9.        Make suggestion
a.       Do I have statistical/practical significance?
b.       Do I understand the change? Who is going to be impacted?.--
c.       Is it worth it? Cost vs benefit?





.
广告业
measurement metrics
•        lift = (actual conversion-baseline)/baseline
•        ROAS (return on ad spend) = revenue / cost


Example: post an ad on facebook. check 1point3acres for more.


Randomized control trial (RCT)
. 1point 3 acres
Step 1 Randomization check: control group and test group
User age, gender, married, length of time using FB, # of friends, # of FB uses in last 7 days/28 days
. ----
Step 2 serve ghost ads. ----
if control group should get the ads, show them the second ads. If they shouldn’t get the ads, show them the original ads

step 3 calculation.
. 1point3acres
. 1point 3acres
step 4 减少selection bias的方法
.--
individual – based comparison
•        exact matching .--
•        propensity score matching
•        regression adjustment-baidu 1point3acres
market – based comparison
选取两个相似的市场

. check 1point3acres for more.
.--
With A/A test, we can
1.        Test sensitivity and robustness: if there is lots of variability, to sensitive
2.        Compare result to what you expect (sanity check)
3.        Estimate variance empirically and use your assumption about the distribution to calculate confidence
4.        Directly estimate confidence interval without making any assumption of the data
5.        a/b test duration. Χ


pitfalls
1.        interaction: 两组互相影响,比如uber 司机乘客,facebook friends
解决方法:选取完全隔绝的两组(network, geo) then match comparable market in pairs ..
2.        novelty effect
解决方法:only select new users. check 1point3acres for more.
3.        需要较长时间才知道结果,如subscription retention
解决方法:use model to find short metrics can move the long term one. ----
4.        selection bias
解决方法:exact matching
5.        test win but not launch it –labor cost, risk and bug
6.        多个metrics一起实验,容易出现significant
7.        learning effect
8.        看到p value significant 就停止实验
9.        Seasonal effect in experiments – airbnb traveling season. 1point 3acres
10.        Cannibalization – because of the potential interaction of people within each experiment group.



AB Test.zip

6.66 MB, 下载次数: 722, 下载积分: 大米 -1 颗

评分

参与人数 28大米 +62 收起 理由
student_T + 1 谢谢分享!
liayin + 1 很有用的信息!
grace19990252 + 1 给你点个赞!
简单喵 + 1 给你点个赞!
eve2ada + 2 很有用的信息!

查看全部评分


上一篇:新人求教
下一篇:FB Contractor 转正工资是有增加吗?
全局:
感谢楼主分享~ 看到很多人说Google的ab testing课程适合入门,但是对于面试还是过于简单,楼主有没有推荐的进阶课程?

评分

参与人数 1大米 +1 收起 理由
kyan729 + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

全局:
这个课真的是超级入门吗,为什么我感觉我看的特别痛苦,难崩
回复

使用道具 举报

推荐
applemm 2021-11-4 23:49:20 | 只看该作者
全局:
收藏,感觉有很多 udacity 课堂上的笔记。谢谢分享。
回复

使用道具 举报

全局:
感谢楼主!收藏一下!
回复

使用道具 举报

全局:
非常非常感谢楼主分享!!
回复

使用道具 举报

🔗
fyxc 2021-10-18 14:52:33 | 只看该作者
本楼:
全局:
mark xia
回复

使用道具 举报

🔗
Flyhope 2021-10-31 15:35:29 | 只看该作者
全局:
感谢分享!
回复

使用道具 举报

🔗
wallice 2021-11-7 08:46:50 | 只看该作者
全局:
感谢分享! mark一下
回复

使用道具 举报

🔗
律__ 2021-11-7 09:54:17 | 只看该作者
全局:
也太牛了8!收藏一下!
回复

使用道具 举报

🔗
elitist 2021-12-30 06:17:22 | 只看该作者
全局:
收藏啦 谢谢分享!
回复

使用道具 举报

🔗
Adelaaa 2022-1-3 10:08:44 | 只看该作者
全局:
感谢分享。。!正在刷课in
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表