Uplift Modeling:原理,应用及Python实现

0、背景

无论是广告还是优惠券,我们都称为营销的干预手段,这些手段均有一定的成本(arppu降低/用户打扰/其他成本)。营销的目标就是:在成本有限的情况下最大化营销的总产出,这其中最关键的一点就是我们能否准确找到真正能被营销打动的用户,我们称之为营销敏感人群。

传统的倾向性模型 propensity model 用来解决以下问题:

  • 客户将来有多大可能购买?

而更先进的提升模型 Uplift Model 则用来回答以下更重要的问题:

  • 广告是否促使用户产生了消费意愿?
  • 有没有把钱浪费在广告上给那些已经打算从我这里购买的客户?
  • 广告是否使某些人购买的意愿降低(负面影响)?

换句话说,经典倾向模型(和大多数机器学习算法)在给定特征(x)的情况下预测目标(y)。提升模型目的在解决给定特征(x)的治疗(t)对目标(y)的影响。

Uplift Model将用户分为以下四个类型:

  • 不管是否看广告都会买什么的人(Sure Things)
  • 仅在有广告的情况下才购买的人(Persuadables)
  • 无论如何都不买的人(Lost Causes)
  • 本来买,但是看了广告后不买的人(Sleeping Dogs)

倾向性模型预测了用户转化的可能性。 提升模型可进一步细分用户,使得广告及策略精准的作用在Persuadables部分用户上,提升策略的效率及ROI。

1、uplift model模型原理

参考:智能营销模型-Uplift Model详解及Python使用_猫新人的博客-CSDN博客1. 背景概览在营销场景中,通过给用户营销动作,从而带来用户动支率的提升,如在给用户发送广告邮件或优惠券等。但营销客户可分为4类,分别为sure thing自然转化、persuadables营销敏感、lost causes无动于衷和sleeping dogs营销反作用,如下图所示(参考链接)。而除营销敏感以外人群进行营销都会增加运营成本,因此挖掘出对营销敏感的人群是非常有必要的。2. 方法介绍2.1 T-Learner论文地址:<>  T-Learner (Two Model)是将对照https://blog.csdn.net/u010654299/article/details/122795833?utm_medium=distribute.pc_aggpage_search_result.none-task-blog-2~aggregatepage~first_rank_ecpm_v1~rank_v31_ecpm-13-122795833.pc_agg_new_rank&utm_term=pylift&spm=1000.2123.3001.4430

1.1 元学习:双模型(差分响应模型,Two Model, T-Learner)

          

  步骤1: 使用对照组数据X和对应标签Y,训练模型

       步骤2: 使用实验组数据X和对应标签Y,训练模型 

       步骤3: 计算样本x的动作带来的Uplift Score

        在多实验场景中,如优惠券金额有多种,是将不同的实验组模型与对照组模型做差,得到不同动作下的uplift socre,然后,在根据不同约束从中选择最合适的动作。
  T-Learner方法具简单直观,但同时模型对样本利用不充分,对照组和实验组模型无法利用对方样本,且双模型存在累积误差,对数据不平衡响应较大
 

2、评估指标
2.1 ATT、ITE、ATE、CATE相关概念

(参考:聊一聊因果推断中的ATT、ITE、ATE和CATE - 知乎

ATE :Average Treatment Effect

ATT :Average Treatment Effects on Treated

CATEConditional Average Treatment Effect

ITE:Individual Treatment Effect

ATE:平均处理效应,如AB实验,受处理和未受处理的人群的效果的差的期望

ATT:受处理的人群的平均处理效应,受处理的人群通过PSM方法找出和他们一样的人做为替身,看他们的效果的差别

CATE:人群中某个subgroup的平均处理效应

ITE:个体的因果效应,也可以看成是个体的CATE

例子

如 Burde and Linden (2013) 论文中的例子

的例子,要比较村里有小学和村里没有小学(通勤去距离较远的小学)的孩子,他们的成绩表现是否有差别。

这里ATE是,代表村里有小学和村里没有小学的成绩表现差异的期望。那有人会说,这些孩子可能本来就有特征差异,比如村里有小学,可能他们家庭条件就比较好。那这里ATT登场了,就来控制他们的这些混淆变量。

这里ATT是,假设村里有小学的孩子,他们如果村里没有小学,会是什么样的表现呢?同一个人肯定没有办法既受处理又不受处理。那只能在没有小学的群体中用PSM等方法,找出和他们各种特征非常相似的人,如家庭背景、年龄啊,作为他们的替身。这样子就能在理想化的情况下,求同一批小孩,他们在有小学和没有小学的表现是否有差异。

CATE呢?举一个增长领域的例子,我们考虑到投入和产出,要把钱花在刀刃上。人群中有些人是sleeping dogs,就是无论你推广了还是不推广,它都不会转化。我们应该要把钱投入到那些”如果不推广他们就不会转化,但是推广了就会转化的“人群身上,这就是subgroup,我们就要计算给他们投放广告,能带来多少的效果提升(uplift)。

那什么情况下CATE是会等于ATE呢?当没有effect modification(修饰效应)的时候,CATE=ATE。 

修饰效应是什么呢?修饰效应指的是有没有一个因素的的不同,使得treatment对outcome的作用也产生了差异。比如是否存在某些因素使得subgroup和整个人群population的效果产生差异呢,是存在的,就是我们刚刚提到的人群特征。并且正是有了effect modification的存在,我们需要按照effect modification进行划分。

再举一个例子,实验看抽烟是否会导致肺癌。这里有一个性别的变量,如果性别的变量仅仅造成男女抽烟的比例不同,那它是一个confounder(混淆变量)。但是,如果性别会影响性激素分泌且性激素分泌会影响肺癌比例,那性别就是一个effect modification,我们需要分性别进行实验。

2.2 Qini Area、AUUC相关概念

2.1 The Weight of Evidence相关概念​​​​​​​

总结:NIV、NWOE均可用于评估,NIV用于评估各指标对于用户受策略作用下的提升情况(<0.05可认为此变量对于用户提升不显著),NWOE用于评估各指标内不同区间的响应程度。详细方法如下:

Data Exploration with Weight of Evidence and Information Value in R | Stitch Fix Technology – MultithreadedBinary classification models are perhaps the most common use-case in predictive analytics. The reason is that many key client actions across a wide range of ...https://multithreaded.stitchfix.com/blog/2015/08/13/weight-of-evidence/

2.1.1 The WOE/IV framework is based on the following relationship:

 2.1.2  Measuring Univariate Variable Strength with the Information Value:

Note that the IV is essentially a weighted “sum” of all the individual WOE values where the weights incorporate the absolute difference between the numerator and the denominator (WOE captures the relative difference). Generally, if IV < 0.05 the variable has very little predictive power and will not add any meaningful predictive power to your model

2.1.3  Extensions to Exploratory Analysis for Uplift Models

The net weight of evidence (NWOE) is the difference between the WOEs for the test group (WOEt) and the control group (WOEc),

 which is equivalent to

The net information value (NIV) for variable Xj is then defined as 

 NWOE and NIV work just like IV and WOE, just from an uplift perspective. NIV measures the strength of a given variable while NWOE describes the pattern of the relationship. Specifically, the higher the value of NIV, the better the given variable is at separating self-selectors – i.e., people who are self-motivated to buy – and persuadables that need to be motivated.

3、uplift模型的python​实战

3.1 基于pylift包的uplift实现

3.1.1 TransformedOutcome方法原理:

Y∗ : Transformed Outcome 

Y:转化标签 (1 or 0)

W:treatment实验对照标签

p=P(W=1) (the treatment policy)

TransformedOutcome期望:

即为uplift值。

因此,Any algorithm trained to predict Y∗, then, gives a prediction of uplift.

3.1.2 相关class

Class TransformedOutcome

up.randomized_search_params # Parameters that are used in `up.randomized_search()`
up.grid_search_params       # Parameters that are used in `up.grid_search()`


up.transform                # Outcome transform function.
up.untransform              # Reverse of outcome transform function.

# Data (`y` in any of these can be replaced with `tc` for treatment or `x`).
up.transformed_y_train_pred  # The predicted uplift.
up.transformed_y_train  # The transformed outcome.
up.y_train
up.y_test
up.y                    # All the `y` data.
up.df
up.df_train
up.df_test

# Once a model has been created...
up.model
up.model_final
up.Q_cgains # 'aqini' or 'qini' can be used in place of 'cgains'
up.q1_cgains
up.q2_cgains

Class UpliftEval

upev.PLOTTYPE_x  # percentile
upev.PLOTTYPE_y

# Overfitting theoretical maximal qini curve.
upev.qini_max_x  # percentile
upev.qini_max_y

# "Practical" max curve.
upev.qini_pmax_x
upev.qini_pmax_y

# No sleeping dogs curve.
upev.qini_nosdmax_x
upev.qini_nosdmax_y

附:参考资料、Documentation等

因果推断笔记—— 相关理论:Rubin Potential、Pearl、倾向性得分、与机器学习异同(二)_悟乙己的博客-CSDN博客_pearl 因果推断https://mattzheng.blog.csdn.net/article/details/119855174

Installation — pylift 0.1.3 documentationhttps://pylift.readthedocs.io/en/latest/installation.html​​​​​​​​​Chapter 5 Story Uplift Modeling: eXplainable predictions for optimized marketing campaigns | XAI Storieshttps://pbiecek.github.io/xai_stories/story-uplift-marketing1.htmlAbout Causal ML — causalml documentationhttps://causalml.readthedocs.io/en/latest/about.htmlAbout Wayfair | Pylift: A Fast Python Package for Uplift ModelingUplift models seek to predict the incremental value attained in response to a treatment. For example, if we want to know the value of showing an advertisement to someone, typical response models will only tell us that a person is likely to purchase after being given an advertisement, though they may have been likely to purchase already. Uplift models will predict how much more likely they are to purchase after being shown the ad. The most scalable uplift modeling packages to date are theoretically rigorous, but, in practice, they can be prohibitively slow. We have written a Python package, pylift, that implements a transformative method wrapped around scikit-learn to allow for (1) quick implementation of uplift, (2) rigorous uplift evaluation, and (3) an extensible python-based framework for future uplift method implementations.https://www.aboutwayfair.com/data-science/2018/10/pylift-a-fast-python-package-for-uplift-modeling/

Uplift-Model在贝壳业务场景中的实践 - 云+社区 - 腾讯云https://cloud.tencent.com/developer/news/705938

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值