天池竞赛系列阿里移动推荐算法思路解析
Posted brucemengbm
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了天池竞赛系列阿里移动推荐算法思路解析相关的知识,希望对你有一定的参考价值。
赛题地址:http://tianchi.aliyun.com/competition/information.htm?raceId=1
登录就可以下载数据
从4月到7月,学习了非常多也收获了非常多
题目就不多说了。一句话表达就是依据过去一个月的行为预測14年12月19号的购买情况。
看题目貌似推荐算法。自然就有队伍想到用协同过滤什么的。当然效果不好。
首先是特征的问题,然后是这是基于行为的相似,不太类似用户和商品类似的ItemCF。UserCF,还有非常多其它的原因。比方我买过一部手机,难道还要推荐我再买其它类似的手机吗,当然这个比喻不太恰当。
最后还是归为2分类问题,当然从多分类也能够解决这个题目。
算法问题:既然二分类就要用到分类算法。从第一赛季和第二赛的实战情况来看,个人比較推荐的算法是C45,随机深林。GBDT。LR,数据量大的时候也能够增加并行的神经网络,之前天猫推荐算法第一名就是使用了自己并行化的神经网络。
训练集測试集构建问题:然后怎么建模呢,怎样选取训练集測试集。
既然是预測一天的购买情况,那我们一样能够把18号当作未知。来构建模型预測18号的购买情况。
那么我们能够把18号的购买与否来给18号前的数据打标签。形成UIR对(user,item,result)
在第一赛季时间充足的情况下事实上还能够弄个训练集和验证集。也就是用17号给之前的数据打标签做训练集,18号给之前的数据打标签做验证集。19号前的数据做线上測试集(19号的答案比赛结束后也没有给出)
数据不平衡问题:第一赛季的数据正负样本比例我忘了,第二赛季的好像是1:300来着,也就是说必须得採样了,详细採样比例还得自己做实验,在第二赛季我们的採样比例是1:10——1:14之间。
数据预处理问题:第一赛季数据量仅仅有1000W左右。预处理效果一般般。第二赛季效果就出来了,数据量58E。
由于有可能有异经常使用户的出现,比方一天点击上万次。或者点击非常多从不购买等问题。一般从两个方面来考虑。要么过滤异经常使用户的全部数据,要么仅仅取近期几天(3-7天都能够)出现过的用户和商品(这个思路是决赛第七名队伍的)。
特征问题:原始数据有例如以下字段。用户ID,商品ID,商品类别ID,时间(精确到小时),地理位置。行为(1234)
首先我们能够划分特征类别。比方分为用户—商品类特征,用户—商品类别类特征,商品—商品类别特征,商品类特征,用户类特征,商品类别类特征,交叉特征(各种特征进行有意义的交叉乘除)等几个方面。
另外一定要做特征选择,我採訪过一些top50选手,他们特征基本都在100-400之间。就我们队傻傻的搞了800,真是哭瞎在厕所。
特征划分粒度问题:能够划分为月,周,天,小时。当然小时取值24个多了点,能够进行切片,在做过初步数据统计之后会发现购买时间热段和冷段,来适当调整时间片长度。
模型融合问题:多模型融合效果会较单模型有提升。当然特征够好的情况下提升不太明显。融合方法通常是多次不同比例不同採样不同參数不同模型不同权值融合。
还有一个思路是做级联,也就是先用训练预測数据都超级快的LR,把正负样本比例调到1:1或者1:2之类的。为啥比例是这样呢,能够先自己思考下。由于在这里比例会将80%未购买的样本过滤掉(实际上90%都有可能)并且过滤掉的未购买样本实际上也确实是没购买的。
这样有助于提高后面GBDT等决策树模型的精度。还有个思路就是把其它模型得到的概率作为特征,这点比較重要。
补充点重要的东西:不要盲目迷信哪种算法吊什么的。没有最吊的算法。仅仅有更吊的思路。思路决定一切,这一切都反应在特征和一些细节上。我们队踩过的一些坑大概就是没用MR,也不会MR,没做预处理,没做特征选择。没设计时间切片的特征,倒是设计了1000+无用的特征,结果GBDT仅仅支持800,就随便扔了800个进去,结果可想而知。
我们队的成绩在第一赛季是10.09%分
第二赛季是7.7%分
非常遗憾没进前50,最后奉上3位决赛前10名大神的特征,感谢他们提供的特征方案。假设这三位大神看到了介意的话跟我说声。
特征版本号0(我们队的特征,没啥參考性。反面教材还是能够的):
用户近期1/2/3/5/7/15/30天有多少天交互随意品牌并除以1,,3,7,15,30得到交互率 |
用户近期1/2/3/5/7/15/30天有多少天购买随意品牌 并除以1,3,7,15,30得到购买率 |
用户近期1/2/3/5/7/15/30天购买随意品牌与点击/收藏/加购物车比 |
用户近期一次购买随意品牌的时间100一周前,010一周内,001三天内 |
用户近期1/2/3/5/7/15/30天购买/收藏/浏览/加购物车过的不同品牌/商品的个数 |
双12当天交互。购买,购买除以交互 |
双12当天交互/购买占30天交互购买多少 |
用户有多少次对同一个品牌/商品在不同天购买/反复购买 |
近期1,2,3,5,7,15,30天定位数 |
用户交互过多少不同品牌/商品。购买除以交互 |
成交量变化趋势,近期5天每天购买数,前面>=后面为1,否则为0。共4位,再加上4位的和 |
用户交互购买率 |
用户近期1/2/3/5/7/15/30天交互次数和购买率 |
用户近期第1/2/3/4/5/6/7/8天交互购买次数购买率 |
用户近期第1/2/3/4/5/6/7/8/9/10个2天交互购买次数 |
用户近期第1/2/3/4/5/6/7/8/9/10个3天交互购买次数购买率 |
用户近期第1/2/3/4个7天交互购买次数购买率 |
用户近期第1/2/3个10天交互购买次数购买率 |
用户近期第1/2个15天交互购买次数购买率 |
用户近期第1/2/3/4/5/6/7/8天有多少不同一时候间点,訪问间隔 |
品牌近期1/2/3/5/7/15/30天被多少不同用户交互/购买 和购买率 |
近期1,2,3,5,7,15,30天品牌总购买/收藏/购物车/浏览数,以及总购买数除以收藏数/购物车/点击 |
品牌总共同拥有多少人反复购买/在不同天反复购买/在不同周反复购买,对该品牌反复购买的人数除以一共购买的人数(按人算,不是按次算) |
品牌最后一次被随意用户购买的时间。100三天前,010三天内。001近期一天 |
成交量变化趋势,近期5天每天购买数,前面>=后面为1。否则为0,共4位,再加上4位的和 |
双12当天交互,购买,购买除以交互。双12当天交互/购买占30天交互购买多少 |
品牌下有多少商品 |
品牌近期1/2/3/5/7/15/30天交互次数和购买率 |
近期1/2/3/5/7/15/30天类别交互购买量除以类别下的商品数 |
类别近期第1/2/3/4/5/6/7/8/9/10个2天交互购买次数 |
类别近期第1/2/3/4/5/6/7/8/9/10个3天交互购买次数购买率 |
类别近期第1/2/3/4个7天交互购买次数购买率 |
类别近期第1/2/3个10天交互购买次数购买率 |
类别近期第1/2个15天交互购买次数购买率 |
用户最后一次交互当前品牌距离用户最后一次交互随意品牌相隔多少天 |
当前用户与当前品牌的最后一个交互天的前一天,当天和后一天这3天中一共点击/购买/收藏/加购物车了 多少次其它品牌 |
用户交互当前品牌的近期/第2近/第3近的交互天的PV数/ 加购物车数/购买数/收藏数以及时间(倒数第几天) |
用户交互当前品牌的最远一个交互天的PV数/购买数/收藏数/加购物车数以及时间 |
用户近期1/2/3/5/7/15/30天有多少天有交互/购买当前品牌 |
近期1,2,3,5,7,15,30天定位数 |
是否是用户喜欢的类别(提取用户交互量前10的类别) |
近期1,2,3,5,7,15,30天用户对当前品牌购买除以浏览/收藏/加购物车 |
用户近期1/2/3/4/5/7/15/30天有多少天对当前品牌存在纯交互日(这里的纯交互日是指仅仅浏览/收藏/加购物车了当前品牌/当前商品) |
近期几天次用户对此品牌购买情况,1000一周前购买,0100一周内购买,0010三天内购买。0001近期一天购买 |
用户对此品牌交互了多少个不同天 |
用户购买此品牌前交互的平均数 |
用户交互该品牌的总次数除以用户总交互次数 |
商品近期1/2/3/5/7/15/30天被多少不同用户交互/购买 和购买率 |
近期1,2,3,5,7,15,30天商品总购买/收藏/购物车/浏览数,以及总购买数除以收藏数/购物车/点击 |
商品总共同拥有多少人反复购买/在不同天反复购买/在不同周反复购买,对该品牌反复购买的人数除以一共购买的人数(按人算。不是按次算) |
商品最后一次被随意用户购买的时间1000一周前。0001近期一天 |
不同地理位置数 |
成交量变化趋势,近期5天每天购买数。前面>=后面为1,否则为0。共4位,再加上4位的和 |
双12当天交互,购买,购买除以交互,双12当天交互/购买占30天交互购买多少 |
商品近期1/2/3/5/7/15/30天交互次数和购买率 |
商品近期第1/2/3/4/5/6/7/8/9/10个2天交互购买次数 |
商品近期第1/2/3/4/5/6/7/8/9/10个3天交互购买次数购买率 |
商品近期第1/2/3/4个7天交互购买次数购买率 |
商品近期第1/2/3个10天交互购买次数购买率 |
商品近期第1/2个15天交互购买次数购买率 |
用户近期1/2/3/5/7/15/30天有多少天对当前商品存在纯交互日 |
用户近期1,2,3,5,7,15,30天对该商品交互次数 |
用户过去购买一个商品前的交互次数的最小值和均值相加的值减去此条记录次数*2的值取绝对值 |
增加购物车时间1000三天前,0100近期第三天,0001近期一天 |
购买时间 1000一周前,0100一周内,0010三天内,0001近期一天,0000未购买 |
浏览时间,10,01 |
近期1,2,3,5,7,15,30天定位数 |
商品最后一次被其它随意用户交互/购买的时间 。1000三天曾经,0100三天内,0010两天内,0001近期一天 |
哪天收藏,100一周前,010一周内,001三天内000未收藏 |
用户对此商品交互了多少个不同天 |
用户交互该商品的总次数除以用户总交互次数 |
用户交互该商品次数乘以用户转化率 |
此条记录交互次数占近期两天的交互次数比例 |
记录交互次数 |
近期1/2/3/5/7/15/30天占类别交互量和购买量多少 |
特征版本号1:
下面是阿里移动推荐算法用到的特征、如无特别说明。则每项特征都是以1、2、4、7、14、21、28作为周期分别计算。
且在计算时间特征时、都是以小时为单位。
一、用户-商品特征
1、用户对商品点击、收藏、加购物车、购买的近期时间。
2、用户对商品点击、收藏、加购物车、购买的次数
3、按时间分段,且同样粒度的时间段之间不重叠,分别统计用户对商品的点击、收藏、加购物车、购买的次数,分段粒度分别为6小时、12小时、1天、3天、7天、14天。因为该特征分数提升比較小,实际并没有计算全部分段。比方6小时为粒度的仅仅取了前两段
ps:不重叠分段的特征没有按周期分别计算,下同
二、用户-商品、用户-类别组合特征
1、用户对除去该商品的同类其它商品的点击、收藏、加购物车、购买次数。
2、按时间分段且同样粒度的时间段之间不重叠对特征1进行计算。类似用户-商品特征3
3、用户对该商品的近期点击、收藏、加购物车、购买时间减去同类其它商品的近期点击、收藏、加购物车、购买时间(点击-点击...)
4、用户对该商品的近期点击、收藏、加购物车、购买时间减去同类其它商品的近期购买时间
5、用户对商品的点击量减去用户对同类其他商品的平均点击量
三、用户特征(子集和全集分别计算该类特征。其它大类特征仅仅在商品子集计算)
1、用户近期点击、收藏、加购物车、购买时间
2、用户点击、收藏、加购物车、购买量
3、用户转化率即用户购买量分别除以用户点击、收藏、加购物车这三类行为数
4、用户点击、收藏、加购物车、购买量在28天里的均值方差(不按周期计算)
四、商品特征
1、商品被点击、收藏、加购物车、购买量
2、商品被购买转化率
3、商品被点击、收藏、加购物车、购买量在28天里的均值方差
五、类别特征
1、该类商品被点击、收藏、加购物车、购买量
2、该类商品转化率
六、交叉特征
1、用户对商品近期点击、收藏、加购物车、购买时间减去该用户近期点击、收藏、加购物车、购买时间
2、用户对商品近期点击、收藏、加购物车、购买时间减去该用户购买时间
3、用户对商品点击、收藏、加购物车、购买量减去用户平均点击、收藏、加购物车、购买量
4、用户对商品点击、收藏、加购物车、购买量减去商品平均被点击、收藏、加购物车、购买量
5、用户对商品点击、收藏、加购物车、购买量除以用户点击、收藏、加购物车、购买量
6、用户对商品点击、收藏、加购物车、购买量除以用户对该类其他商品点击、收藏、加购物车、购买量
7、用户对商品点击、收藏、加购物车、购买量除以该商品被点击、收藏、加购物车、购买量
8、商品被点击、收藏、加购物车、购买量除以该类商品被点击、收藏、加购物车、购买量
七、双十二处理
在计算商品特征和用户特征时删除双十二数据,在计算时间周期等时,双12后面的时间前移一天填补双十二的空缺。
但在计算交叉特征时。假设须要计算上述特征仍然保留双十二数据。
八、滑动窗体(效果微小)
曾经28天为历史数据计算特征,后一天的购买情况打标签,如用11月18号至12月15号数据计算特征,以12月16号购买情况打标签。
然后窗体依次滑动一天,如此一共得到4个数据集,用前三个数据集作为训练集。最后一个数据集作为測试集。
九、前期样本过滤及抽样
仅仅保留前两天有操作的的样本、然后正样本过採样到4倍。负样本随机抽样,抽样后正负样本比约为1:8
特征版本号2:
Field | Type | Label | Comment |
+------------------------------------------------------------------------------------+
| uif_whichday | string | | |
| uif_user_id | string | | |
| uif_item_id | string | | |
| uif_category_id | string | | |
| label | bigint | | |
| uif_gapday | bigint | | |
| uif_sim | double | | |
| uif_incircle | bigint | | |
| uif_click_1 | bigint | | |
| uif_collect_1 | bigint | | |
| uif_cart_1 | bigint | | |
| uif_buy_1 | bigint | | |
| uif_visit_times_1 | bigint | | |
| uif_click_2 | bigint | | |
| uif_collect_2 | bigint | | |
| uif_cart_2 | bigint | | |
| uif_buy_2 | bigint | | |
| uif_lastdaymaxclickhour | bigint | | |
| uif_lastdaymaxcollecthour | bigint | | |
| uif_lastdaymaxcarthour | bigint | | |
| uif_lastdaymaxbuyhour | bigint | | |
| uif_lastdaystartbehavhour | bigint | | |
| uif_lastdayendbehavhour | bigint | | |
| uif_lastdaybehavhours | bigint | | |
| uif_lastdayclicks_division_bhours | double | | |
| uif_click_7 | bigint | | |
| uif_collect_7 | bigint | | |
| uif_cart_7 | bigint | | |
| uif_buy_7 | bigint | | |
| uif_active_days_7 | bigint | | |
| uif_buy_days_7 | bigint | | |
| uif_visit_times_7 | bigint | | |
| uif_buydays_division_activedays_7 | double | | |
| uif_click_5 | bigint | | |
| uif_collect_5 | bigint | | |
| uif_cart_5 | bigint | | |
| uif_buy_5 | bigint | | |
| uif_active_days_5 | bigint | | |
| uif_buy_days_5 | bigint | | |
| uif_visit_times_5 | bigint | | |
| uif_buydays_division_activedays_5 | double | | |
| uif_click_10 | bigint | | |
| uif_collect_10 | bigint | | |
| uif_cart_10 | bigint | | |
| uif_buy_10 | bigint | | |
| uif_active_days_10 | bigint | | |
| uif_buy_days_10 | bigint | | |
| uif_visit_times_10 | bigint | | |
| uif_buydays_division_activedays_10 | double | | |
| uif_click_3 | bigint | | |
| uif_collect_3 | bigint | | |
| uif_cart_3 | bigint | | |
| uif_buy_3 | bigint | | |
| uif_active_days_3 | bigint | | |
| uif_buy_days_3 | bigint | | |
| uif_visit_times_3 | bigint | | |
| uif_buydays_division_activedays_3 | double | | |
| uif_click_31 | bigint | | |
| uif_collect_31 | bigint | | |
| uif_cart_31 | bigint | | |
| uif_buy_31 | bigint | | |
| uif_active_days_31 | bigint | | |
| uif_buy_days_31 | bigint | | |
| uif_visit_times_31 | bigint | | |
| uif_buydays_division_activedays_31 | double | | |
| uf_whichday | string | | |
| uf_user_id | string | | |
| uf_click_1 | bigint | | |
| uf_collect_1 | bigint | | |
| uf_cart_1 | bigint | | |
| uf_buy_1 | bigint | | |
| uf_buyitems_1 | bigint | | |
| uf_buycates_1 | bigint | | |
| uf_clickitems_1 | bigint | | |
| uf_clickcates_1 | bigint | | |
| uf_cartitems_1 | bigint | | |
| uf_cartcates_1 | bigint | | |
| uf_collectitems_1 | bigint | | |
| uf_collectcates_1 | bigint | | |
| uf_buycates_division_clickcates_1 | double | | |
| uf_buyitems_division_clickitems_1 | double | | |
| uf_lastdayvisit_buy | bigint | | |
| uf_lastdayvisit_buy_rate_buys | double | | |
| uf_lastdayvisit_buy_rate_items | double | | |
| uf_lastdaycart_buy | bigint | | |
| uf_lastdaycart_buy_rate_buys | double | | |
| uf_lastdaycart_buy_rate_carts | double | | |
| uf_lastdaycart_buy_rate_items | double | | |
| uf_buy_lastday_avg_clicks | double | | |
| uf_buy_lastday_avg_collects | double | | |
| uf_buy_lastday_avg_carts | double | | |
| uf_buy_lastday_avg_buys | double | | |
| uf_buy_lastday_avg_clickitems | double | | |
| uf_buy_lastday_avg_collectitems | double | | |
| uf_buy_lastday_avg_cartitems | double | | |
| uf_buy_lastday_avg_buyitems | double | | |
| uf_buy_lastday_avg_clickcates | double | | |
| uf_buy_lastday_avg_collectcates | double | | |
| uf_buy_lastday_avg_cartcates | double | | |
| uf_buy_lastday_avg_buycates | double | | |
| uf_lastdaymaxclickhour | bigint | | |
| uf_lastdaymaxcollecthour | bigint | | |
| uf_lastdaymaxcarthour | bigint | | |
| uf_lastdaymaxbuyhour | bigint | | |
| uf_gapday | bigint | | |
| uf_avg_buygap | double | | |
| uf_lastdaystartbehavhour | bigint | | |
| uf_lastdayendbehavhour | bigint | | |
| uf_lastdaybehavhours | bigint | | |
| uf_click_7 | bigint | | |
| uf_collect_7 | bigint | | |
| uf_cart_7 | bigint | | |
| uf_buy_7 | bigint | | |
| uf_buyitems_7 | bigint | | |
| uf_buycates_7 | bigint | | |
| uf_clickitems_7 | bigint | | |
| uf_clickcates_7 | bigint | | |
| uf_cartitems_7 | bigint | | |
| uf_cartcates_7 | bigint | | |
| uf_collectitems_7 | bigint | | |
| uf_collectcates_7 | bigint | | |
| uf_active_days_7 | bigint | | |
| uf_buy_days_7 | bigint | | |
| uf_buycates_division_clickcates_7 | double | | |
| uf_buyitems_division_clickitems_7 | double | | |
| uf_buy_division_click_7 | double | | |
| uf_buy_division_cart_7 | double | | |
| uf_buy_division_collect_7 | double | | |
| uf_buydays_division_activedays_7 | double | | |
| uf_buys_division_buydays_7 | double | | |
| uf_buys_division_buyitems_7 | double | | |
| uf_buys_division_buycates_7 | double | | |
| uf_buyitems_division_buydays_7 | double | | |
| uf_buycates_division_buydays_7 | double | | |
| uf_click_5 | bigint | | |
| uf_collect_5 | bigint | | |
| uf_cart_5 | bigint | | |
| uf_buy_5 | bigint | | |
| uf_buyitems_5 | bigint | | |
| uf_buycates_5 | bigint | | |
| uf_clickitems_5 | bigint | | |
| uf_clickcates_5 | bigint | | |
| uf_cartitems_5 | bigint | | |
| uf_cartcates_5 | bigint | | |
| uf_collectitems_5 | bigint | | |
| uf_collectcates_5 | bigint | | |
| uf_active_days_5 | bigint | | |
| uf_buy_days_5 | bigint | | |
| uf_buycates_division_clickcates_5 | double | | |
| uf_buyitems_division_clickitems_5 | double | | |
| uf_buy_division_click_5 | double | | |
| uf_buy_division_cart_5 | double | | |
| uf_buy_division_collect_5 | double | | |
| uf_buydays_division_activedays_5 | double | | |
| uf_buys_division_buydays_5 | double | | |
| uf_buys_division_buyitems_5 | double | | |
| uf_buys_division_buycates_5 | double | | |
| uf_buyitems_division_buydays_5 | double | | |
| uf_buycates_division_buydays_5 | double | | |
| uf_click_10 | bigint | | |
| uf_collect_10 | bigint | | |
| uf_cart_10 | bigint | | |
| uf_buy_10 | bigint | | |
| uf_buyitems_10 | bigint | | |
| uf_buycates_10 | bigint | | |
| uf_clickitems_10 | bigint | | |
| uf_clickcates_10 | bigint | | |
| uf_cartitems_10 | bigint | | |
| uf_cartcates_10 | bigint | | |
| uf_collectitems_10 | bigint | | |
| uf_collectcates_10 | bigint | | |
| uf_active_days_10 | bigint | | |
| uf_buy_days_10 | bigint | | |
| uf_buycates_division_clickcates_10 | double | | |
| uf_buyitems_division_clickitems_10 | double | | |
| uf_buy_division_click_10 | double | | |
| uf_buy_division_cart_10 | double | | |
| uf_buy_division_collect_10 | double | | |
| uf_buydays_division_activedays_10 | double | | |
| uf_buys_division_buydays_10 | double | | |
| uf_buys_division_buyitems_10 | double | | |
| uf_buys_division_buycates_10 | double | | |
| uf_buyitems_division_buydays_10 | double | | |
| uf_buycates_division_buydays_10 | double | | |
| uf_click_3 | bigint | | |
| uf_collect_3 | bigint | | |
| uf_cart_3 | bigint | | |
| uf_buy_3 | bigint | | |
| uf_buyitems_3 | bigint | | |
| uf_buycates_3 | bigint | | |
| uf_active_days_3 | bigint | | |
| uf_buy_days_3 | bigint | | |
| uf_clickitems_3 | bigint | | |
| uf_clickcates_3 | bigint | | |
| uf_cartitems_3 | bigint | | |
| uf_cartcates_3 | bigint | | |
| uf_collectitems_3 | bigint | | |
| uf_collectcates_3 | bigint | | |
| uf_buycates_division_clickcates_3 | double | | |
| uf_buyitems_division_clickitems_3 | double | | |
| uf_buy_division_click_3 | double | | |
| uf_buy_division_cart_3 | double | | |
| uf_buy_division_collect_3 | double | | |
| uf_buydays_division_activedays_3 | double | | |
| uf_buys_division_buydays_3 | double | | |
| uf_buys_division_buyitems_3 | double | | |
| uf_buys_division_buycates_3 | double | | |
| uf_buyitems_division_buydays_3 | double | | |
| uf_buycates_division_buydays_3 | double | | |
| uf_click_31 | bigint | | |
| uf_collect_31 | bigint | | |
| uf_cart_31 | bigint | | |
| uf_buy_31 | bigint | | |
| uf_buyitems_31 | bigint | | |
| uf_buycates_31 | bigint | | |
| uf_active_days_31 | bigint | | |
| uf_buy_days_31 | bigint | | |
| uf_clickitems_31 | bigint | | |
| uf_clickcates_31 | bigint | | |
| uf_cartitems_31 | bigint | | |
| uf_cartcates_31 | bigint | | |
| uf_collectitems_31 | bigint | | |
| uf_collectcates_31 | bigint | | |
| uf_buycates_division_clickcates_31 | double | | |
| uf_buyitems_division_clickitems_31 | double | | |
| uf_buy_division_click_31 | double | | |
| uf_buy_division_cart_31 | double | | |
| uf_buy_division_collect_31 | double | | |
| uf_buydays_division_activedays_31 | double | | |
| uf_buys_division_buydays_31 | double | | |
| uf_buys_division_buyitems_31 | double | | |
| uf_buys_division_buycates_31 | double | | |
| uf_buyitems_division_buydays_31 | double | | |
| uf_buycates_division_buydays_31 | double | | |
| if_whichday | string | | |
| if_item_id | string | | |
| if_buytwice | bigint | | |
| if_buythird | bigint | | |
| if_click_1 | bigint | | |
| if_collect_1 | bigint | | |
| if_cart_1 | bigint | | |
| if_buy_1 | bigint | | |
| if_buyusers_1 | bigint | | |
| if_clickusers_1 | bigint | | |
| if_cartusers_1 | bigint | | |
| if_collectusers_1 | bigint | | |
| if_cartusers_division_buyusers_1 | double | | |
| if_collectusers_division_buyusers_1 | double | | |
| if_buyusers_division_clickusers_1 | double | | |
| if_avg_click_per_user_1 | double | | |
| if_hot_1 | double | | |
| if_lastdaymaxclickhour | bigint | | |
| if_lastdaymaxcollecthour | bigint | | |
| if_lastdaymaxcarthour | bigint | | |
| if_lastdaymaxbuyhour | bigint | | |
| if_click_7 | bigint | | |
| if_collect_7 | bigint | | |
| if_cart_7 | bigint | | |
| if_buy_7 | bigint | | |
| if_buyusers_7 | bigint | | |
| if_clickusers_7 | bigint | | |
| if_buyusers_division_clickusers_7 | double | | |
| if_hot_7 | double | | |
| if_active_days_7 | bigint | | |
| if_buy_days_7 | bigint | | |
| if_cartusers_7 | bigint | | |
| if_collectusers_7 | bigint | | |
| if_cartusers_division_buyusers_7 | double | | |
| if_collectusers_division_buyusers_7 | double | | |
| if_avg_click_per_user_7 | double | | |
| if_buy_division_click_7 | double | | |
| if_buy_division_cart_7 | double | | |
| if_buy_division_collect_7 | double | | |
| if_buydays_division_activedays_7 | double | | |
| if_buys_division_buydays_7 | double | | |
| if_buys_division_buyusers_7 | double | | |
| if_buyusers_division_buydays_7 | double | | |
| if_click_5 | bigint | | |
| if_collect_5 | bigint | | |
| if_cart_5 | bigint | | |
| if_buy_5 | bigint | | |
| if_buyusers_5 | bigint | | |
| if_clickusers_5 | bigint | | |
| if_buyusers_division_clickusers_5 | double | | |
| if_hot_5 | double | | |
| if_active_days_5 | bigint | | |
| if_buy_days_5 | bigint | | |
| if_cartusers_5 | bigint | | |
| if_collectusers_5 | bigint | | |
| if_cartusers_division_buyusers_5 | double | | |
| if_collectusers_division_buyusers_5 | double | | |
| if_avg_click_per_user_5 | double | | |
| if_buy_division_click_5 | double | | |
| if_buy_division_cart_5 | double | | |
| if_buy_division_collect_5 | double | | |
| if_buydays_division_activedays_5 | double | | |
| if_buys_division_buydays_5 | double | | |
| if_buys_division_buyusers_5 | double | | |
| if_buyusers_division_buydays_5 | double | | |
| if_click_10 | bigint | | |
| if_collect_10 | bigint | | |
| if_cart_10 | bigint | | |
| if_buy_10 | bigint | | |
| if_buyusers_10 | bigint | | |
| if_clickusers_10 | bigint | | |
| if_buyusers_division_clickusers_10 | double | | |
| if_hot_10 | double | | |
| if_active_days_10 | bigint | | |
| if_buy_days_10 | bigint | | |
| if_cartusers_10 | bigint | | |
| if_collectusers_10 | bigint | | |
| if_cartusers_division_buyusers_10 | double | | |
| if_collectusers_division_buyusers_10 | double | | |
| if_avg_click_per_user_10 | double | | |
| if_buy_division_click_10 | double | | |
| if_buy_division_cart_10 | double | | |
| if_buy_division_collect_10 | double | | |
| if_buydays_division_activedays_10 | double | | |
| if_buys_division_buydays_10 | double | | |
| if_buys_division_buyusers_10 | double | | |
| if_buyusers_division_buydays_10 | double | | |
| if_click_3 | bigint | | |
| if_collect_3 | bigint | | |
| if_cart_3 | bigint | | |
| if_buy_3 | bigint | | |
| if_buyusers_3 | bigint | | |
| if_clickusers_3 | bigint | | |
| if_buyusers_division_clickusers_3 | double | | |
| if_active_days_3 | bigint | | |
| if_buy_days_3 | bigint | | |
| if_hot_3 | double | | |
| if_cartusers_3 | bigint | | |
| if_collectusers_3 | bigint | | |
| if_cartusers_division_buyusers_3 | double | | |
| if_collectusers_division_buyusers_3 | double | | |
| if_buy_division_click_3 | double | | |
| if_buy_division_cart_3 | double | | |
| if_buy_division_collect_3 | double | | |
| if_buydays_division_activedays_3 | double | | |
| if_buys_division_buydays_3 | double | | |
| if_buys_division_buyusers_3 | double | | |
| if_buyusers_division_buydays_3 | double | | |
| if_avg_click_per_user_3 | double | | |
| if_click_31 | bigint | | |
| if_collect_31 | bigint | | |
| if_cart_31 | bigint | | |
| if_buy_31 | bigint | | |
| if_buyusers_31 | bigint | | |
| if_clickusers_31 | bigint | | |
| if_buyusers_division_clickusers_31 | double | | |
| if_active_days_31 | bigint | | |
| if_buy_days_31 | bigint | | |
| if_hot_31 | double | | |
| if_cartusers_31 | bigint | | |
| if_collectusers_31 | bigint | | |
| if_cartusers_division_buyusers_31 | double | | |
| if_collectusers_division_buyusers_31 | double | | |
| if_avg_click_per_user_31 | double | | |
| if_buy_division_click_31 | double | | |
| if_buy_division_cart_31 | double | | |
| if_buy_division_collect_31 | double | | |
| if_buydays_division_activedays_31 | double | | |
| if_buys_division_buydays_31 | double | | |
| if_buys_division_buyusers_31 | double | | |
| if_buyusers_division_buydays_31 | double | | |
| cf_whichday | string | | |
| cf_category_id | string | | |
| cf_click_1 | bigint | | |
| cf_collect_1 | bigint | | |
| cf_cart_1 | bigint | | |
| cf_buy_1 | bigint | | |
| cf_hot_1 | double | | |
| cf_buyusers_1 | bigint | | |
| cf_clickusers_1 | bigint | | |
| cf_cartusers_1 | bigint | | |
| cf_collectusers_1 | bigint | | |
| cf_cartusers_division_buyusers_1 | double | | |
| cf_collectusers_division_buyusers_1 | double | | |
| cf_buyusers_division_clickusers_1 | double | | |
| cf_click_7 | bigint | | |
| cf_collect_7 | bigint | | |
| cf_cart_7 | bigint | | |
| cf_buy_7 | bigint | | |
| cf_hot_7 | double | | |
| cf_buyusers_7 | bigint | | |
| cf_clickusers_7 | bigint | | |
| cf_cartusers_7 | bigint | | |
| cf_collectusers_7 | bigint | | |
| cf_cartusers_division_buyusers_7 | double | | |
| cf_collectusers_division_buyusers_7 | double | | |
| cf_buyusers_division_clickusers_7 | double | | |
| cf_buys_division_buyusers_7 | double | | |
| cf_buyusers_division_buydays_7 | double | | |
| cf_active_days_7 | bigint | | |
| cf_buy_days_7 | bigint | | |
| cf_buy_division_click_7 | double | | |
| cf_buy_division_cart_7 | double | | |
| cf_buy_division_collect_7 | double | | |
| cf_buydays_division_activedays_7 | double | | |
| cf_buys_division_buydays_7 | double | | |
| cf_click_5 | bigint | | |
| cf_collect_5 | bigint | | |
| cf_cart_5 | bigint | | |
| cf_buy_5 | bigint | | |
| cf_hot_5 | double | | |
| cf_buyusers_5 | bigint | | |
| cf_clickusers_5 | bigint | | |
| cf_cartusers_5 | bigint | | |
| cf_collectusers_5 | bigint | | |
| cf_cartusers_division_buyusers_5 | double | | |
| cf_collectusers_division_buyusers_5 | double | | |
| cf_buyusers_division_clickusers_5 | double | | |
| cf_buys_division_buyusers_5 | double | | |
| cf_buyusers_division_buydays_5 | double | | |
| cf_active_days_5 | bigint | | |
| cf_buy_days_5 | bigint | | |
| cf_buy_division_click_5 | double | | |
| cf_buy_division_cart_5 | double | | |
| cf_buy_division_collect_5 | double | | |
| cf_buydays_division_activedays_5 | double | | |
| cf_buys_division_buydays_5 | double | | |
| cf_click_10 | bigint | | |
| cf_collect_10 | bigint | | |
| cf_cart_10 | bigint | | |
| cf_buy_10 | bigint | | |
| cf_hot_10 | double | | |
| cf_buyusers_10 | bigint | | |
| cf_clickusers_10 | bigint | | |
| cf_cartusers_10 | bigint | | |
| cf_collectusers_10 | bigint | | |
| cf_cartusers_division_buyusers_10 | double | | |
| cf_collectusers_division_buyusers_10 | double | | |
| cf_buyusers_division_clickusers_10 | double | | |
| cf_buys_division_buyusers_10 | double | | |
| cf_buyusers_division_buydays_10 | double | | |
| cf_active_days_10 | bigint | | |
| cf_buy_days_10 | bigint | | |
| cf_buy_division_click_10 | double | | |
| cf_buy_division_cart_10 | double | | |
| cf_buy_division_collect_10 | double | | |
| cf_buydays_division_activedays_10 | double | | |
| cf_buys_division_buydays_10 | double | | |
| cf_click_3 | bigint | | |
| cf_collect_3 | bigint | | |
| cf_cart_3 | bigint | | |
| cf_buy_3 | bigint | | |
| cf_active_days_3 | bigint | | |
| cf_buy_days_3 | bigint | | |
| cf_hot_3 | double | | |
| cf_buyusers_3 | bigint | | |
| cf_clickusers_3 | bigint | | |
| cf_cartusers_3 | bigint | | |
| cf_collectusers_3 | bigint | | |
| cf_cartusers_division_buyusers_3 | double | | |
| cf_collectusers_division_buyusers_3 | double | | |
| cf_buyusers_division_clickusers_3 | double | | |
| cf_buys_division_buyusers_3 | double | | |
| cf_buyusers_division_buydays_3 | double | | |
| cf_buy_division_click_3 | double | | |
| cf_buy_division_cart_3 | double | | |
| cf_buy_division_collect_3 | double | | |
| cf_buydays_division_activedays_3 | double | | |
| cf_buys_division_buydays_3 | double | | |
| cf_click_31 | bigint | | |
| cf_collect_31 | bigint | | |
| cf_cart_31 | bigint | | |
| cf_buy_31 | bigint | | |
| cf_active_days_31 | bigint | | |
| cf_buy_days_31 | bigint | | |
| cf_hot_31 | double | | |
| cf_buyusers_31 | bigint | | |
| cf_clickusers_31 | bigint | | |
| cf_cartusers_31 | bigint | | |
| cf_collectusers_31 | bigint | | |
| cf_cartusers_division_buyusers_31 | double | | |
| cf_collectusers_division_buyusers_31 | double | | |
| cf_buyusers_division_clickusers_31 | double | | |
| cf_buys_division_buyusers_31 | double | | |
| cf_buyusers_division_buydays_31 | double | | |
| cf_buy_division_click_31 | double | | |
| cf_buy_division_cart_31 | double | | |
| cf_buy_division_collect_31 | double | | |
| cf_buydays_division_activedays_31 | double | | |
| cf_buys_division_buydays_31 | double | | |
| ucf_whichday | string | | |
| ucf_user_id | string | | |
| ucf_category_id | string | | |
| ucf_click_1 | bigint | | |
| ucf_collect_1 | bigint | | |
| ucf_cart_1 | bigint | | |
| ucf_buy_1 | bigint | | |
| ucf_clickitems_in_category_1 | bigint | | |
| ucf_cartitems_in_category_1 | bigint | | |
| ucf_collectitems_in_category_1 | bigint | | |
| ucf_buyitems_in_category_1 | bigint | | |
| ucf_lastdaymaxclickhour | bigint | | |
| ucf_lastdaymaxcollecthour | bigint | | |
| ucf_lastdaymaxcarthour | bigint | | |
| ucf_lastdaymaxbuyhour | bigint | | |
| ucf_lastdaystartbehavhour | bigint | | |
| ucf_lastdayendbehavhour | bigint | | |
| ucf_lastdaybehavhours | bigint | | |
| ucf_lastdayclicks_division_bhours | double | | |
| ucf_click_7 | bigint | | |
| ucf_collect_7 | bigint | | |
| ucf_cart_7 | bigint | | |
| ucf_buy_7 | bigint | | |
| ucf_active_days_7 | bigint | | |
| ucf_buy_days_7 | bigint | | |
| ucf_clickitems_in_category_7 | bigint | | |
| ucf_cartitems_in_category_7 | bigint | | |
| ucf_collectitems_in_category_7 | bigint | | |
| ucf_buyitems_in_category_7 | bigint | | |
| ucf_buydays_division_activedays_7 | double | | |
| ucf_click_5 | bigint | | |
| ucf_collect_5 | bigint | | |
| ucf_cart_5 | bigint | | |
| ucf_buy_5 | bigint | | |
| ucf_active_days_5 | bigint | | |
| ucf_buy_days_5 | bigint | | |
| ucf_clickitems_in_category_5 | bigint | | |
| ucf_cartitems_in_category_5 | bigint | | |
| ucf_collectitems_in_category_5 | bigint | | |
| ucf_buyitems_in_category_5 | bigint | | |
| ucf_buydays_division_activedays_5 | double | | |
| ucf_click_10 | bigint | | |
| ucf_collect_10 | bigint | | |
| ucf_cart_10 | bigint | | |
| ucf_buy_10 | bigint | | |
| ucf_active_days_10 | bigint | | |
| ucf_buy_days_10 | bigint | | |
| ucf_clickitems_in_category_10 | bigint | | |
| ucf_cartitems_in_category_10 | bigint | | |
| ucf_collectitems_in_category_10 | bigint | | |
| ucf_buyitems_in_category_10 | bigint | | |
| ucf_buydays_division_activedays_10 | double | | |
| ucf_click_3 | bigint | | |
| ucf_collect_3 | bigint | | |
| ucf_cart_3 | bigint | | |
| ucf_buy_3 | bigint | | |
| ucf_active_days_3 | bigint | | |
| ucf_buy_days_3 | bigint | | |
| ucf_clickitems_in_category_3 | bigint | | |
| ucf_cartitems_in_category_3 | bigint | | |
| ucf_collectitems_in_category_3 | bigint | | |
| ucf_buyitems_in_category_3 | bigint | | |
| ucf_buydays_division_activedays_3 | double | | |
| ucf_click_31 | bigint | | |
| ucf_collect_31 | bigint | | |
| ucf_cart_31 | bigint | | |
| ucf_buy_31 | bigint | | |
| ucf_active_days_31 | bigint | | |
| ucf_buy_days_31 | bigint | | |
| ucf_clickitems_in_category_31 | bigint | | |
| ucf_cartitems_in_category_31 | bigint | | |
| ucf_collectitems_in_category_31 | bigint | | |
| ucf_buydays_division_activedays_31 | double | | |
| ucf_buyitems_in_category_31 | bigint | | |
| cross_feature1 | double | | |
| cross_feature17 | double | | |
| cross_feature16 | double | | |
| cross_feature2 | double | | |
| cross_feature3 | double | | |
| cross_feature6 | double | | |
| cross_feature19 | double | | |
| cross_feature11 | double | | |
| cross_feature20 | double | | |
| cross_feature21 | double | | |
| cross_feature22 | double | | |
| cross_feature23 | double | | |
| cross_feature10 | double | | |
| cross_feature12 | double | | |
| cross_feature13 | double | | |
| cross_feature14 | double | | |
| cross_feature15 | double | | |
| cross_feature24 | double | | |
| cross_feature25 | double | | |
| cross_feature26 | double | | |
| cross_feature27 | double | | |
| cross_feature28 | double | | |
| cross_feature33 | double | | |
| cross_feature34 | double | | |
| cross_feature35 | double | | |
| cross_feature36 | double | | |
| cross_feature37 | double | | |
| cross_feature38 | double | | |
| cross_feature39 | double | | |
| cross_feature40 | double | | |
| cross_feature41 | double | | |
| cross_feature42 | double | | |
| cross_feature43 | double | | |
| cross_feature44 | double | | |
| cross_feature45 | double | | |
| cross_feature46 | double | | |
| cross_feature47 | bigint | | |
| cross_feature48 | double | | |
| cross_feature49 | double | | |
| cross_feature50 | double | | |
| cross_feature51 | double | | |
| cross_feature52 | double | | |
| cross_feature53 | double | | |
| cross_feature54 | double | | |
| cross_feature55 | double | | |
| cross_feature56 | double | | |
| cross_feature57 | double | | |
| cross_feature58 | double | | |
| cross_feature59 | double | | |
| cross_feature60 | double | | |
| cross_feature61 | double | | |
| cross_feature62 | double | | |
| cross_feature63 | double | | |
| cross_feature64 | double | | |
| cross_feature65 | double | | |
| cross_feature66 | double | | |
| cross_feature67 | double | | |
| cross_feature68 | double | | |
| cross_feature29 | double | | |
| cross_feature30 | double | | |
| cross_feature31 | double | | |
| cross_feature32 | double | | |
| cross_feature4 | bigint | | |
| cross_feature5 | bigint | | |
| cross_feature7 | bigint | | |
| cross_feature8 | bigint | | |
| cross_feature9 | bigint | | |
| cross_feature18 | bigint | | |
+------------------------------------------------------------------------------------+
特征版本号3:
DROP TABLE IF EXISTS t_dh_online_train_all_features;
CREATE TABLE t_dh_online_train_all_features as
SELECT *,
-- 这一层专门计算购买的可能性
ui_last1day_click_cnt*user_last3day_mean_prior_click_next_buy_cnt as ui_last3day_user_click_prob_buy_rate,
ui_last1day_bookmark_cnt*user_last3day_mean_prior_bookmark_next_buy_cnt as ui_last3day_user_bookmark_prob_buy_rate,
ui_last1day_addcart_cnt*user_last3day_mean_prior_addcart_next_buy_cnt as ui_last3day_user_addcart_prob_buy_rate,
ui_last1day_buy_cnt*user_last3day_mean_prior_buy_next_buy_cnt as ui_last3day_user_buy_prob_buy_rate,
ui_last1day_click_cnt*user_last7day_mean_prior_click_next_buy_cnt as ui_last7day_user_click_prob_buy_rate,
ui_last1day_bookmark_cnt*user_last7day_mean_prior_bookmark_next_buy_cnt as ui_last7day_user_bookmark_prob_buy_rate,
ui_last1day_addcart_cnt*user_last7day_mean_prior_addcart_next_buy_cnt as ui_last7day_user_addcart_prob_buy_rate,
ui_last1day_buy_cnt*user_last7day_mean_prior_buy_next_buy_cnt as ui_last7day_user_buy_prob_buy_rate,
ui_last1day_click_cnt*item_last3day_mean_prior_click_next_buy_cnt as ui_last3day_item_click_prob_buy_rate,
ui_last1day_bookmark_cnt*item_last3day_mean_prior_bookmark_next_buy_cnt as ui_last3day_item_bookmark_prob_buy_rate,
ui_last1day_addcart_cnt*item_last3day_mean_prior_addcart_next_buy_cnt as ui_last3day_item_addcart_prob_buy_rate,
ui_last1day_buy_cnt*item_last3day_mean_prior_buy_next_buy_cnt as ui_last3day_item_buy_prob_buy_rate,
ui_last1day_click_cnt*item_last7day_mean_prior_click_next_buy_cnt as ui_last7day_item_click_prob_buy_rate,
ui_last1day_bookmark_cnt*item_last7day_mean_prior_bookmark_next_buy_cnt as ui_last7day_item_bookmark_prob_buy_rate,
ui_last1day_addcart_cnt*item_last7day_mean_prior_addcart_next_buy_cnt as ui_last7day_item_addcart_prob_buy_rate,
ui_last1day_buy_cnt*item_last7day_mean_prior_buy_next_buy_cnt as ui_last7day_item_buy_prob_buy_rate,
ui_last1day_click_cnt*category_last3day_mean_prior_click_next_buy_cnt as ui_last3day_category_click_prob_buy_rate,
ui_last1day_bookmark_cnt*category_last3day_mean_prior_bookmark_next_buy_cnt as ui_last3day_category_bookmark_prob_buy_rate,
ui_last1day_addcart_cnt*category_last3day_mean_prior_addcart_next_buy_cnt as ui_last3day_category_addcart_prob_buy_rate,
ui_last1day_buy_cnt*category_last3day_mean_prior_buy_next_buy_cnt as ui_last3day_category_buy_prob_buy_rate,
ui_last1day_click_cnt*category_last7day_mean_prior_click_next_buy_cnt as ui_last7day_category_click_prob_buy_rate,
ui_last1day_bookmark_cnt*category_last7day_mean_prior_bookmark_next_buy_cnt as ui_last7day_category_bookmark_prob_buy_rate,
ui_last1day_addcart_cnt*category_last7day_mean_prior_addcart_next_buy_cnt as ui_last7day_category_addcart_prob_buy_rate,
ui_last1day_buy_cnt*category_last7day_mean_prior_buy_next_buy_cnt as ui_last7day_category_buy_prob_buy_rate,
ui_last1day_click_cnt*user_last3day_mean_prior_click_next_buy_cnt*item_last3day_mean_prior_click_next_buy_cnt as ui_last3day_complex_click_prob_buy_rate,
ui_last1day_bookmark_cnt*user_last3day_mean_prior_bookmark_next_buy_cnt*item_last3day_mean_prior_bookmark_next_buy_cnt as ui_last3day_complex_bookmark_prob_buy_rate,
ui_last1day_addcart_cnt*user_last3day_mean_prior_addcart_next_buy_cnt*item_last3day_mean_prior_addcart_next_buy_cnt as ui_last3day_complex_addcart_prob_buy_rate,
ui_last1day_buy_cnt*user_last3day_mean_prior_buy_next_buy_cnt*item_last3day_mean_prior_buy_next_buy_cnt as ui_last3day_complex_buy_prob_buy_rate,
ui_last1day_click_cnt*user_last7day_mean_prior_click_next_buy_cnt*item_last7day_mean_prior_click_next_buy_cnt as ui_last7day_complex_click_prob_buy_rate,
ui_last1day_bookmark_cnt*user_last7day_mean_prior_bookmark_next_buy_cnt*item_last7day_mean_prior_bookmark_next_buy_cnt as ui_last7day_complex_bookmark_prob_buy_rate,
ui_last1day_addcart_cnt*user_last7day_mean_prior_addcart_next_buy_cnt*item_last7day_mean_prior_addcart_next_buy_cnt as ui_last7day_complex_addcart_prob_buy_rate,
ui_last1day_buy_cnt*user_last7day_mean_prior_buy_next_buy_cnt*item_last7day_mean_prior_buy_next_buy_cnt as ui_last7day_complex_buy_prob_buy_rate,
-- 依据用户前一天的交互来推导用户购买的可能性
(ui_last1day_click_cnt*user_last3day_mean_prior_click_next_buy_cnt*item_last3day_mean_prior_click_next_buy_cnt
+ui_last1day_bookmark_cnt*user_last3day_mean_prior_bookmark_next_buy_cnt*item_last3day_mean_prior_bookmark_next_buy_cnt
+ui_last1day_addcart_cnt*user_last3day_mean_prior_addcart_next_buy_cnt*item_last3day_mean_prior_addcart_next_buy_cnt
+ui_last1day_buy_cnt*user_last3day_mean_prior_buy_next_buy_cnt*item_last3day_mean_prior_buy_next_buy_cnt)*pow(13,-1*ui_last1day_buy_cnt) as ui_last3day_prob_next_day_buy_rate,
(ui_last1day_click_cnt*user_last7day_mean_prior_click_next_buy_cnt*item_last7day_mean_prior_click_next_buy_cnt
+ui_last1day_bookmark_cnt*user_last7day_mean_prior_bookmark_next_buy_cnt*item_last7day_mean_prior_bookmark_next_buy_cnt
+ui_last1day_addcart_cnt*user_last7day_mean_prior_addcart_next_buy_cnt*item_last7day_mean_prior_addcart_next_buy_cnt
+ui_last1day_buy_cnt*user_last7day_mean_prior_buy_next_buy_cnt*item_last7day_mean_prior_buy_next_buy_cnt)*pow(13,-1*ui_last1day_buy_cnt) as ui_last7day_prob_next_day_buy_rate
FROM
(
SELECT *,
-------------------------------------------------------------- 转化率 -------------------------------------------------------------------------------------
-- 商品购买的用户数转换率
case when item_last3day_behavior_user_cnt = 0 then 0 else item_last3day_buy_user_cnt/item_last3day_behavior_user_cnt end as item_last3day_user_click2buy_rate,
case when item_last7day_behavior_user_cnt = 0 then 0 else item_last7day_buy_user_cnt/item_last7day_behavior_user_cnt end as item_last7day_user_click2buy_rate,
case when item_last28day_behavior_user_cnt = 0 then 0 else item_last28day_buy_user_cnt/item_last28day_behavior_user_cnt end as item_last28day_user_click2buy_rate,
-- 品类交互的用户数转化率
case when category_last3day_behavior_user_cnt = 0 then 0 else category_last3day_buy_user_cnt/category_last3day_behavior_user_cnt end as category_last3day_user_click2buy_rate,
case when category_last7day_behavior_user_cnt = 0 then 0 else category_last7day_buy_user_cnt/category_last7day_behavior_user_cnt end as category_last7day_user_click2buy_rate,
case when category_last28day_behavior_user_cnt = 0 then 0 else category_last28day_buy_user_cnt/category_last28day_behavior_user_cnt end as category_last28day_user_click2buy_rate,
-- U:用户交互转化率
case when user_last28day_click_cnt = 0 then 0 else user_last28day_buy_cnt/user_last28day_click_cnt end as user_last28day_click2buy_rate,
case when user_last28day_bookmark_cnt = 0 then 0 else user_last28day_buy_cnt/user_last28day_bookmark_cnt end as user_last28day_bookmark2buy_rate,
case when user_last28day_addcart_cnt = 0 then 0 else user_last28day_buy_cnt/user_last28day_addcart_cnt end as user_last28day_addcart2buy_rate,
-- I:商品交互的转化率
case when item_last28day_click_cnt = 0 then 0 else item_last28day_buy_cnt/item_last28day_click_cnt end as item_last28day_click2buy_rate,
case when item_last28day_bookmark_cnt = 0 then 0 else item_last28day_buy_cnt/item_last28day_bookmark_cnt end as item_last28day_bookmark2buy_rate,
case when item_last28day_addcart_cnt = 0 then 0 else item_last28day_buy_cnt/item_last28day_addcart_cnt end as item_last28day_addcart2buy_rate,
-- C:品类交互的转化率
case when category_last28day_click_cnt = 0 then 0 else category_last28day_buy_cnt/category_last28day_click_cnt end as category_last28day_click2buy_rate,
case when category_last28day_bookmark_cnt = 0 then 0 else category_last28day_buy_cnt/category_last28day_bookmark_cnt end as category_last28day_bookmark2buy_rate,
case when category_last28day_addcart_cnt = 0 then 0 else category_last28day_buy_cnt/category_last28day_addcart_cnt end as category_last28day_addcart2buy_rate,
-- UC:用户交互品类的转化率
case when user_last28day_click_category_cnt = 0 then 0 else user_last28day_buy_category_cnt/user_last28day_click_category_cnt end as user_last28day_category_click2buy_rate,
case when user_last28day_bookmark_category_cnt = 0 then 0 else user_last28day_buy_category_cnt/user_last28day_bookmark_category_cnt end as user_last28day_category_bookmark2buy_rate,
case when user_last28day_addcart_category_cnt = 0 then 0 else user_last28day_buy_category_cnt/user_last28day_addcart_category_cnt end as user_last28day_category_addcart2buy_rate,
-- UI:用户交互商品的转化率
case when ui_last28day_click_cnt = 0 then 0 else ui_last28day_buy_cnt/ui_last28day_click_cnt end as ui_last28day_click2buy_rate,
case when ui_last28day_bookmark_cnt = 0 then 0 else ui_last28day_buy_cnt/ui_last28day_bookmark_cnt end as ui_last28day_bookmark2buy_rate,
case when ui_last28day_addcart_cnt = 0 then 0 else ui_last28day_buy_cnt/ui_last28day_addcart_cnt end as ui_last28day_addcart2buy_rate,
--------------------------------------------------------------------- 占比 ----------------------------------------------------------------
-- 商品平均交互占比
case when category_last28day_behavior_user_cnt = 0 then 0 else item_last28day_behavior_user_cnt/category_last28day_behavior_user_cnt end as item_of_category_last28day_user_behavior_rate,
case when category_last28day_buy_user_cnt = 0 then 0 else item_last28day_buy_user_cnt/category_last28day_buy_user_cnt end as item_of_category_last28day_user_buy_rate,
-- 用户对商品的平均交互数
case when user_last28day_click_cnt = 0 then 0 else user_last28day_click_item_cnt/user_last28day_click_cnt end as user_last28day_item_avg_click_rate,
case when user_last28day_bookmark_cnt = 0 then 0 else user_last28day_bookmark_item_cnt/user_last28day_bookmark_cnt end as user_last28day_item_avg_bookmark_rate,
case when user_last28day_addcart_cnt = 0 then 0 else user_last28day_addcart_item_cnt/user_last28day_addcart_cnt end as user_last28day_item_avg_addcart_rate,
case when user_last28day_buy_cnt = 0 then 0 else user_last28day_buy_item_cnt/user_last28day_buy_cnt end as user_last28day_item_avg_buy_rate,
-- 用户的品类平均交互数
case when user_last28day_click_cnt = 0 then 0 else user_last28day_click_category_cnt/user_last28day_click_cnt end as user_last28day_category_avg_click_rate,
case when user_last28day_bookmark_cnt = 0 then 0 else user_last28day_bookmark_category_cnt/user_last28day_bookmark_cnt end as user_last28day_category_avg_bookmark_rate,
case when user_last28day_addcart_cnt = 0 then 0 else user_last28day_addcart_category_cnt/user_last28day_addcart_cnt end as user_last28day_category_avg_addcart_rate,
case when user_last28day_buy_cnt = 0 then 0 else user_last28day_buy_category_cnt/user_last28day_buy_cnt end as user_last28day_category_avg_buy_rate,
-- 用户交互商品的转化率
case when user_last28day_click_item_cnt = 0 then 0 else user_last28day_buy_item_cnt/user_last28day_click_item_cnt end as user_last28day_item_click2buy_rate,
case when user_last28day_bookmark_item_cnt = 0 then 0 else user_last28day_buy_item_cnt/user_last28day_bookmark_item_cnt end as user_last28day_item_bookmark2buy_rate,
case when user_last28day_addcart_item_cnt = 0 then 0 else user_last28day_buy_item_cnt/user_last28day_addcart_item_cnt end as user_last28day_item_addcart2buy_rate,
case when category_last28day_buy_cnt = 0 then 0 else item_last28day_buy_cnt/category_last28day_buy_cnt end as item_of_category_last28day_buy_rate,
-- 反复购买占比
case when item_last28day_buy_user_cnt = 0 then 0 else item_last28day_dumplicated_buy_user_cnt/item_last28day_buy_user_cnt end as item_last28day_dumplicated_buy_user_rate,
case when item_last28day_buy_cnt = 0 then 0 else item_last28day_dumplicated_buy_cnt/item_last28day_buy_cnt end as item_last28day_dumplicated_buy_rate,
case when category_last28day_buy_user_cnt = 0 then 0 else category_last28day_dumplicated_buy_user_cnt/category_last28day_buy_user_cnt end as category_last28day_dumplicated_buy_user_rate,
case when category_last28day_buy_cnt = 0 then 0 else category_last28day_dumplicated_buy_cnt/category_last28day_buy_cnt end as category_last28day_dumplicated_buy_rate,
-- 2021.06.08 新增特征:用商品点击率等来区分增加购物栏的不同商品
case when ui_last28day_click_cnt = 0
then 0 else ui_last28day_category_click_cnt/ui_last28day_click_cnt end as ui_last28day_category_avg_click_rate,
case when user_last28day_click_cnt = 0
then 0 else ui_last28day_category_click_cnt/user_last28day_click_cnt
end as ui_category_last28day_click_rate,
case when user_last28day_click_cnt = 0
then 0 else ui_last28day_click_cnt/user_last28day_click_cnt
end as ui_item_last28day_click_rate,
case when ui_last28day_bookmark_cnt = 0
then 0 else ui_last28day_category_bookmark_cnt/ui_last28day_bookmark_cnt end as ui_item_of_category_last28day_bookmark_rate,
case when user_last28day_bookmark_category_cnt = 0then 0 else ui_last28day_category_bookmark_cnt/user_last28day_bookmark_category_cntend as ui_category_last28day_bookmark_rate,
case when user_last28day_bookmark_cnt = 0
then 0 else ui_last28day_bookmark_cnt/user_last28day_bookmark_cnt
end as ui_item_last28day_bookmark_rate,
case when ui_last28day_category_addcart_cnt = 0then 0 else ui_last28day_addcart_cnt/ui_last28day_category_addcart_cnt end as ui_item_of_category_last28day_addcart_rate,
case when user_last28day_addcart_cnt = 0
then 0 else ui_last28day_category_addcart_cnt/user_last28day_addcart_cnt
end as ui_category_last28day_addcart_rate,
case when user_last28day_addcart_cnt = 0
then 0 else ui_last28day_addcart_cnt/user_last28day_addcart_cnt
end as ui_item_last28day_addcart_rate,
case when ui_last28day_category_buy_cnt = 0
then 0 else ui_last28day_buy_cnt/ui_last28day_category_buy_cnt end as ui_item_of_category_last28day_buy_rate,
case when user_last28day_buy_cnt = 0
then 0 else ui_last28day_category_buy_cnt/user_last28day_buy_cnt
end as ui_category_last28day_buy_rate,
case when user_last28day_buy_cnt = 0
then 0 else ui_last28day_buy_cnt/user_last28day_buy_cnt
end as ui_item_last28day_buy_rate,
-- 前一天的UI交互占比
case when user_last1day_click_cnt = 0 then 0 else ui_last1day_click_cnt/user_last1day_click_cnt end as ui_of_user_last1day_click_rate,
case when user_last1day_bookmark_cnt = 0 then 0 else ui_last1day_bookmark_cnt/user_last1day_bookmark_cnt end as ui_of_user_last1day_bookmark_rate,
case when user_last1day_addcart_cnt = 0 then 0 else ui_last1day_addcart_cnt/user_last1day_addcart_cnt end as ui_of_user_last1day_addcart_rate,
case when user_last1day_buy_cnt = 0 then 0 else ui_last1day_buy_cnt/user_last1day_buy_cnt end as ui_of_user_last1day_buy_rate,
case when item_last1day_click_cnt = 0 then 0 else ui_last1day_click_cnt/item_last1day_click_cnt end as ui_of_item_last1day_click_rate,
case when item_last1day_bookmark_cnt = 0 then 0 else ui_last1day_bookmark_cnt/item_last1day_bookmark_cnt end as ui_of_item_last1day_bookmark_rate,
case when item_last1day_addcart_cnt = 0 then 0 else ui_last1day_addcart_cnt/item_last1day_addcart_cnt end as ui_of_item_last1day_addcart_rate,
case when item_last1day_buy_cnt = 0 then 0 else ui_last1day_buy_cnt/item_last1day_buy_cnt end as ui_of_item_last1day_buy_rate,
case when category_last1day_click_cnt = 0 then 0 else ui_last1day_click_cnt/category_last1day_click_cnt end as ui_of_category_last1day_click_rate,
case when category_last1day_bookmark_cnt = 0 then 0 else ui_last1day_bookmark_cnt/category_last1day_bookmark_cnt end as ui_of_category_last1day_bookmark_rate,
case when category_last1day_addcart_cnt = 0 then 0 else ui_last1day_addcart_cnt/category_last1day_addcart_cnt end as ui_of_category_last1day_addcart_rate,
case when category_last1day_buy_cnt = 0 then 0 else ui_last1day_buy_cnt/category_last1day_buy_cnt end as ui_of_category_last1day_buy_rate,
case when (user_last1day_click_cnt+user_last1day_bookmark_cnt+user_last1day_addcart_cnt+user_last1day_buy_cnt)= 0 then 0 else
(ui_last1day_click_cnt*0.1 + ui_last1day_bookmark_cnt*1 + ui_last1day_addcart_cnt*2 + ui_last1day_buy_cnt *5 )/(user_last1day_click_cnt*0.1 + user_last1day_bookmark_cnt*1 + user_last1day_addcart_cnt*2 + user_last1day_buy_cnt
*5 ) end as ui_of_user_last1day_prevalent_rate,
case when (item_last1day_click_cnt+item_last1day_bookmark_cnt+item_last1day_addcart_cnt+item_last1day_buy_cnt)= 0 then 0 else
(ui_last1day_click_cnt*0.1 + ui_last1day_bookmark_cnt*1 + ui_last1day_addcart_cnt*2 + ui_last1day_buy_cnt *5 )/(item_last1day_click_cnt*0.1 + item_last1day_bookmark_cnt*1 + item_last1day_addcart_cnt*2 + item_last1day_buy_cnt
*5 ) end as ui_of_item_last1day_prevalent_rate,
case when (category_last1day_click_cnt+category_last1day_bookmark_cnt+category_last1day_addcart_cnt+category_last1day_buy_cnt)= 0 then 0 else
(ui_last1day_click_cnt*0.1 + ui_last1day_bookmark_cnt*1 + ui_last1day_addcart_cnt*2 + ui_last1day_buy_cnt *5 )/(category_last1day_click_cnt*0.1 + category_last1day_bookmark_cnt*1 + category_last1day_addcart_cnt*2 + category_last1day_buy_cnt
*5 ) end as ui_of_category_last1day_prevalent_rate,
----------------------------------------------------------------------- 2015.06.25 平均 ----------------------------------------------------------------------
ui_last3day_buy_cnt/3 as ui_last3day_avg_buy_cnt,
ui_last7day_buy_cnt/7 as ui_last7day_avg_buy_cnt,
ui_last14day_buy_cnt/14 as ui_last14day_avg_buy_cnt,
ui_last21day_buy_cnt/21 as ui_last21day_avg_buy_cnt,
ui_last28day_buy_cnt/28 as ui_last28day_avg_buy_cnt,
user_last3day_buy_cnt/3 as user_last3day_avg_buy_cnt,
user_last7day_buy_cnt/7 as user_last7day_avg_buy_cnt,
user_last14day_buy_cnt/14 as user_last14day_avg_buy_cnt,
user_last21day_buy_cnt/21 as user_last21day_avg_buy_cnt,
user_last28day_buy_cnt/28 as user_last28day_avg_buy_cnt,
user_last3day_buy_item_cnt/3 as user_last3day_buy_item_avg_cnt,
user_last7day_buy_item_cnt/7 as user_last7day_buy_item_avg_cnt,
user_last14day_buy_item_cnt/14 as user_last14day_buy_item_avg_cnt,
user_last21day_buy_item_cnt/21 as user_last21day_buy_item_avg_cnt,
user_last28day_buy_item_cnt/28 as user_last28day_buy_item_avg_cnt,
user_last3day_buy_category_cnt/3 as user_last3day_buy_category_avg_cnt,
user_last7day_buy_category_cnt/7 as user_last7day_buy_category_avg_cnt,
user_last14day_buy_category_cnt/14 as user_last14day_buy_category_avg_cnt,
user_last21day_buy_category_cnt/21 as user_last21day_buy_category_avg_cnt,
user_last28day_buy_category_cnt/28 as user_last28day_buy_category_avg_cnt,
user_last3day_behavior_item_cnt/3 as user_last3day_behavior_item_avg_cnt,
user_last7day_behavior_item_cnt/7 as user_last7day_behavior_item_avg_cnt,
user_last14day_behavior_item_cnt/14 as user_last14day_behavior_item_avg_cnt,
user_last21day_behavior_item_cnt/21 as user_last21day_behavior_item_avg_cnt,
user_last28day_behavior_item_cnt/28 as user_last28day_behavior_item_avg_cnt,
user_last3day_behavior_category_cnt/3 as user_last3day_behavior_category_avg_cnt,
user_last7day_behavior_category_cnt/7 as user_last7day_behavior_category_avg_cnt,
user_last14day_behavior_category_cnt/14 as user_last14day_behavior_category_avg_cnt,
user_last21day_behavior_category_cnt/21 as user_last21day_behavior_category_avg_cnt,
user_last28day_behavior_category_cnt/28 as user_last28day_behavior_category_avg_cnt,
item_last3day_buy_cnt/3 as item_last3day_buy_avg_cnt,
item_last7day_buy_cnt/7 as item_last7day_buy_avg_cnt,
item_last14day_buy_cnt/14 as item_last14day_buy_avg_cnt,
item_last21day_buy_cnt/21 as item_last21day_buy_avg_cnt,
item_last28day_buy_cnt/28 as item_last28day_buy_avg_cnt,
category_last3day_buy_cnt/3 as category_last3day_buy_avg_cnt,
category_last7day_buy_cnt/7 as category_last7day_buy_avg_cnt,
category_last14day_buy_cnt/14 as category_last14day_buy_avg_cnt,
category_last21day_buy_cnt/21 as category_last21day_buy_avg_cnt,
category_last28day_buy_cnt/28 as category_last28day_buy_avg_cnt,
item_last3day_buy_user_cnt/3 as item_last3day_buy_user_avg_cnt,
item_last7day_buy_user_cnt/7 as item_last7day_buy_user_avg_cnt,
item_last14day_buy_user_cnt/14 as item_last14day_buy_user_avg_cnt,
item_last21day_buy_user_cnt/21 as item_last21day_buy_user_avg_cnt,
item_last28day_buy_user_cnt/28 as item_last28day_buy_user_avg_cnt,
category_last3day_buy_user_cnt/3 as category_last3day_buy_user_avg_cnt,
category_last7day_buy_user_cnt/7 as category_last7day_buy_user_avg_cnt,
category_last14day_buy_user_cnt/14 as category_last14day_buy_user_avg_cnt,
category_last21day_buy_user_cnt/21 as category_last21day_buy_user_avg_cnt,
category_last28day_buy_user_cnt/28 as category_last28day_buy_user_avg_cnt,
item_last3day_behavior_user_cnt/3 as item_last3day_behavior_user_avg_cnt,
item_last7day_behavior_user_cnt/7 as item_last7day_behavior_user_avg_cnt,
item_last14day_behavior_user_cnt/14 as item_last14day_behavior_user_avg_cnt,
item_last21day_behavior_user_cnt/21 as item_last21day_behavior_user_avg_cnt,
item_last28day_behavior_user_cnt/28 as item_last28day_behavior_user_avg_cnt,
category_last3day_behavior_user_cnt/3 as category_last3day_behavior_user_avg_cnt,
category_last7day_behavior_user_cnt/7 as category_last7day_behavior_user_avg_cnt,
category_last14day_behavior_user_cnt/14 as category_last14day_behavior_user_avg_cnt,
category_last21day_behavior_user_cnt/21 as category_last21day_behavior_user_avg_cnt,
category_last28day_behavior_user_cnt/28 as category_last28day_behavior_user_avg_cnt,
----------------------------------------------------------------------- 减法特征 ----------------------------------------------------------------------
-- (用户A对品牌B的PV数-用户A对操作过的品牌的平均PV数)/用户A对操作过的品牌的平均PV数
-- (用户A对品牌B的购买数-用户A对操作过的品牌的平均购买数)/用户A对操作过的品牌的平均购买数
-- (用户A对品牌B的收藏数-品牌B被平均收藏数)/品牌B被平均收藏数
case when user_last1day_click_cnt = 0 then 0 else (ui_last1day_click_cnt*user_last1day_click_item_cnt - user_last1day_click_cnt)/user_last1day_click_cnt end as ui_last1day_click_of_avg_item_click_rate,
case when user_last1day_buy_cnt = 0 then 0 else (ui_last1day_buy_cnt*user_last1day_buy_item_cnt - user_last1day_buy_cnt)/user_last1day_buy_cnt end as ui_last1day_buy_of_avg_item_buy_rate,
case when user_last3day_click_cnt = 0 then 0 else (ui_last3day_click_cnt*user_last3day_click_item_cnt - user_last3day_click_cnt)/user_last3day_click_cnt end as ui_last3day_click_of_avg_item_click_rate,
case when user_last3day_buy_cnt = 0 then 0 else (ui_last3day_buy_cnt*user_last3day_buy_item_cnt - user_last3day_buy_cnt)/user_last3day_buy_cnt end as ui_last3day_buy_of_avg_item_buy_rate,
case when user_last7day_click_cnt = 0 then 0 else (ui_last7day_click_cnt*user_last7day_click_item_cnt - user_last7day_click_cnt)/user_last7day_click_cnt end as ui_last7day_click_of_avg_item_click_rate,
case when user_last7day_buy_cnt = 0 then 0 else (ui_last7day_buy_cnt*user_last7day_buy_item_cnt - user_last7day_buy_cnt)/user_last7day_buy_cnt end as ui_last7day_buy_of_avg_item_buy_rate,
case when user_last14day_click_cnt = 0 then 0 else (ui_last14day_click_cnt*user_last14day_click_item_cnt - user_last14day_click_cnt)/user_last14day_click_cnt end as ui_last14day_click_of_avg_item_click_rate,
case when user_last14day_buy_cnt = 0 then 0 else (ui_last14day_buy_cnt*user_last14day_buy_item_cnt - user_last14day_buy_cnt)/user_last14day_buy_cnt end as ui_last14day_buy_of_avg_item_buy_rate,
case when user_last21day_click_cnt = 0 then 0 else (ui_last21day_click_cnt*user_last21day_click_item_cnt - user_last21day_click_cnt)/user_last21day_click_cnt end as ui_last21day_click_of_avg_item_click_rate,
case when user_last21day_buy_cnt = 0 then 0 else (ui_last21day_buy_cnt*user_last21day_buy_item_cnt - user_last21day_buy_cnt)/user_last21day_buy_cnt end as ui_last21day_buy_of_avg_item_buy_rate,
case when user_last28day_click_cnt = 0 then 0 else (ui_last28day_click_cnt*user_last28day_click_item_cnt - user_last28day_click_cnt)/user_last28day_click_cnt end as ui_last28day_click_of_avg_item_click_rate,
case when user_last28day_buy_cnt = 0 then 0 else (ui_last28day_buy_cnt*user_last28day_buy_item_cnt - user_last28day_buy_cnt)/user_last28day_buy_cnt end as ui_last28day_buy_of_avg_item_buy_rate,
case when category_last1day_click_cnt = 0 then 0 else (ui_last1day_category_click_cnt*category_last1day_click_user_cnt-category_last1day_click_cnt)/category_last1day_click_cnt end as uc_last1day_click_of_avg_category_click_rate,
case when category_last1day_bookmark_cnt = 0 then 0 else (ui_last1day_category_bookmark_cnt*category_last1day_bookmark_user_cnt-category_last1day_bookmark_cnt)/category_last1day_bookmark_cnt end as uc_last1day_bookmark_of_avg_category_bookmark_rate,
case when category_last1day_addcart_cnt = 0 then 0 else (ui_last1day_category_addcart_cnt*category_last1day_addcart_user_cnt-category_last1day_addcart_cnt)/category_last1day_addcart_cnt end as uc_last1day_addcart_of_avg_category_addcart_rate,
case when category_last1day_buy_cnt = 0 then 0 else (ui_last1day_category_buy_cnt*category_last1day_buy_user_cnt-category_last1day_buy_cnt)/category_last1day_buy_cnt end as uc_last1day_buy_of_avg_category_buy_rate,
case when category_last3day_click_cnt = 0 then 0 else (ui_last3day_category_click_cnt*category_last3day_click_user_cnt-category_last3day_click_cnt)/category_last3day_click_cnt end as uc_last3day_click_of_avg_category_click_rate,
case when category_last3day_bookmark_cnt = 0 then 0 else (ui_last3day_category_bookmark_cnt*category_last3day_bookmark_user_cnt-category_last3day_bookmark_cnt)/category_last3day_bookmark_cnt end as uc_last3day_bookmark_of_avg_category_bookmark_rate,
case when category_last3day_addcart_cnt = 0 then 0 else (ui_last3day_category_addcart_cnt*category_last3day_addcart_user_cnt-category_last3day_addcart_cnt)/category_last3day_addcart_cnt end as uc_last3day_addcart_of_avg_category_addcart_rate,
case when category_last3day_buy_cnt = 0 then 0 else (ui_last3day_category_buy_cnt*category_last3day_buy_user_cnt-category_last3day_buy_cnt)/category_last3day_buy_cnt end as uc_last3day_buy_of_avg_category_buy_rate,
case when category_last7day_click_cnt = 0 then 0 else (ui_last7day_category_click_cnt*category_last7day_click_user_cnt-category_last7day_click_cnt)/category_last7day_click_cnt end as uc_last7day_click_of_avg_category_click_rate,
case when category_last7day_bookmark_cnt = 0 then 0 else (ui_last7day_category_bookmark_cnt*category_last7day_bookmark_user_cnt-category_last7day_bookmark_cnt)/category_last7day_bookmark_cnt end as uc_last7day_bookmark_of_avg_category_bookmark_rate,
case when category_last7day_addcart_cnt = 0 then 0 else (ui_last7day_category_addcart_cnt*category_last7day_addcart_user_cnt-category_last7day_addcart_cnt)/category_last7day_addcart_cnt end as uc_last7day_addcart_of_avg_category_addcart_rate,
case when category_last7day_buy_cnt = 0 then 0 else (ui_last7day_category_buy_cnt*category_last7day_buy_user_cnt-category_last7day_buy_cnt)/category_last7day_buy_cnt end as uc_last7day_buy_of_avg_category_buy_rate,
case when category_last14day_click_cnt = 0 then 0 else (ui_last14day_category_click_cnt*category_last14day_click_user_cnt-category_last14day_click_cnt)/category_last14day_click_cnt end as uc_last14day_click_of_avg_category_click_rate,
case when category_last14day_bookmark_cnt = 0 then 0 else (ui_last14day_category_bookmark_cnt*category_last14day_bookmark_user_cnt-category_last14day_bookmark_cnt)/category_last14day_bookmark_cnt end as uc_last14day_bookmark_of_avg_category_bookmark_rate,
case when category_last14day_addcart_cnt = 0 then 0 else (ui_last14day_category_addcart_cnt*category_last14day_addcart_user_cnt-category_last14day_addcart_cnt)/category_last14day_addcart_cnt end as uc_last14day_addcart_of_avg_category_addcart_rate,
case when category_last14day_buy_cnt = 0 then 0 else (ui_last14day_category_buy_cnt*category_last14day_buy_user_cnt-category_last14day_buy_cnt)/category_last14day_buy_cnt end as uc_last14day_buy_of_avg_category_buy_rate,
case when category_last21day_click_cnt = 0 then 0 else (ui_last21day_category_click_cnt*category_last21day_click_user_cnt-category_last21day_click_cnt)/category_last21day_click_cnt end as uc_last21day_click_of_avg_category_click_rate,
case when category_last21day_bookmark_cnt = 0 then 0 else (ui_last21day_category_bookmark_cnt*category_last21day_bookmark_user_cnt-category_last21day_bookmark_cnt)/category_last21day_bookmark_cnt end as uc_last21day_bookmark_of_avg_category_bookmark_rate,
case when category_last21day_addcart_cnt = 0 then 0 else (ui_last21day_category_addcart_cnt*category_last21day_addcart_user_cnt-category_last21day_addcart_cnt)/category_last21day_addcart_cnt end as uc_last21day_addcart_of_avg_category_addcart_rate,
case when category_last21day_buy_cnt = 0 then 0 else (ui_last21day_category_buy_cnt*category_last21day_buy_user_cnt-category_last21day_buy_cnt)/category_last21day_buy_cnt end as uc_last21day_buy_of_avg_category_buy_rate,
case when category_last28day_click_cnt = 0 then 0 else (ui_last28day_category_click_cnt*category_last28day_click_user_cnt-category_last28day_click_cnt)/category_last28day_click_cnt end as uc_last28day_click_of_avg_category_click_rate,
case when category_last28day_bookmark_cnt = 0 then 0 else (ui_last28day_category_bookmark_cnt*category_last28day_bookmark_user_cnt-category_last28day_bookmark_cnt)/category_last28day_bookmark_cnt end as uc_last28day_bookmark_of_avg_category_bookmark_rate,
case when category_last28day_addcart_cnt = 0 then 0 else (ui_last28day_category_addcart_cnt*category_last28day_addcart_user_cnt-category_last28day_addcart_cnt)/category_last28day_addcart_cnt end as uc_last28day_addcart_of_avg_category_addcart_rate,
case when category_last28day_buy_cnt = 0 then 0 else (ui_last28day_category_buy_cnt*category_last28day_buy_user_cnt-category_last28day_buy_cnt)/category_last28day_buy_cnt end as uc_last28day_buy_of_avg_category_buy_rate,
case when (ui_first_behavior_day_dist - ui_last_behavior_day_dist)=0 then 0 else (ui_last28day_click_cnt*0.1+ui_last28day_bookmark_cnt+ui_last28day_addcart_cnt*2+ui_last28day_buy_cnt*5)/(ui_first_behavior_day_dist - ui_last_behavior_day_dist)
end as ui_last28day_avg_prevalent,
----------------------------------------------------------------------- 组合特征 -----------------------------------------------------------------------
-- 针对最后一天的组合特征
case when ui_last1day_addcart_cnt>0 AND ui_last1day_buy_cnt=0 then 0 when ui_last1day_addcart_cnt>0 AND ui_last1day_buy_cnt>0 then 2 else 1 end as ui_last1day_addcart_type,
case when ui_last_click_day_dist is null then log(2,28+1+1) else log(2,ui_last_click_day_dist+1) end as ui_last_click_day_log_dist,
case when ui_last_bookmark_day_dist is null then log(2,28+1+1) else log(2,ui_last_bookmark_day_dist+1) end as ui_last_bookmark_day_log_dist,
case when ui_last_addcart_day_dist is null then log(2,28+1+1) else log(2,ui_last_addcart_day_dist+1) end as ui_last_addcart_day_log_dist,
case when ui_last_buy_day_dist is null then log(2,28+1+1) else log(2,ui_last_buy_day_dist+1) end as ui_last_buy_day_log_dist,
case when ui_last_behavior_day_dist is null then log(2,28+1+1) else log(2,ui_last_behavior_day_dist+1) end as ui_last_behavior_day_log_dist,
case when ui_last_click_hour_dist is null then log(2,(28+1)*24+1) else log(2,ui_last_click_hour_dist+1) end as ui_last_click_hour_log_dist,
case when ui_last_bookmark_hour_dist is null then log(2,(28+1)*24+1) else log(2,ui_last_bookmark_hour_dist+1) end as ui_last_bookmark_hour_log_dist,
case when ui_last_addcart_hour_dist is null then log(2,(28+1)*24+1) else log(2,ui_last_addcart_hour_dist+1) end as ui_last_addcart_hour_log_dist,
case when ui_last_buy_hour_dist is null then log(2,(28+1)*24+1) else log(2,ui_last_buy_hour_dist+1) end as ui_last_buy_hour_log_dist,
case when ui_last_behavior_hour_dist is null then log(2,(28+1)*24+1) else log(2,ui_last_behavior_hour_dist+1) end as ui_last_behavior_hour_log_dist,
-- 用户活跃度
(user_last1day_click_cnt*0.1 + user_last1day_bookmark_cnt*1 + user_last1day_addcart_cnt*2 + user_last1day_buy_cnt *5 ) as user_last1day_prevalent_rate,
(user_last3day_click_cnt*0.1 + user_last3day_bookmark_cnt*1 + user_last3day_addcart_cnt*2 + user_last3day_buy_cnt *5 ) as user_last3day_prevalent_rate,
(user_last7day_click_cnt*0.1 + user_last7day_bookmark_cnt*1 + user_last7day_addcart_cnt*2 + user_last7day_buy_cnt *5 ) as user_last7day_prevalent_rate,
(user_last14day_click_cnt*0.1 + user_last14day_bookmark_cnt*1 + user_last14day_addcart_cnt*2 + user_last14day_buy_cnt *5 ) as user_last14day_prevalent_rate,
(user_last21day_click_cnt*0.1 + user_last21day_bookmark_cnt*1 + user_last21day_addcart_cnt*2 + user_last21day_buy_cnt *5 ) as user_last21day_prevalent_rate,
(user_last28day_click_cnt*0.1 + user_last28day_bookmark_cnt*1 + user_last28day_addcart_cnt*2 + user_last28day_buy_cnt *5 ) as user_last28day_prevalent_rate,
(user_last3day_click_cnt*0.1 + user_last3day_bookmark_cnt*1 + user_last3day_addcart_cnt*2 + user_last3day_buy_cnt *5 )/3 as user_last3day_prevalent_avg_rate,
(user_last7day_click_cnt*0.1 + user_last7day_bookmark_cnt*1 + user_last7day_addcart_cnt*2 + user_last7day_buy_cnt *5 )/7 as user_last7day_prevalent_avg_rate,
(user_last14day_click_cnt*0.1 + user_last14day_bookmark_cnt*1 + user_last14day_addcart_cnt*2 + user_last14day_buy_cnt *5 )/14 as user_last14day_prevalent_avg_rate,
(user_last21day_click_cnt*0.1 + user_last21day_bookmark_cnt*1 + user_last21day_addcart_cnt*2 + user_last21day_buy_cnt *5 )/21 as user_last21day_prevalent_avg_rate,
(user_last28day_click_cnt*0.1 + user_last28day_bookmark_cnt*1 + user_last28day_addcart_cnt*2 + user_last28day_buy_cnt *5 )/28 as user_last28day_prevalent_avg_rate,
case when user_last1hour_behavior_diff_item_cnt>0 then user_last1hour_click_diff_item_cnt/user_last1hour_behavior_diff_item_cnt else 0 end as user_last1hour_click_of_item_behavior_rate,
case when user_last1hour_behavior_diff_item_cnt>0 then user_last1hour_addcart_diff_item_cnt/user_last1hour_behavior_diff_item_cnt else 0 end as user_last1hour_addcart_of_item_behavior_rate,
case when user_last2hour_behavior_diff_item_cnt>0 then user_last2hour_click_diff_item_cnt/user_last2hour_behavior_diff_item_cnt else 0 end as user_last2hour_click_of_item_behavior_rate,
case when user_last2hour_behavior_diff_item_cnt>0 then user_last2hour_addcart_diff_item_cnt/user_last2hour_behavior_diff_item_cnt else 0 end as user_last2hour_addcart_of_item_behavior_rate,
case when user_last3hour_behavior_diff_item_cnt>0 then user_last3hour_click_diff_item_cnt/user_last3hour_behavior_diff_item_cnt else 0 end as user_last3hour_click_of_item_behavior_rate,
case when user_last3hour_behavior_diff_item_cnt>0 then user_last3hour_addcart_diff_item_cnt/user_last3hour_behavior_diff_item_cnt else 0 end as user_last3hour_addcart_of_item_behavior_rate,
case when user_last4hour_behavior_diff_item_cnt>0 then user_last4hour_click_diff_item_cnt/user_last4hour_behavior_diff_item_cnt else 0 end as user_last4hour_click_of_item_behavior_rate,
case when user_last4hour_behavior_diff_item_cnt>0 then user_last4hour_addcart_diff_item_cnt/user_last4hour_behavior_diff_item_cnt else 0 end as user_last4hour_addcart_of_item_behavior_rate,
case when user_last9hour_behavior_diff_item_cnt>0 then user_last9hour_click_diff_item_cnt/user_last9hour_behavior_diff_item_cnt else 0 end as user_last9hour_click_of_item_behavior_rate,
case when user_last9hour_behavior_diff_item_cnt>0 then user_last9hour_addcart_diff_item_cnt/user_last9hour_behavior_diff_item_cnt else 0 end as user_last9hour_addcart_of_item_behavior_rate,
case when user_last15hour_behavior_diff_item_cnt>0 then user_last15hour_click_diff_item_cnt/user_last15hour_behavior_diff_item_cnt else 0 end as user_last15hour_click_of_item_behavior_rate,
case when user_last15hour_behavior_diff_item_cnt>0 then user_last15hour_addcart_diff_item_cnt/user_last15hour_behavior_diff_item_cnt else 0 end as user_last15hour_addcart_of_item_behavior_rate,
case when user_last1hour_behavior_diff_category_cnt>0 then user_last1hour_click_diff_category_cnt/user_last1hour_behavior_diff_category_cnt else 0 end as user_last1hour_click_of_category_behavior_rate,
case when user_last1hour_behavior_diff_category_cnt>0 then user_last1hour_addcart_diff_category_cnt/user_last1hour_behavior_diff_category_cnt else 0 end as user_last1hour_addcart_of_category_behavior_rate,
case when user_last2hour_behavior_diff_category_cnt>0 then user_last2hour_click_diff_category_cnt/user_last2hour_behavior_diff_category_cnt else 0 end as user_last2hour_click_of_category_behavior_rate,
case when user_last2hour_behavior_diff_category_cnt>0 then user_last2hour_addcart_diff_category_cnt/user_last2hour_behavior_diff_category_cnt else 0 end as user_last2hour_addcart_of_category_behavior_rate,
case when user_last3hour_behavior_diff_category_cnt>0 then user_last3hour_click_diff_category_cnt/user_last3hour_behavior_diff_category_cnt else 0 end as user_last3hour_click_of_category_behavior_rate,
case when user_last3hour_behavior_diff_category_cnt>0 then user_last3hour_addcart_diff_category_cnt/user_last3hour_behavior_diff_category_cnt else 0 end as user_last3hour_addcart_of_category_behavior_rate,
case when user_last4hour_behavior_diff_category_cnt>0 then user_last4hour_click_diff_category_cnt/user_last4hour_behavior_diff_category_cnt else 0 end as user_last4hour_click_of_category_behavior_rate,
case when user_last4hour_behavior_diff_category_cnt>0 then user_last4hour_addcart_diff_category_cnt/user_last4hour_behavior_diff_category_cnt else 0 end as user_last4hour_addcart_of_category_behavior_rate,
case when user_last9hour_behavior_diff_category_cnt>0 then user_last9hour_click_diff_category_cnt/user_last9hour_behavior_diff_category_cnt else 0 end as user_last9hour_click_of_category_behavior_rate,
case when user_last9hour_behavior_diff_category_cnt>0 then user_last9hour_addcart_diff_category_cnt/user_last9hour_behavior_diff_category_cnt else 0 end as user_last9hour_addcart_of_category_behavior_rate,
case when user_last15hour_behavior_diff_category_cnt>0 then user_last15hour_click_diff_category_cnt/user_last15hour_behavior_diff_category_cnt else 0 end as user_last15hour_click_of_category_behavior_rate,
case when user_last15hour_behavior_diff_category_cnt>0 then user_last15hour_addcart_diff_category_cnt/user_last15hour_behavior_diff_category_cnt else 0 end as user_last15hour_addcart_of_category_behavior_rate,
-- 商品热度
(item_last1day_click_cnt*0.1 + item_last1day_bookmark_cnt*1 + item_last1day_addcart_cnt*2 + item_last1day_buy_cnt *5 ) as item_last1day_prevalent_rate,
(item_last3day_click_cnt*0.1 + item_last3day_bookmark_cnt*1 + item_last3day_addcart_cnt*2 + item_last3day_buy_cnt *5 ) as item_last3day_prevalent_rate,
(item_last7day_click_cnt*0.1 + item_last7day_bookmark_cnt*1 + item_last7day_addcart_cnt*2 + item_last7day_buy_cnt *5 ) as item_last7day_prevalent_rate,
(item_last14day_click_cnt*0.1 + item_last14day_bookmark_cnt*1 + item_last14day_addcart_cnt*2 + item_last14day_buy_cnt *5 ) as item_last14day_prevalent_rate,
(item_last21day_click_cnt*0.1 + item_last21day_bookmark_cnt*1 + item_last21day_addcart_cnt*2 + item_last21day_buy_cnt *5 ) as item_last21day_prevalent_rate,
(item_last28day_click_cnt*0.1 + item_last28day_bookmark_cnt*1 + item_last28day_addcart_cnt*2 + item_last28day_buy_cnt *5 ) as item_last28day_prevalent_rate,
(item_last3day_click_cnt*0.1 + item_last3day_bookmark_cnt*1 + item_last3day_addcart_cnt*2 + item_last3day_buy_cnt *5 )/3 as item_last3day_prevalent_avg_rate,
(item_last7day_click_cnt*0.1 + item_last7day_bookmark_cnt*1 + item_last7day_addcart_cnt*2 + item_last7day_buy_cnt *5 )/7 as item_last7day_prevalent_avg_rate,
(item_last14day_click_cnt*0.1 + item_last14day_bookmark_cnt*1 + item_last14day_addcart_cnt*2 + item_last14day_buy_cnt *5 )/14 as item_last14day_prevalent_avg_rate,
(item_last21day_click_cnt*0.1 + item_last21day_bookmark_cnt*1 + item_last21day_addcart_cnt*2 + item_last21day_buy_cnt *5 )/21 as item_last21day_prevalent_avg_rate,
(item_last28day_click_cnt*0.1 + item_last28day_bookmark_cnt*1 + item_last28day_addcart_cnt*2 + item_last28day_buy_cnt *5 )/28 as item_last28day_prevalent_avg_rate,
-- 品类热度
(category_last1day_click_cnt*0.1 + category_last1day_bookmark_cnt*1 + category_last1day_addcart_cnt*2 + category_last1day_buy_cnt *5 ) as category_last1day_prevalent_rate,
(category_last3day_click_cnt*0.1 + category_last3day_bookmark_cnt*1 + category_last3day_addcart_cnt*2 + category_last3day_buy_cnt *5 ) as category_last3day_prevalent_rate,
(category_last7day_click_cnt*0.1 + category_last7day_bookmark_cnt*1 + category_last7day_addcart_cnt*2 + category_last7day_buy_cnt *5 ) as category_last7day_prevalent_rate,
(category_last14day_click_cnt*0.1 + category_last14day_bookmark_cnt*1 + category_last14day_addcart_cnt*2 + category_last14day_buy_cnt *5 ) as category_last14day_prevalent_rate,
(category_last21day_click_cnt*0.1 + category_last21day_bookmark_cnt*1 + category_last21day_addcart_cnt*2 + category_last21day_buy_cnt *5 ) as category_last21day_prevalent_rate,
(category_last28day_click_cnt*0.1 + category_last28day_bookmark_cnt*1 + category_last28day_addcart_cnt*2 + category_last28day_buy_cnt *5 ) as category_last28day_prevalent_rate,
(category_last3day_click_cnt*0.1 + category_last3day_bookmark_cnt*1 + category_last3day_addcart_cnt*2 + category_last3day_buy_cnt *5 )/3 as category_last3day_prevalent_avg_rate,
(category_last7day_click_cnt*0.1 + category_last7day_bookmark_cnt*1 + category_last7day_addcart_cnt*2 + category_last7day_buy_cnt *5 )/7 as category_last7day_prevalent_avg_rate,
(category_last14day_click_cnt*0.1 + category_last14day_bookmark_cnt*1 + category_last14day_addcart_cnt*2 + category_last14day_buy_cnt *5 )/14 as category_last14day_prevalent_avg_rate,
(category_last21day_click_cnt*0.1 + category_last21day_bookmark_cnt*1 + category_last21day_addcart_cnt*2 + category_last21day_buy_cnt *5 )/21 as category_last21day_prevalent_avg_rate,
(category_last28day_click_cnt*0.1 + category_last28day_bookmark_cnt*1 + category_last28day_addcart_cnt*2 + category_last28day_buy_cnt *5 )/28 as category_last28day_prevalent_avg_rate,
----------------------------------------------------- conjunction feature --------------------------------------------------------------------------------------------
case when ui_lastday_most_important_behavior_type =1 then ui_last_click_hour_dist
when ui_lastday_most_important_behavior_type =2 then ui_last_bookmark_hour_dist
when ui_lastday_most_important_behavior_type =3 then ui_last_addcart_hour_dist
when ui_lastday_most_important_behavior_type =4 then ui_last_buy_hour_dist
else 24+1 end as ui_last_most_important_behavior_hour_dist
FROM
(
SELECT t1.user_id,t1.item_id,t1.item_category,
case when buy_label is null then 0 else 1 end as buy_label,
case when item_last1day_behavior_user_cnt is null then 0else item_last1day_behavior_user_cnt endas item_last1day_behavior_user_cnt,
case when item_last3day_behavior_user_cnt is null then 0else item_last3day_behavior_user_cnt endas item_last3day_behavior_user_cnt,
case when item_last7day_behavior_user_cnt is null then 0else item_last7day_behavior_user_cnt endas item_last7day_behavior_user_cnt,
case when item_last14day_behavior_user_cnt is null then 0else item_last14day_behavior_user_cnt endas item_last14day_behavior_user_cnt,
case when item_last21day_behavior_user_cnt is null then 0else item_last21day_behavior_user_cnt endas item_last21day_behavior_user_cnt,
case when item_last28day_behavior_user_cnt is null then 0else item_last28day_behavior_user_cnt endas item_last28day_behavior_user_cnt,
case when category_last1day_behavior_user_cnt is null then 0else category_last1day_behavior_user_cnt endas category_last1day_behavior_user_cnt,
case when category_last3day_behavior_user_cnt is null then 0else category_last3day_behavior_user_cnt endas category_last3day_behavior_user_cnt,
case when category_last7day_behavior_user_cnt is null then 0else category_last7day_behavior_user_cnt endas category_last7day_behavior_user_cnt,
case when category_last14day_behavior_user_cnt is null then 0else category_last14day_behavior_user_cnt endas category_last14day_behavior_user_cnt,
case when category_last21day_behavior_user_cnt is null then 0else category_last21day_behavior_user_cnt endas category_last21day_behavior_user_cnt,
case when category_last28day_behavior_user_cnt is null then 0else category_last28day_behavior_user_cnt endas category_last28day_behavior_user_cnt,
case when item_last1day_click_user_cnt is null then 0
else item_last1day_click_user_cnt end as item_last1day_click_user_cnt,
case when item_last1day_bookmark_user_cnt is null then 0
else item_last1day_bookmark_user_cnt end as item_last1day_bookmark_user_cnt,
case when item_last1day_addcart_user_cnt is null then 0
else item_last1day_addcart_user_cnt end as item_last1day_addcart_user_cnt,
case when item_last1day_buy_user_cnt is null then 0
else item_last1day_buy_user_cnt end as item_last1day_buy_user_cnt,
case when item_last3day_click_user_cnt is null then 0else item_last3day_click_user_cnt endas item_last3day_click_user_cnt,
case when item_last3day_bookmark_user_cnt is null then 0
else item_last3day_bookmark_user_cnt end as item_last3day_bookmark_user_cnt,
case when item_last3day_addcart_user_cnt is null then 0
else item_last3day_addcart_user_cnt end as item_last3day_addcart_user_cnt,
case when item_last3day_buy_user_cnt is null then 0
else item_last3day_buy_user_cnt end as item_last3day_buy_user_cnt,
case when item_last7day_click_user_cnt is null then 0else item_last7day_click_user_cnt endas item_last7day_click_user_cnt,
case when item_last7day_bookmark_user_cnt is null then 0
else item_last7day_bookmark_user_cnt end as item_last7day_bookmark_user_cnt,
case when item_last7day_addcart_user_cnt is null then 0
else item_last7day_addcart_user_cnt end as item_last7day_addcart_user_cnt,
case when item_last7day_buy_user_cnt is null then 0
else item_last7day_buy_user_cnt end as item_last7day_buy_user_cnt,
case when item_last14day_click_user_cnt is null then 0else item_last14day_click_user_cnt endas item_last14day_click_user_cnt,
case when item_last14day_bookmark_user_cnt is null then 0
else item_last14day_bookmark_user_cnt end as item_last14day_bookmark_user_cnt,
case when item_last14day_addcart_user_cnt is null then 0
else item_last14day_addcart_user_cnt end as item_last14day_addcart_user_cnt,
case when item_last14day_buy_user_cnt is null then 0
else item_last14day_buy_user_cnt end as item_last14day_buy_user_cnt,
case when item_last21day_click_user_cnt is null then 0else item_last21day_click_user_cnt endas item_last21day_click_user_cnt,
case when item_last21day_bookmark_user_cnt is null then 0
else item_last21day_bookmark_user_cnt end as item_last21day_bookmark_user_cnt,
case when item_last21day_addcart_user_cnt is null then 0
else item_last21day_addcart_user_cnt end as item_last21day_addcart_user_cnt,
case when item_last21day_buy_user_cnt is null then 0
else item_last21day_buy_user_cnt end as item_last21day_buy_user_cnt,
case when item_last28day_click_user_cnt is null then 0else item_last28day_click_user_cnt endas item_last28day_click_user_cnt,
case when item_last28day_bookmark_user_cnt is null then 0
else item_last28day_bookmark_user_cnt end as item_last28day_bookmark_user_cnt,
case when item_last28day_addcart_user_cnt is null then 0
else item_last28day_addcart_user_cnt end as item_last28day_addcart_user_cnt,
case when item_last28day_buy_user_cnt is null then 0
else item_last28day_buy_user_cnt end as item_last28day_buy_user_cnt,
case when category_last1day_click_user_cnt is null then 0else category_last1day_click_user_cnt endas category_last1day_click_user_cnt,
case when category_last1day_bookmark_user_cnt is null then 0
else category_last1day_bookmark_user_cnt end
as category_last1day_bookmark_user_cnt,
case when category_last1day_addcart_user_cnt is null then 0
else category_last1day_addcart_user_cnt end
as category_last1day_addcart_user_cnt,
case when category_last1day_buy_user_cnt is null then 0
else category_last1day_buy_user_cnt end as category_last1day_buy_user_cnt,
case when category_last3day_click_user_cnt is null then 0else category_last3day_click_user_cnt endas category_last3day_click_user_cnt,
case when category_last3day_bookmark_user_cnt is null then 0
else category_last3day_bookmark_user_cnt end
as category_last3day_bookmark_user_cnt,
case when category_last3day_addcart_user_cnt is null then 0
else category_last3day_addcart_user_cnt end
as category_last3day_addcart_user_cnt,
case when category_last3day_buy_user_cnt is null then 0
else category_last3day_buy_user_cnt end as category_last3day_buy_user_cnt,
case when category_last7day_click_user_cnt is null then 0else category_last7day_click_user_cnt endas category_last7day_click_user_cnt,
case when category_last7day_bookmark_user_cnt is null then 0
else category_last7day_bookmark_user_cnt end
as category_last7day_bookmark_user_cnt,
case when category_last7day_addcart_user_cnt is null then 0
else category_last7day_addcart_user_cnt end
as category_last7day_addcart_user_cnt,
case when category_last7day_buy_user_cnt is null then 0
else category_last7day_buy_user_cnt end as category_last7day_buy_user_cnt,
case when category_last14day_click_user_cnt is null then 0else category_last14day_click_user_cnt endas category_last14day_click_user_cnt,
case when category_last14day_bookmark_user_cnt is null then 0
else category_last14day_bookmark_user_cnt end
as category_last14day_bookmark_user_cnt,
case when category_last14day_addcart_user_cnt is null then 0
else category_last14day_addcart_user_cnt end
as category_last14day_addcart_user_cnt,
case when category_last14day_buy_user_cnt is null then 0
else category_last14day_buy_user_cnt end as category_last14day_buy_user_cnt,
case when category_last21day_click_user_cnt is null then 0else category_last21day_click_user_cnt endas category_last21day_click_user_cnt,
case when category_last21day_bookmark_user_cnt is null then 0
else category_last21day_bookmark_user_cnt end
as category_last21day_bookmark_user_cnt,
case when category_last21day_addcart_user_cnt is null then 0
else category_last21day_addcart_user_cnt end
as category_last21day_addcart_user_cnt,
case when category_last21day_buy_user_cnt is null then 0
else category_last21day_buy_user_cnt end as category_last21day_buy_user_cnt,
case when category_last28day_click_user_cnt is null then 0else category_last28day_click_user_cnt endas category_last28day_click_user_cnt,
case when category_last28day_bookmark_user_cnt is null then 0
else category_last28day_bookmark_user_cnt end
as category_last28day_bookmark_user_cnt,
case when category_last28day_addcart_user_cnt is null then 0
else category_last28day_addcart_user_cnt end
as category_last28day_addcart_user_cnt,
case when category_last28day_buy_user_cnt is null then 0
else category_last28day_buy_user_cnt end as category_last28day_buy_user_cnt,
case when item_last1day_click_cnt is null then 0else item_last1day_click_cnt endas item_last1day_click_cnt,
case when item_last1day_bookmark_cnt is null then 0 else item_last1day_bookmark_cnt end as item_last1day_bookmark_cnt,
case when item_last1day_addcart_cnt is null then 0else item_last1day_addcart_cnt endas item_last1day_addcart_cnt,
case when item_last1day_buy_cnt is null then 0else item_last1day_buy_cnt endas item_last1day_buy_cnt,
case when item_last3day_click_cnt is null then 0else item_last3day_click_cnt endas item_last3day_click_cnt,
case when item_last3day_bookmark_cnt is null then 0 else item_last3day_bookmark_cnt end as item_last3day_bookmark_cnt,
case when item_last3day_addcart_cnt is null then 0else item_last3day_addcart_cnt endas item_last3day_addcart_cnt,
case when item_last3day_buy_cnt is null then 0else item_last3day_buy_cnt endas item_last3day_buy_cnt,
case when item_last7day_click_cnt is null then 0else item_last7day_click_cnt endas item_last7day_click_cnt,
case when item_last7day_bookmark_cnt is null then 0 else item_last7day_bookmark_cnt end as item_last7day_bookmark_cnt,
case when item_last7day_addcart_cnt is null then 0else item_last7day_addcart_cnt endas item_last7day_addcart_cnt,
case when item_last7day_buy_cnt is null then 0else item_last7day_buy_cnt endas item_last7day_buy_cnt,
case when item_last14day_click_cnt is null then 0else item_last14day_click_cnt endas item_last14day_click_cnt,
case when item_last14day_bookmark_cnt is null then 0else item_last14day_bookmark_cnt end as item_last14day_bookmark_cnt,
case when item_last14day_addcart_cnt is null then 0else item_last14day_addcart_cnt endas item_last14day_addcart_cnt,
case when item_last14day_buy_cnt is null then 0else item_last14day_buy_cnt endas item_last14day_buy_cnt,
case when item_last21day_click_cnt is null then 0else item_last21day_click_cnt endas item_last21day_click_cnt,
case when item_last21day_bookmark_cnt is null then 0else item_last21day_bookmark_cnt end as item_last21day_bookmark_cnt,
case when item_last21day_addcart_cnt is null then 0else item_last21day_addcart_cnt endas item_last21day_addcart_cnt,
case when item_last21day_buy_cnt is null then 0else item_last21day_buy_cnt endas item_last21day_buy_cnt,
case when item_last28day_click_cnt is null then 0else item_last28day_click_cnt endas item_last28day_click_cnt,
case when item_last28day_bookmark_cnt is null then 0else item_last28day_bookmark_cnt end as item_last28day_bookmark_cnt,
case when item_last28day_addcart_cnt is null then 0else item_last28day_addcart_cnt endas item_last28day_addcart_cnt,
case when item_last28day_buy_cnt is null then 0else item_last28day_buy_cnt endas item_last28day_buy_cnt,
case when category_last1day_click_cnt is null then 0else category_last1day_click_cnt endas category_last1day_click_cnt,
case when category_last1day_bookmark_cnt is null then 0 else category_last1day_bookmark_cnt end as category_last1day_bookmark_cnt,
case when category_last1day_addcart_cnt is null then 0else category_last1day_addcart_cnt endas category_last1day_addcart_cnt,
case when category_last1day_buy_cnt is null then 0else category_last1day_buy_cnt endas category_last1day_buy_cnt,
case when category_last3day_click_cnt is null then 0else category_last3day_click_cnt endas category_last3day_click_cnt,
case when category_last3day_bookmark_cnt is null then 0 else category_last3day_bookmark_cnt end as category_last3day_bookmark_cnt,
case when category_last3day_addcart_cnt is null then 0else category_last3day_addcart_cnt endas category_last3day_addcart_cnt,
case when category_last3day_buy_cnt is null then 0else category_last3day_buy_cnt endas category_last3day_buy_cnt,
case when category_last7day_click_cnt is null then 0else category_last7day_click_cnt endas category_last7day_click_cnt,
case when category_last7day_bookmark_cnt is null then 0 else category_last7day_bookmark_cnt end as category_last7day_bookmark_cnt,
case when category_last7day_addcart_cnt is null then 0else category_last7day_addcart_cnt endas category_last7day_addcart_cnt,
case when category_last7day_buy_cnt is null then 0else category_last7day_buy_cnt endas category_last7day_buy_cnt,
case when category_last14day_click_cnt is null then 0else category_last14day_click_cnt endas category_last14day_click_cnt,
case when category_last14day_bookmark_cnt is null then 0else category_last14day_bookmark_cnt end as category_last14day_bookmark_cnt,
case when category_last14day_addcart_cnt is null then 0else category_last14day_addcart_cnt endas category_last14day_addcart_cnt,
case when category_last14day_buy_cnt is null then 0else category_last14day_buy_cnt endas category_last14day_buy_cnt,
case when category_last21day_click_cnt is null then 0else category_last21day_click_cnt endas category_last21day_click_cnt,
case when category_last21day_bookmark_cnt is null then 0else category_last21day_bookmark_cnt end as category_last21day_bookmark_cnt,
case when category_last21day_addcart_cnt is null then 0else category_last21day_addcart_cnt endas category_last21day_addcart_cnt,
case when category_last21day_buy_cnt is null then 0else category_last21day_buy_cnt endas category_last21day_buy_cnt,
case when category_last28day_click_cnt is null then 0else category_last28day_click_cnt endas category_last28day_click_cnt,
case when category_last28day_bookmark_cnt is null then 0else category_last28day_bookmark_cnt endas category_last28day_bookmark_cnt,
case when category_last28day_addcart_cnt is null then 0else category_last28day_addcart_cnt endas category_last28day_addcart_cnt,
case when category_last28day_buy_cnt is null then 0else category_last28day_buy_cnt endas category_last28day_buy_cnt,
-- 2015.06.21新增特征
case when item_last3day_mean_prior_click_next_buy_cnt is null then 0 else item_last3day_mean_prior_click_next_buy_cnt end as item_last3day_mean_prior_click_next_buy_cnt,
case when item_last3day_mean_prior_bookmark_next_buy_cnt is null then 0 else item_last3day_mean_prior_bookmark_next_buy_cnt end as item_last3day_mean_prior_bookmark_next_buy_cnt,
case when item_last3day_mean_prior_addcart_next_buy_cnt is null then 0 else item_last3day_mean_prior_addcart_next_buy_cnt end as item_last3day_mean_prior_addcart_next_buy_cnt,
case when item_last3day_mean_prior_buy_next_buy_cnt is null then 0 else item_last3day_mean_prior_buy_next_buy_cnt end as item_last3day_mean_prior_buy_next_buy_cnt,
case when item_last7day_mean_prior_click_next_buy_cnt is null then 0 else item_last7day_mean_prior_click_next_buy_cnt end as item_last7day_mean_prior_click_next_buy_cnt,
case when item_last7day_mean_prior_bookmark_next_buy_cnt is null then 0 else item_last7day_mean_prior_bookmark_next_buy_cnt end as item_last7day_mean_prior_bookmark_next_buy_cnt,
case when item_last7day_mean_prior_addcart_next_buy_cnt is null then 0 else item_last7day_mean_prior_addcart_next_buy_cnt end as item_last7day_mean_prior_addcart_next_buy_cnt,
case when item_last7day_mean_prior_buy_next_buy_cnt is null then 0 else item_last7day_mean_prior_buy_next_buy_cnt end as item_last7day_mean_prior_buy_next_buy_cnt,
case when category_last3day_mean_prior_click_next_buy_cnt is null then 0 else category_last3day_mean_prior_click_next_buy_cnt end as category_last3day_mean_prior_click_next_buy_cnt,
case when category_last3day_mean_prior_bookmark_next_buy_cnt is null then 0 else category_last3day_mean_prior_bookmark_next_buy_cnt end as category_last3day_mean_prior_bookmark_next_buy_cnt,
case when category_last3day_mean_prior_addcart_next_buy_cnt is null then 0 else category_last3day_mean_prior_addcart_next_buy_cnt end as category_last3day_mean_prior_addcart_next_buy_cnt,
case when category_last3day_mean_prior_buy_next_buy_cnt is null then 0 else category_last3day_mean_prior_buy_next_buy_cnt end as category_last3day_mean_prior_buy_next_buy_cnt,
case when category_last7day_mean_prior_click_next_buy_cnt is null then 0 else category_last7day_mean_prior_click_next_buy_cnt end as category_last7day_mean_prior_click_next_buy_cnt,
case when category_last7day_mean_prior_bookmark_next_buy_cnt is null then 0 else category_last7day_mean_prior_bookmark_next_buy_cnt end as category_last7day_mean_prior_bookmark_next_buy_cnt,
case when category_last7day_mean_prior_addcart_next_buy_cnt is null then 0 else category_last7day_mean_prior_addcart_next_buy_cnt end as category_last7day_mean_prior_addcart_next_buy_cnt,
case when category_last7day_mean_prior_buy_next_buy_cnt is null then 0 else category_last7day_mean_prior_buy_next_buy_cnt end as category_last7day_mean_prior_buy_next_buy_cnt,
--- 2015.06.22 新增特征
case when item_last28day_dumplicated_buy_user_cnt is null then 0 else item_last28day_dumplicated_buy_user_cnt end as item_last28day_dumplicated_buy_user_cnt,
case when item_last28day_dumplicated_buy_cnt is null then 0 else item_last28day_dumplicated_buy_cnt end as item_last28day_dumplicated_buy_cnt,
case when category_last28day_dumplicated_buy_user_cnt is null then 0 else category_last28day_dumplicated_buy_user_cnt end as category_last28day_dumplicated_buy_user_cnt,
case when category_last28day_dumplicated_buy_cnt is null then 0 else category_last28day_dumplicated_buy_cnt end as category_last28day_dumplicated_buy_cnt,
case when user_last1day_behavior_item_cnt is null then 0 else user_last1day_behavior_item_cnt end as user_last1day_behavior_item_cnt,
case when user_last3day_behavior_item_cnt is null then 0 else user_last3day_behavior_item_cnt end as user_last3day_behavior_item_cnt,
case when user_last7day_behavior_item_cnt is null then 0 else user_last7day_behavior_item_cnt end as user_last7day_behavior_item_cnt,
case when user_last14day_behavior_item_cnt is null then 0 else user_last14day_behavior_item_cnt end as user_last14day_behavior_item_cnt,
case when user_last21day_behavior_item_cnt is null then 0 else user_last21day_behavior_item_cnt end as user_last21day_behavior_item_cnt,
case when user_last28day_behavior_item_cnt is null then 0 else user_last28day_behavior_item_cnt end as user_last28day_behavior_item_cnt,
case when user_last1day_click_item_cnt is null then 0else user_last1day_click_item_cnt endAS user_last1day_click_item_cnt,
case when user_last1day_bookmark_item_cnt is null then 0
else user_last1day_bookmark_item_cnt end AS user_last1day_bookmark_item_cnt,
case when user_last1day_addcart_item_cnt is null then 0
else user_last1day_addcart_item_cnt end AS user_last1day_addcart_item_cnt,
case when user_last1day_buy_item_cnt is null then 0
else user_last1day_buy_item_cnt end AS user_last1day_buy_item_cnt,
case when user_last3day_click_item_cnt is null then 0else user_last3day_click_item_cnt endAS user_last3day_click_item_cnt,
case when user_last3day_bookmark_item_cnt is null then 0
else user_last3day_bookmark_item_cnt end AS user_last3day_bookmark_item_cnt,
case when user_last3day_addcart_item_cnt is null then 0
else user_last3day_addcart_item_cnt end AS user_last3day_addcart_item_cnt,
case when user_last3day_buy_item_cnt is null then 0
else user_last3day_buy_item_cnt end AS user_last3day_buy_item_cnt,
case when user_last7day_click_item_cnt is null then 0else user_last7day_click_item_cnt endAS user_last7day_click_item_cnt,
case when user_last7day_bookmark_item_cnt is null then 0
else user_last7day_bookmark_item_cnt end AS user_last7day_bookmark_item_cnt,
case when user_last7day_addcart_item_cnt is null then 0
else user_last7day_addcart_item_cnt end AS user_last7day_addcart_item_cnt,
case when user_last7day_buy_item_cnt is null then 0
else user_last7day_buy_item_cnt end AS user_last7day_buy_item_cnt,
case when user_last14day_click_item_cnt is null then 0else user_last14day_click_item_cnt endAS user_last14day_click_item_cnt,
case when user_last14day_bookmark_item_cnt is null then 0
else user_last14day_bookmark_item_cnt end AS user_last14day_bookmark_item_cnt,
case when user_last14day_addcart_item_cnt is null then 0
else user_last14day_addcart_item_cnt end AS user_last14day_addcart_item_cnt,
case when user_last14day_buy_item_cnt is null then 0
else user_last14day_buy_item_cnt end AS user_last14day_buy_item_cnt,
case when user_last21day_click_item_cnt is null then 0else user_last21day_click_item_cnt endAS user_last21day_click_item_cnt,
case when user_last21day_bookmark_item_cnt is null then 0
else user_last21day_bookmark_item_cnt end AS user_last21day_bookmark_item_cnt,
case when user_last21day_addcart_item_cnt is null then 0
else user_last21day_addcart_item_cnt end AS user_last21day_addcart_item_cnt,
case when user_last21day_buy_item_cnt is null then 0
else user_last21day_buy_item_cnt end AS user_last21day_buy_item_cnt,
case when user_last28day_click_item_cnt is null then 0
else user_last28day_click_item_cnt end AS user_last28day_click_item_cnt,
case when user_last28day_bookmark_item_cnt is null then 0
else user_last28day_bookmark_item_cnt end AS user_last28day_bookmark_item_cnt,
case when user_last28day_addcart_item_cnt is null then 0
else user_last28day_addcart_item_cnt end AS user_last28day_addcart_item_cnt,
case when user_last28day_buy_item_cnt is null then 0
else user_last28day_buy_item_cnt end AS user_last28day_buy_item_cnt,
case when user_last1day_behavior_category_cnt is null then 0 else user_last1day_behavior_category_cnt end as user_last1day_behavior_category_cnt,
case when user_last3day_behavior_category_cnt is null then 0 else user_last3day_behavior_category_cnt end as user_last3day_behavior_category_cnt,
case when user_last7day_behavior_category_cnt is null then 0 else user_last7day_behavior_category_cnt end as user_last7day_behavior_category_cnt,
case when user_last14day_behavior_category_cnt is null then 0 else user_last14day_behavior_category_cnt end as user_last14day_behavior_category_cnt,
case when user_last21day_behavior_category_cnt is null then 0 else user_last21day_behavior_category_cnt end as user_last21day_behavior_category_cnt,
case when user_last28day_behavior_category_cnt is null then 0 else user_last28day_behavior_category_cnt end as user_last28day_behavior_category_cnt,
case when user_last1day_click_category_cnt is null then 0else user_last1day_click_category_cnt endAS user_last1day_click_category_cnt,
case when user_last1day_bookmark_category_cnt is null then 0
else user_last1day_bookmark_category_cnt end
AS user_last1day_bookmark_category_cnt,
case when user_last1day_addcart_category_cnt is null then 0
else user_last1day_addcart_category_cnt end
AS user_last1day_addcart_category_cnt,
case when user_last1day_buy_category_cnt is null then 0
else user_last1day_buy_category_cnt end AS user_last1day_buy_category_cnt,
case when user_last3day_click_category_cnt is null then 0else user_last3day_click_category_cnt endAS user_last3day_click_category_cnt,
case when user_last3day_bookmark_category_cnt is null then 0
else user_last3day_bookmark_category_cnt end
AS user_last3day_bookmark_category_cnt,
case when user_last3day_addcart_category_cnt is null then 0
else user_last3day_addcart_category_cnt end
AS user_last3day_addcart_category_cnt,
case when user_last3day_buy_category_cnt is null then 0
else user_last3day_buy_category_cnt end AS user_last3day_buy_category_cnt,
case when user_last7day_click_category_cnt is null then 0else user_last7day_click_category_cnt endAS user_last7day_click_category_cnt,
case when user_last7day_bookmark_category_cnt is null then 0
else user_last7day_bookmark_category_cnt end
AS user_last7day_bookmark_category_cnt,
case when user_last7day_addcart_category_cnt is null then 0
else user_last7day_addcart_category_cnt end
AS user_last7day_addcart_category_cnt,
case when user_last7day_buy_category_cnt is null then 0
else user_last7day_buy_category_cnt end AS user_last7day_buy_category_cnt,
case when user_last14day_click_category_cnt is null then 0else user_last14day_click_category_cnt endAS user_last14day_click_category_cnt,
case when user_last14day_bookmark_category_cnt is null then 0
else user_last14day_bookmark_category_cnt end
AS user_last14day_bookmark_category_cnt,
case when user_last14day_addcart_category_cnt is null then 0
else user_last14day_addcart_category_cnt end
AS user_last14day_addcart_category_cnt,
case when user_last14day_buy_category_cnt is null then 0
else user_last14day_buy_category_cnt end AS user_last14day_buy_category_cnt,
case when user_last21day_click_category_cnt is null then 0else user_last21day_click_category_cnt endAS user_last21day_click_category_cnt,
case when user_last21day_bookmark_category_cnt is null then 0
else user_last21day_bookmark_category_cnt end
AS user_last21day_bookmark_category_cnt,
case when user_last21day_addcart_category_cnt is null then 0
else user_last21day_addcart_category_cnt end
AS user_last21day_addcart_category_cnt,
case when user_last21day_buy_category_cnt is null then 0
else user_last21day_buy_category_cnt end AS user_last21day_buy_category_cnt,
case when user_last28day_click_category_cnt is null then 0else user_last28day_click_category_cnt endAS user_last28day_click_category_cnt,
case when user_last28day_bookmark_category_cnt is null then 0
else user_last28day_bookmark_category_cnt end
AS user_last28day_bookmark_category_cnt,
case when user_last28day_addcart_category_cnt is null then 0
else user_last28day_addcart_category_cnt end
AS user_last28day_addcart_category_cnt,
case when user_last28day_buy_category_cnt is null then 0
else user_last28day_buy_category_cnt end AS user_last28day_buy_category_cnt,
case when user_last1day_click_cnt is null then 0else user_last1day_click_cnt endas user_last1day_click_cnt,
case when user_last1day_bookmark_cnt is null then 0 else user_last1day_bookmark_cnt end as user_last1day_bookmark_cnt,
case when user_last1day_addcart_cnt is null then 0else user_last1day_addcart_cnt endas user_last1day_addcart_cnt,
case when user_last1day_buy_cnt is null then 0else user_last1day_buy_cnt endas user_last1day_buy_cnt,
case when user_last3day_click_cnt is null then 0else user_last3day_click_cnt endas user_last3day_click_cnt,
case when user_last3day_bookmark_cnt is null then 0 else user_last3day_bookmark_cnt end as user_last3day_bookmark_cnt,
case when user_last3day_addcart_cnt is null then 0else user_last3day_addcart_cnt endas user_last3day_addcart_cnt,
case when user_last3day_buy_cnt is null then 0else user_last3day_buy_cnt endas user_last3day_buy_cnt,
case when user_last7day_click_cnt is null then 0else user_last7day_click_cnt endas user_last7day_click_cnt,
case when user_last7day_bookmark_cnt is null then 0 else user_last7day_bookmark_cnt end as user_last7day_bookmark_cnt,
case when user_last7day_addcart_cnt is null then 0else user_last7day_addcart_cnt endas user_last7day_addcart_cnt,
case when user_last7day_buy_cnt is null then 0else user_last7day_buy_cnt endas user_last7day_buy_cnt,
case when user_last14day_click_cnt is null then 0else user_last14day_click_cnt endas user_last14day_click_cnt,
case when user_last14day_bookmark_cnt is null then 0 else user_last14day_bookmark_cnt end as user_last14day_bookmark_cnt,
case when user_last14day_addcart_cnt is null then 0else user_last14day_addcart_cnt endas user_last14day_addcart_cnt,
case when user_last14day_buy_cnt is null then 0else user_last14day_buy_cnt endas user_last14day_buy_cnt,
case when user_last21day_click_cnt is null then 0else user_last21day_click_cnt endas user_last21day_click_cnt,
case when user_last21day_bookmark_cnt is null then 0 else user_last21day_bookmark_cnt end as user_last21day_bookmark_cnt,
case when user_last21day_addcart_cnt is null then 0else user_last21day_addcart_cnt endas user_last21day_addcart_cnt,
case when user_last21day_buy_cnt is null then 0else user_last21day_buy_cnt endas user_last21day_buy_cnt,
case when user_last28day_click_cnt is null then 0else user_last28day_click_cnt endas user_last28day_click_cnt,
case when user_last28day_bookmark_cnt is null then 0 else user_last28day_bookmark_cnt end as user_last28day_bookmark_cnt,
case when user_last28day_addcart_cnt is null then 0else user_last28day_addcart_cnt endas user_last28day_addcart_cnt,
case when user_last28day_buy_cnt is null then 0else user_last28day_buy_cnt endas user_last28day_buy_cnt,
case when user_last28day_click_diff_day_cnt is null then 0 else user_last28day_click_diff_day_cnt end as user_last28day_click_diff_day_cnt,
case when user_last28day_bookmark_diff_day_cnt is null then 0 else user_last28day_bookmark_diff_day_cnt end as user_last28day_bookmark_diff_day_cnt,
case when user_last28day_addcart_diff_day_cnt is null then 0 else user_last28day_addcart_diff_day_cnt end as user_last28day_addcart_diff_day_cnt,
case when user_last28day_buy_diff_day_cnt is null then 0 else user_last28day_buy_diff_day_cnt end as user_last28day_buy_diff_day_cnt,
case when user_last28day_behavior_diff_day_cnt is null then 0 else user_last28day_behavior_diff_day_cnt end as user_last28day_behavior_diff_day_cnt,
case when user_last1hour_behavior_diff_item_cnt is null then 0 else user_last1hour_behavior_diff_item_cnt end as user_last1hour_behavior_diff_item_cnt,
case when user_last2hour_behavior_diff_item_cnt is null then 0 else user_last2hour_behavior_diff_item_cnt end as user_last2hour_behavior_diff_item_cnt,
case when user_last3hour_behavior_diff_item_cnt is null then 0 else user_last3hour_behavior_diff_item_cnt end as user_last3hour_behavior_diff_item_cnt,
case when user_last4hour_behavior_diff_item_cnt is null then 0 else user_last4hour_behavior_diff_item_cnt end as user_last4hour_behavior_diff_item_cnt,
case when user_last9hour_behavior_diff_item_cnt is null then 0 else user_last9hour_behavior_diff_item_cnt end as user_last9hour_behavior_diff_item_cnt,
case when user_last15hour_behavior_diff_item_cnt is null then 0 else user_last15hour_behavior_diff_item_cnt end as user_last15hour_behavior_diff_item_cnt,
case when user_last1hour_behavior_diff_category_cnt is null then 0 else user_last1hour_behavior_diff_category_cnt end as user_last1hour_behavior_diff_category_cnt,
case when user_last2hour_behavior_diff_category_cnt is null then 0 else user_last2hour_behavior_diff_category_cnt end as user_last2hour_behavior_diff_category_cnt,
case when user_last3hour_behavior_diff_category_cnt is null then 0 else user_last3hour_behavior_diff_category_cnt end as user_last3hour_behavior_diff_category_cnt,
case when user_last4hour_behavior_diff_category_cnt is null then 0 else user_last4hour_behavior_diff_category_cnt end as user_last4hour_behavior_diff_category_cnt,
case when user_last9hour_behavior_diff_category_cnt is null then 0 else user_last9hour_behavior_diff_category_cnt end as user_last9hour_behavior_diff_category_cnt,
case when user_last15hour_behavior_diff_category_cnt is null then 0 else user_last15hour_behavior_diff_category_cnt end as user_last15hour_behavior_diff_category_cnt,
case when user_last1hour_click_diff_item_cnt is null then 0else user_last1hour_click_diff_item_cnt endas user_last1hour_click_diff_item_cnt,
case when user_last1hour_bookmark_diff_item_cnt is null then 0else user_last1hour_bookmark_diff_item_cnt endas user_last1hour_bookmark_diff_item_cnt,
case when user_last1hour_addcart_diff_item_cnt is null then 0else user_last1hour_addcart_diff_item_cnt endas user_last1hour_addcart_diff_item_cnt,
case when user_last1hour_buy_diff_item_cnt is null then 0else user_last1hour_buy_diff_item_cnt endas user_last1hour_buy_diff_item_cnt,
case when user_last1hour_click_diff_category_cnt is null then 0else user_last1hour_click_diff_category_cnt endas user_last1hour_click_diff_category_cnt,
case when user_last1hour_bookmark_diff_category_cnt is null then 0else user_last1hour_bookmark_diff_category_cnt endas user_last1hour_bookmark_diff_category_cnt,
case when user_last1hour_addcart_diff_category_cnt is null then 0else user_last1hour_addcart_diff_category_cnt endas user_last1hour_addcart_diff_category_cnt,
case when user_last1hour_buy_diff_category_cnt is null then 0else user_last1hour_buy_diff_category_cnt endas user_last1hour_buy_diff_category_cnt,
case when user_last2hour_click_diff_item_cnt is null then 0else user_last2hour_click_diff_item_cnt endas user_last2hour_click_diff_item_cnt,
case when user_last2hour_bookmark_diff_item_cnt is null then 0else user_last2hour_bookmark_diff_item_cnt endas user_last2hour_bookmark_diff_item_cnt,
case when user_last2hour_addcart_diff_item_cnt is null then 0else user_last2hour_addcart_diff_item_cnt endas user_last2hour_addcart_diff_item_cnt,
case when user_last2hour_buy_diff_item_cnt is null then 0else user_last2hour_buy_diff_item_cnt endas user_last2hour_buy_diff_item_cnt,
case when user_last2hour_click_diff_category_cnt is null then 0else user_last2hour_click_diff_category_cnt endas user_last2hour_click_diff_category_cnt,
case when user_last2hour_bookmark_diff_category_cnt is null then 0else user_last2hour_bookmark_diff_category_cnt endas user_last2hour_bookmark_diff_category_cnt,
case when user_last2hour_addcart_diff_category_cnt is null then 0else user_last2hour_addcart_diff_category_cnt endas user_last2hour_addcart_diff_category_cnt,
case when user_last2hour_buy_diff_category_cnt is null then 0else user_last2hour_buy_diff_category_cnt endas user_last2hour_buy_diff_category_cnt,
case when user_last3hour_click_diff_item_cnt is null then 0else user_last3hour_click_diff_item_cnt endas user_last3hour_click_diff_item_cnt,
case when user_last3hour_bookmark_diff_item_cnt is null then 0else user_last3hour_bookmark_diff_item_cnt endas user_last3hour_bookmark_diff_item_cnt,
case when user_last3hour_addcart_diff_item_cnt is null then 0else user_last3hour_addcart_diff_item_cnt endas user_last3hour_addcart_diff_item_cnt,
case when user_last3hour_buy_diff_item_cnt is null then 0else user_last3hour_buy_diff_item_cnt endas user_last3hour_buy_diff_item_cnt,
case when user_last3hour_click_diff_category_cnt is null then 0else user_last3hour_click_diff_category_cnt endas user_last3hour_click_diff_category_cnt,
case when user_last3hour_bookmark_diff_category_cnt is null then 0else user_last3hour_bookmark_diff_category_cnt endas user_last3hour_bookmark_diff_category_cnt,
case when user_last3hour_addcart_diff_category_cnt is null then 0else user_last3hour_addcart_diff_category_cnt endas user_last3hour_addcart_diff_category_cnt,
case when user_last3hour_buy_diff_category_cnt is null then 0else user_last3hour_buy_diff_category_cnt endas user_last3hour_buy_diff_category_cnt,
case when user_last4hour_click_diff_item_cnt is null then 0else user_last4hour_click_diff_item_cnt endas user_last4hour_click_diff_item_cnt,
case when user_last4hour_bookmark_diff_item_cnt is null then 0else user_last4hour_bookmark_diff_item_cnt endas user_last4hour_bookmark_diff_item_cnt,
case when user_last4hour_addcart_diff_item_cnt is null then 0else user_last4hour_addcart_diff_item_cnt endas user_last4hour_addcart_diff_item_cnt,
case when user_last4hour_buy_diff_item_cnt is null then 0else user_last4hour_buy_diff_item_cnt endas user_last4hour_buy_diff_item_cnt,
case when user_last4hour_click_diff_category_cnt is null then 0else user_last4hour_click_diff_category_cnt endas user_last4hour_click_diff_category_cnt,
case when user_last4hour_bookmark_diff_category_cnt is null then 0else user_last4hour_bookmark_diff_category_cnt endas user_last4hour_bookmark_diff_category_cnt,
case when user_last4hour_addcart_diff_category_cnt is null then 0else user_last4hour_addcart_diff_category_cnt endas user_last4hour_addcart_diff_category_cnt,
case when user_last4hour_buy_diff_category_cnt is null then 0else user_last4hour_buy_diff_category_cnt endas user_last4hour_buy_diff_category_cnt,
case when user_last9hour_click_diff_item_cnt is null then 0else user_last9hour_click_diff_item_cnt endas user_last9hour_click_diff_item_cnt,
case when user_last9hour_bookmark_diff_item_cnt is null then 0else user_last9hour_bookmark_diff_item_cnt endas user_last9hour_bookmark_diff_item_cnt,
case when user_last9hour_addcart_diff_item_cnt is null then 0else user_last9hour_addcart_diff_item_cnt endas user_last9hour_addcart_diff_item_cnt,
case when user_last9hour_buy_diff_item_cnt is null then 0else user_last9hour_buy_diff_item_cnt endas user_last9hour_buy_diff_item_cnt,
case when user_last9hour_click_diff_category_cnt is null then 0else user_last9hour_click_diff_category_cnt endas user_last9hour_click_diff_category_cnt,
case when user_last9hour_bookmark_diff_category_cnt is null then 0else user_last9hour_bookmark_diff_category_cnt endas user_last9hour_bookmark_diff_category_cnt,
case when user_last9hour_addcart_diff_category_cnt is null then 0else user_last9hour_addcart_diff_category_cnt endas user_last9hour_addcart_diff_category_cnt,
case when user_last9hour_buy_diff_category_cnt is null then 0else user_last9hour_buy_diff_category_cnt endas user_last9hour_buy_diff_category_cnt,
case when user_last15hour_click_diff_item_cnt is null then 0else user_last15hour_click_diff_item_cnt endas user_last15hour_click_diff_item_cnt,
case when user_last15hour_bookmark_diff_item_cnt is null then 0else user_last15hour_bookmark_diff_item_cnt endas user_last15hour_bookmark_diff_item_cnt,
case when user_last15hour_addcart_diff_item_cnt is null then 0else user_last15hour_addcart_diff_item_cnt endas user_last15hour_addcart_diff_item_cnt,
case when user_last15hour_buy_diff_item_cnt is null then 0else user_last15hour_buy_diff_item_cnt endas user_last15hour_buy_diff_item_cnt,
case when user_last15hour_click_diff_category_cnt is null then 0else user_last15hour_click_diff_category_cnt endas user_last15hour_click_diff_category_cnt,
case when user_last15hour_bookmark_diff_category_cnt is null then 0else user_last15hour_bookmark_diff_category_cnt endas user_last15hour_bookmark_diff_category_cnt,
case when user_last15hour_addcart_diff_category_cnt is null then 0else user_last15hour_addcart_diff_category_cnt endas user_last15hour_addcart_diff_category_cnt,
case when user_last15hour_buy_diff_category_cnt is null then 0else user_last15hour_buy_diff_category_cnt endas user_last15hour_buy_diff_category_cnt,
-- 2021.06.21新增特征
case when user_last3day_mean_prior_click_next_buy_cnt is null then 0else user_last3day_mean_prior_click_next_buy_cnt endas user_last3day_mean_prior_click_next_buy_cnt,
case when user_last3day_mean_prior_bookmark_next_buy_cnt is null then 0else user_last3day_mean_prior_bookmark_next_buy_cnt endas user_last3day_mean_prior_bookmark_next_buy_cnt,
case when user_last3day_mean_prior_addcart_next_buy_cnt is null then 0else user_last3day_mean_prior_addcart_next_buy_cnt endas user_last3day_mean_prior_addcart_next_buy_cnt,
case when user_last3day_mean_prior_buy_next_buy_cnt is null then 0else user_last3day_mean_prior_buy_next_buy_cnt endas user_last3day_mean_prior_buy_next_buy_cnt,
case when user_last7day_mean_prior_click_next_buy_cnt is null then 0else user_last7day_mean_prior_click_next_buy_cnt endas user_last7day_mean_prior_click_next_buy_cnt,
case when user_last7day_mean_prior_bookmark_next_buy_cnt is null then 0else user_last7day_mean_prior_bookmark_next_buy_cnt endas user_last7day_mean_prior_bookmark_next_buy_cnt,
case when user_last7day_mean_prior_addcart_next_buy_cnt is null then 0else user_last7day_mean_prior_addcart_next_buy_cnt endas user_last7day_mean_prior_addcart_next_buy_cnt,
case when user_last7day_mean_prior_buy_next_buy_cnt is null then 0else user_last7day_mean_prior_buy_next_buy_cnt endas user_last7day_mean_prior_buy_next_buy_cnt,
case when user_hierarchy_behavior_rate is null then 0 else user_hierarchy_behavior_rate end as user_hierarchy_behavior_rate,
case when user_hierarchy_log_behavior_rate is null then 0 else user_hierarchy_log_behavior_rate end as user_hierarchy_log_behavior_rate,
case when user_active_rate is null then 0 else user_active_rate end as user_active_rate,
case when ui_last1day_click_cnt is NULL then 0 else ui_last1day_click_cnt end AS ui_last1day_click_cnt,
case when ui_last1day_bookmark_cnt is NULL then 0 else ui_last1day_bookmark_cnt end AS ui_last1day_bookmark_cnt,
case when ui_last1day_addcart_cnt is NULL then 0 else ui_last1day_addcart_cnt end AS ui_last1day_addcart_cnt,
case when ui_last1day_buy_cnt is NULL then 0 else ui_last1day_buy_cnt end AS ui_last1day_buy_cnt,
case when ui_last3day_click_cnt is NULL then 0 else ui_last3day_click_cnt end AS ui_last3day_click_cnt,
case when ui_last3day_bookmark_cnt is NULL then 0 else ui_last3day_bookmark_cnt end AS ui_last3day_bookmark_cnt,
case when ui_last3day_addcart_cnt is NULL then 0 else ui_last3day_addcart_cnt end AS ui_last3day_addcart_cnt,
case when ui_last3day_buy_cnt is NULL then 0 else ui_last3day_buy_cnt end AS ui_last3day_buy_cnt,
case when ui_last7day_click_cnt is NULL then 0 else ui_last7day_click_cnt end AS ui_last7day_click_cnt,
case when ui_last7day_bookmark_cnt is NULL then 0 else ui_last7day_bookmark_cnt end AS ui_last7day_bookmark_cnt,
case when ui_last7day_addcart_cnt is NULL then 0 else ui_last7day_addcart_cnt end AS ui_last7day_addcart_cnt,
case when ui_last7day_buy_cnt is NULL then 0 else ui_last7day_buy_cnt end AS ui_last7day_buy_cnt,
case when ui_last14day_click_cnt is NULL then 0 else ui_last14day_click_cnt end AS ui_last14day_click_cnt,
case when ui_last14day_bookmark_cnt is NULL then 0 else ui_last14day_bookmark_cnt end AS ui_last14day_bookmark_cnt,
case when ui_last14day_addcart_cnt is NULL then 0 else ui_last14day_addcart_cnt end AS ui_last14day_addcart_cnt,
case when ui_last14day_buy_cnt is NULL then 0 else ui_last14day_buy_cnt end AS ui_last14day_buy_cnt,
case when ui_last21day_click_cnt is NULL then 0 else ui_last21day_click_cnt end AS ui_last21day_click_cnt,
case when ui_last21day_bookmark_cnt is NULL then 0 else ui_last21day_bookmark_cnt end AS ui_last21day_bookmark_cnt,
case when ui_last21day_addcart_cnt is NULL then 0 else ui_last21day_addcart_cnt end AS ui_last21day_addcart_cnt,
case when ui_last21day_buy_cnt is NULL then 0 else ui_last21day_buy_cnt end AS ui_last21day_buy_cnt,
case when ui_last28day_click_cnt is NULL then 0 else ui_last28day_click_cnt end AS ui_last28day_click_cnt,
case when ui_last28day_bookmark_cnt is NULL then 0 else ui_last28day_bookmark_cnt end AS ui_last28day_bookmark_cnt,
case when ui_last28day_addcart_cnt is NULL then 0 else ui_last28day_addcart_cnt end AS ui_last28day_addcart_cnt,
case when ui_last28day_buy_cnt is NULL then 0 else ui_last28day_buy_cnt end AS ui_last28day_buy_cnt,
case when ui_lastday_click_hour_cnt is NULL then 0 else ui_lastday_click_hour_cnt end AS ui_lastday_click_hour_cnt,
case when ui_lastday_bookmark_hour_cnt is NULL then 0 else ui_lastday_bookmark_hour_cnt end AS ui_lastday_bookmark_hour_cnt,
case when ui_lastday_addcart_hour_cnt is NULL then 0 else ui_lastday_addcart_hour_cnt end AS ui_lastday_addcart_hour_cnt,
case when ui_lastday_buy_hour_cnt is NULL then 0 else ui_lastday_buy_hour_cnt end AS ui_lastday_buy_hour_cnt,
case when ui_lastday_behavior_hour_cnt is NULL then 0 else ui_lastday_behavior_hour_cnt end AS ui_lastday_behavior_hour_cnt,
case when uc_lastday_click_hour_cnt is NULL then 0 else uc_lastday_click_hour_cnt end AS uc_lastday_click_hour_cnt,
case when uc_lastday_bookmark_hour_cnt is NULL then 0 else uc_lastday_bookmark_hour_cnt end AS uc_lastday_bookmark_hour_cnt,
case when uc_lastday_addcart_hour_cnt is NULL then 0 else uc_lastday_addcart_hour_cnt end AS uc_lastday_addcart_hour_cnt,
case when uc_lastday_buy_hour_cnt is NULL then 0 else uc_lastday_buy_hour_cnt end AS uc_lastday_buy_hour_cnt,
case when uc_lastday_behavior_hour_cnt is NULL then 0 else uc_lastday_behavior_hour_cnt end AS uc_lastday_behavior_hour_cnt,
case when ui_last_click_day_dist is null then 28+1 else ui_last_click_day_dist end as ui_last_click_day_dist,
case when ui_last_bookmark_day_dist is null then 28+1 else ui_last_bookmark_day_dist end as ui_last_bookmark_day_dist,
case when ui_last_addcart_day_dist is null then 28+1 else ui_last_addcart_day_dist end as ui_last_addcart_day_dist,
case when ui_last_buy_day_dist is null then 28+1 else ui_last_buy_day_dist end as ui_last_buy_day_dist,
case when ui_last_behavior_day_dist is null then 28+1 else ui_last_behavior_day_dist end as ui_last_behavior_day_dist,
case when ui_first_click_day_dist is null then 28+1 else ui_first_click_day_dist end as ui_first_click_day_dist,
case when ui_first_bookmark_day_dist is null then 28+1 else ui_first_bookmark_day_dist end as ui_first_bookmark_day_dist,
case when ui_first_addcart_day_dist is null then 28+1 else ui_first_addcart_day_dist end as ui_first_addcart_day_dist,
case when ui_first_buy_day_dist is null then 28+1 else ui_first_buy_day_dist end as ui_first_buy_day_dist,
case when ui_first_behavior_day_dist is null then 28+1 else ui_first_behavior_day_dist end as ui_first_behavior_day_dist,
case when ui_last_click_hour_dist is null then 24*(28+1) else ui_last_click_hour_dist end as ui_last_click_hour_dist,
case when ui_last_bookmark_hour_dist is null then 24*(28+1) else ui_last_bookmark_hour_dist end as ui_last_bookmark_hour_dist,
case when ui_last_addcart_hour_dist is null then 24*(28+1) else ui_last_addcart_hour_dist end as ui_last_addcart_hour_dist,
case when ui_last_buy_hour_dist is null then 24*(28+1) else ui_last_buy_hour_dist end as ui_last_buy_hour_dist,
case when ui_last_behavior_hour_dist is null then 24*(28+1) else ui_last_behavior_hour_dist end as ui_last_behavior_hour_dist,
case when ui_first_click_hour_dist is null then 24*(28+1) else ui_first_click_hour_dist end as ui_first_click_hour_dist,
case when ui_first_bookmark_hour_dist is null then 24*(28+1) else ui_first_bookmark_hour_dist end as ui_first_bookmark_hour_dist,
case when ui_first_addcart_hour_dist is null then 24*(28+1) else ui_first_addcart_hour_dist end as ui_first_addcart_hour_dist,
case when ui_first_buy_hour_dist is null then 24*(28+1) else ui_first_buy_hour_dist end as ui_first_buy_hour_dist,
case when ui_first_behavior_hour_dist is null then 24*(28+1) else ui_first_behavior_hour_dist end as ui_first_behavior_hour_dist,
case when ui_each_buy_avg_day_dist is null then 28+1 else ui_each_buy_avg_day_dist end as ui_each_buy_avg_day_dist,
case when ui_each_buy_stddev_day_dist is null then 28+1 else ui_each_buy_stddev_day_dist end as ui_each_buy_stddev_day_dist,
---- 2021.06.07 新增特征
case when ui_ever_buy_flag is null then 0 else ui_ever_buy_flag end as ui_ever_buy_flag,
case when ui_lastday_most_important_behavior_type is null then 0 else ui_lastday_most_important_behavior_type end as ui_lastday_most_important_behavior_type,
-- 2021.06.08 新增特征
case when ui_last1day_category_click_cnt is null then 0 else ui_last1day_category_click_cnt end as ui_last1day_category_click_cnt,
case when ui_last1day_category_bookmark_cnt is null then 0 else ui_last1day_category_bookmark_cnt end as ui_last1day_category_bookmark_cnt,
case when ui_last1day_category_addcart_cnt is null then 0 else ui_last1day_category_addcart_cnt end as ui_last1day_category_addcart_cnt,
case when ui_last1day_category_buy_cnt is null then 0 else ui_last1day_category_buy_cnt end as ui_last1day_category_buy_cnt,
case when ui_last3day_category_click_cnt is null then 0 else ui_last3day_category_click_cnt end as ui_last3day_category_click_cnt,
case when ui_last3day_category_bookmark_cnt is null then 0 else ui_last3day_category_bookmark_cnt end as ui_last3day_category_bookmark_cnt,
case when ui_last3day_category_addcart_cnt is null then 0 else ui_last3day_category_addcart_cnt end as ui_last3day_category_addcart_cnt,
case when ui_last3day_category_buy_cnt is null then 0 else ui_last3day_category_buy_cnt end as ui_last3day_category_buy_cnt,
case when ui_last7day_category_click_cnt is null then 0 else ui_last7day_category_click_cnt end as ui_last7day_category_click_cnt,
case when ui_last7day_category_bookmark_cnt is null then 0 else ui_last7day_category_bookmark_cnt end as ui_last7day_category_bookmark_cnt,
case when ui_last7day_category_addcart_cnt is null then 0 else ui_last7day_category_addcart_cnt end as ui_last7day_category_addcart_cnt,
case when ui_last7day_category_buy_cnt is null then 0 else ui_last7day_category_buy_cnt end as ui_last7day_category_buy_cnt,
case when ui_last14day_category_click_cnt is null then 0 else ui_last14day_category_click_cnt end as ui_last14day_category_click_cnt,
case when ui_last14day_category_bookmark_cnt is null then 0 else ui_last14day_category_bookmark_cnt end as ui_last14day_category_bookmark_cnt,
case when ui_last14day_category_addcart_cnt is null then 0 else ui_last14day_category_addcart_cnt end as ui_last14day_category_addcart_cnt,
case when ui_last14day_category_buy_cnt is null then 0 else ui_last14day_category_buy_cnt end as ui_last14day_category_buy_cnt,
case when ui_last21day_category_click_cnt is null then 0 else ui_last21day_category_click_cnt end as ui_last21day_category_click_cnt,
case when ui_last21day_category_bookmark_cnt is null then 0 else ui_last21day_category_bookmark_cnt end as ui_last21day_category_bookmark_cnt,
case when ui_last21day_category_addcart_cnt is null then 0 else ui_last21day_category_addcart_cnt end as ui_last21day_category_addcart_cnt,
case when ui_last21day_category_buy_cnt is null then 0 else ui_last21day_category_buy_cnt end as ui_last21day_category_buy_cnt,
case when ui_last28day_category_click_cnt is null then 0 else ui_last28day_category_click_cnt end as ui_last28day_category_click_cnt,
case when ui_last28day_category_bookmark_cnt is null then 0 else ui_last28day_category_bookmark_cnt end as ui_last28day_category_bookmark_cnt,
case when ui_last28day_category_addcart_cnt is null then 0 else ui_last28day_category_addcart_cnt end as ui_last28day_category_addcart_cnt,
case when ui_last28day_category_buy_cnt is null then 0 else ui_last28day_category_buy_cnt end as ui_last28day_category_buy_cnt,
case when ui_diff_click_day_cnt is null then 0 else ui_diff_click_day_cnt end as ui_diff_click_day_cnt,
case when ui_diff_bookmark_day_cnt is null then 0 else ui_diff_bookmark_day_cnt end as ui_diff_bookmark_day_cnt,
case when ui_diff_addcart_day_cnt is null then 0 else ui_diff_addcart_day_cnt end as ui_diff_addcart_day_cnt,
case when ui_diff_buy_day_cnt is null then 0 else ui_diff_buy_day_cnt end as ui_diff_buy_day_cnt,
case when ui_diff_behavior_day_cnt is null then 0 else ui_diff_behavior_day_cnt end as ui_diff_behavior_day_cnt,
case when uc_diff_click_day_cnt is null then 0 else uc_diff_click_day_cnt end as uc_diff_click_day_cnt,
case when uc_diff_bookmark_day_cnt is null then 0 else uc_diff_bookmark_day_cnt end as uc_diff_bookmark_day_cnt,
case when uc_diff_addcart_day_cnt is null then 0 else uc_diff_addcart_day_cnt end as uc_diff_addcart_day_cnt,
case when uc_diff_buy_day_cnt is null then 0 else uc_diff_buy_day_cnt end as uc_diff_buy_day_cnt,
case when uc_diff_behavior_day_cnt is null then 0 else uc_diff_behavior_day_cnt end as uc_diff_behavior_day_cnt
FROM
(
SELECT in_t1.user_id,in_t1.item_id,in_t1.item_category
FROM
t_dh_online_train_base_ui in_t1
LEFT OUTER JOIN
(
SELECT user_id FROM t_dh_filter_user_list
)in_t2
ON in_t1.user_id = in_t2.user_id
LEFT OUTER JOIN
(
SELECT item_id FROM t_dh_filter_item_list
)in_t3
ON in_t1.item_id = in_t3.item_id
WHERE
in_t2.user_id is null and in_t3.item_id is null
)t1
LEFT OUTER JOIN
(
SELECT user_id,item_id, 1 as buy_label FROM t_dh_user_actions_subset
WHERE behavior_type = 4 AND day_index_num = 29+1
GROUP BY user_id,item_id
)t2
ON t1.user_id = t2.user_id AND t1.item_id = t2.item_id
LEFT OUTER JOIN
t_dh_online_train_item_feature t3
ON t1.item_id = t3.item_id
LEFT OUTER JOIN
t_dh_online_train_user_feature t4
ON t1.user_id = t4.user_id
LEFT OUTER JOIN
t_dh_online_train_ui_feature t5
ON t1.user_id = t5.user_id AND t1.item_id = t5.item_id
)t
)out_t
;
以上是关于天池竞赛系列阿里移动推荐算法思路解析的主要内容,如果未能解决你的问题,请参考以下文章
天池移动推荐算法赛--https://github.com/PnYuan/Tianchi-BigData