赛题地址: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)
首先我们可以划分特征类别,比如分为用户—商品类特征,用户—商品类别类特征,商品—商品类别特征,商品类特征,用户类特征,商品类别类特征,交叉特征(各种特征进行有意义的交叉乘除)等几个方面。
特征划分粒度问题:可以划分为月,周,天,小时,当然小时取值24个多了点,可以进行切片,在做过初步数据统计之后会发现购买时间热段和冷段,来适当调整时间片长度。
模型融合问题:多模型融合效果会较单模型有提升,当然特征够好的情况下提升不太明显。融合方法一般是多次不同比例不同采样不同参数不同模型不同权值融合。另一个思路是做级联,也就是先用训练预测数据都超级快的LR,把正负样本比例调到1:1或者1:2之类的,为啥比例是这样呢,可以先自己思考下。因为在这里比例会将80%未购买的样本过滤掉(实际上90%都有可能)而且过滤掉的未购买样本实际上也确实是没购买的。这样有助于提高后面GBDT等决策树模型的精度。
补充点重要的东西:不要盲目迷信哪种算法吊什么的,没有最吊的算法,只有更吊的思路,思路决定一切,这一切都反应在特征和一些细节上。我们队踩过的一些坑大概就是没用MR,也不会MR,没做预处理,没做特征选择,没设计时间切片的特征,倒是设计了1000+没用的特征,结果GBDT只支持800,就随便扔了800个进去,结果可想而知。
我们队的成绩在第一赛季是10.06%分
第二赛季是7.7%分
很遗憾没进前50,最后奉上3位决赛前10名大神的特征,感谢他们提供的特征方案。如果这三位大神看到了介意的话跟我说声。
以下是阿里移动推荐算法用到的特征、如无特别说明,则每项特征都是以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
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 | | |
+------------------------------------------------------------------------------------+
DROP TABLE IF EXISTS t_dh_ouyang_online_train_all_features;
CREATE TABLE t_dh_ouyang_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 = 0
then 0 else ui_last28day_category_bookmark_cnt/user_last28day_bookmark_category_cnt
end 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 = 0
then 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的点击数-用户A对操作过的品牌的平均点击数)/用户A对操作过的品牌的平均点击数
-- (用户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 0
else item_last1day_behavior_user_cnt end
as item_last1day_behavior_user_cnt,
case when item_last3day_behavior_user_cnt is null then 0
else item_last3day_behavior_user_cnt end
as item_last3day_behavior_user_cnt,
case when item_last7day_behavior_user_cnt is null then 0
else item_last7day_behavior_user_cnt end
as item_last7day_behavior_user_cnt,
case when item_last14day_behavior_user_cnt is null then 0
else item_last14day_behavior_user_cnt end
as item_last14day_behavior_user_cnt,
case when item_last21day_behavior_user_cnt is null then 0
else item_last21day_behavior_user_cnt end
as item_last21day_behavior_user_cnt,
case when item_last28day_behavior_user_cnt is null then 0
else item_last28day_behavior_user_cnt end
as item_last28day_behavior_user_cnt,
case when category_last1day_behavior_user_cnt is null then 0
else category_last1day_behavior_user_cnt end
as category_last1day_behavior_user_cnt,
case when category_last3day_behavior_user_cnt is null then 0
else category_last3day_behavior_user_cnt end
as category_last3day_behavior_user_cnt,
case when category_last7day_behavior_user_cnt is null then 0
else category_last7day_behavior_user_cnt end
as category_last7day_behavior_user_cnt,
case when category_last14day_behavior_user_cnt is null then 0
else category_last14day_behavior_user_cnt end
as category_last14day_behavior_user_cnt,
case when category_last21day_behavior_user_cnt is null then 0
else category_last21day_behavior_user_cnt end
as category_last21day_behavior_user_cnt,
case when category_last28day_behavior_user_cnt is null then 0
else category_last28day_behavior_user_cnt end
as 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 0
else item_last3day_click_user_cnt end
as 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 0
else item_last7day_click_user_cnt end
as 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 0
else item_last14day_click_user_cnt end
as 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 0
else item_last21day_click_user_cnt end
as 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 0
else item_last28day_click_user_cnt end
as 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 0
else category_last1day_click_user_cnt end
as 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 0
else category_last3day_click_user_cnt end
as 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 0
else category_last7day_click_user_cnt end
as 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 0
else category_last14day_click_user_cnt end
as 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 0
else category_last21day_click_user_cnt end
as 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 0
else category_last28day_click_user_cnt end
as 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 0
else item_last1day_click_cnt end
as 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 0
else item_last1day_addcart_cnt end
as item_last1day_addcart_cnt,
case when item_last1day_buy_cnt is null then 0
else item_last1day_buy_cnt end
as item_last1day_buy_cnt,
case when item_last3day_click_cnt is null then 0
else item_last3day_click_cnt end
as 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 0
else item_last3day_addcart_cnt end
as item_last3day_addcart_cnt,
case when item_last3day_buy_cnt is null then 0
else item_last3day_buy_cnt end
as item_last3day_buy_cnt,
case when item_last7day_click_cnt is null then 0
else item_last7day_click_cnt end
as 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 0
else item_last7day_addcart_cnt end
as item_last7day_addcart_cnt,
case when item_last7day_buy_cnt is null then 0
else item_last7day_buy_cnt end
as item_last7day_buy_cnt,
case when item_last14day_click_cnt is null then 0
else item_last14day_click_cnt end
as item_last14day_click_cnt,
case when item_last14day_bookmark_cnt is null then 0
else item_last14day_bookmark_cnt end as item_last14day_bookmark_cnt,
case when item_last14day_addcart_cnt is null then 0
else item_last14day_addcart_cnt end
as item_last14day_addcart_cnt,
case when item_last14day_buy_cnt is null then 0
else item_last14day_buy_cnt end
as item_last14day_buy_cnt,
case when item_last21day_click_cnt is null then 0
else item_last21day_click_cnt end
as item_last21day_click_cnt,
case when item_last21day_bookmark_cnt is null then 0
else item_last21day_bookmark_cnt end as item_last21day_bookmark_cnt,
case when item_last21day_addcart_cnt is null then 0
else item_last21day_addcart_cnt end
as item_last21day_addcart_cnt,
case when item_last21day_buy_cnt is null then 0
else item_last21day_buy_cnt end
as item_last21day_buy_cnt,
case when item_last28day_click_cnt is null then 0
else item_last28day_click_cnt end
as item_last28day_click_cnt,
case when item_last28day_bookmark_cnt is null then 0
else item_last28day_bookmark_cnt end as item_last28day_bookmark_cnt,
case when item_last28day_addcart_cnt is null then 0
else item_last28day_addcart_cnt end
as item_last28day_addcart_cnt,
case when item_last28day_buy_cnt is null then 0
else item_last28day_buy_cnt end
as item_last28day_buy_cnt,
case when category_last1day_click_cnt is null then 0
else category_last1day_click_cnt end
as 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 0
else category_last1day_addcart_cnt end
as category_last1day_addcart_cnt,
case when category_last1day_buy_cnt is null then 0
else category_last1day_buy_cnt end
as category_last1day_buy_cnt,
case when category_last3day_click_cnt is null then 0
else category_last3day_click_cnt end
as 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 0
else category_last3day_addcart_cnt end
as category_last3day_addcart_cnt,
case when category_last3day_buy_cnt is null then 0
else category_last3day_buy_cnt end
as category_last3day_buy_cnt,
case when category_last7day_click_cnt is null then 0
else category_last7day_click_cnt end
as 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 0
else category_last7day_addcart_cnt end
as category_last7day_addcart_cnt,
case when category_last7day_buy_cnt is null then 0
else category_last7day_buy_cnt end
as category_last7day_buy_cnt,
case when category_last14day_click_cnt is null then 0
else category_last14day_click_cnt end
as category_last14day_click_cnt,
case when category_last14day_bookmark_cnt is null then 0
else category_last14day_bookmark_cnt end as category_last14day_bookmark_cnt,
case when category_last14day_addcart_cnt is null then 0
else category_last14day_addcart_cnt end
as category_last14day_addcart_cnt,
case when category_last14day_buy_cnt is null then 0
else category_last14day_buy_cnt end
as category_last14day_buy_cnt,
case when category_last21day_click_cnt is null then 0
else category_last21day_click_cnt end
as category_last21day_click_cnt,
case when category_last21day_bookmark_cnt is null then 0
else category_last21day_bookmark_cnt end as category_last21day_bookmark_cnt,
case when category_last21day_addcart_cnt is null then 0
else category_last21day_addcart_cnt end
as category_last21day_addcart_cnt,
case when category_last21day_buy_cnt is null then 0
else category_last21day_buy_cnt end
as category_last21day_buy_cnt,
case when category_last28day_click_cnt is null then 0
else category_last28day_click_cnt end
as category_last28day_click_cnt,
case when category_last28day_bookmark_cnt is null then 0
else category_last28day_bookmark_cnt end
as category_last28day_bookmark_cnt,
case when category_last28day_addcart_cnt is null then 0
else category_last28day_addcart_cnt end
as category_last28day_addcart_cnt,
case when category_last28day_buy_cnt is null then 0
else category_last28day_buy_cnt end
as 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 0
else user_last1day_click_item_cnt end
AS 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 0
else user_last3day_click_item_cnt end
AS 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 0
else user_last7day_click_item_cnt end
AS 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 0
else user_last14day_click_item_cnt end
AS 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 0
else user_last21day_click_item_cnt end
AS 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 0
else user_last1day_click_category_cnt end
AS 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 0
else user_last3day_click_category_cnt end
AS 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 0
else user_last7day_click_category_cnt end
AS 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 0
else user_last14day_click_category_cnt end
AS 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 0
else user_last21day_click_category_cnt end
AS 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 0
else user_last28day_click_category_cnt end
AS 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 0
else user_last1day_click_cnt end
as 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 0
else user_last1day_addcart_cnt end
as user_last1day_addcart_cnt,
case when user_last1day_buy_cnt is null then 0
else user_last1day_buy_cnt end
as user_last1day_buy_cnt,
case when user_last3day_click_cnt is null then 0
else user_last3day_click_cnt end
as 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 0
else user_last3day_addcart_cnt end
as user_last3day_addcart_cnt,
case when user_last3day_buy_cnt is null then 0
else user_last3day_buy_cnt end
as user_last3day_buy_cnt,
case when user_last7day_click_cnt is null then 0
else user_last7day_click_cnt end
as 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 0
else user_last7day_addcart_cnt end
as user_last7day_addcart_cnt,
case when user_last7day_buy_cnt is null then 0
else user_last7day_buy_cnt end
as user_last7day_buy_cnt,
case when user_last14day_click_cnt is null then 0
else user_last14day_click_cnt end
as 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 0
else user_last14day_addcart_cnt end
as user_last14day_addcart_cnt,
case when user_last14day_buy_cnt is null then 0
else user_last14day_buy_cnt end
as user_last14day_buy_cnt,
case when user_last21day_click_cnt is null then 0
else user_last21day_click_cnt end
as 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 0
else user_last21day_addcart_cnt end
as user_last21day_addcart_cnt,
case when user_last21day_buy_cnt is null then 0
else user_last21day_buy_cnt end
as user_last21day_buy_cnt,
case when user_last28day_click_cnt is null then 0
else user_last28day_click_cnt end
as 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 0
else user_last28day_addcart_cnt end
as user_last28day_addcart_cnt,
case when user_last28day_buy_cnt is null then 0
else user_last28day_buy_cnt end
as 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 0
else user_last1hour_click_diff_item_cnt end
as user_last1hour_click_diff_item_cnt,
case when user_last1hour_bookmark_diff_item_cnt is null then 0
else user_last1hour_bookmark_diff_item_cnt end
as user_last1hour_bookmark_diff_item_cnt,
case when user_last1hour_addcart_diff_item_cnt is null then 0
else user_last1hour_addcart_diff_item_cnt end
as user_last1hour_addcart_diff_item_cnt,
case when user_last1hour_buy_diff_item_cnt is null then 0
else user_last1hour_buy_diff_item_cnt end
as user_last1hour_buy_diff_item_cnt,
case when user_last1hour_click_diff_category_cnt is null then 0
else user_last1hour_click_diff_category_cnt end
as user_last1hour_click_diff_category_cnt,
case when user_last1hour_bookmark_diff_category_cnt is null then 0
else user_last1hour_bookmark_diff_category_cnt end
as user_last1hour_bookmark_diff_category_cnt,
case when user_last1hour_addcart_diff_category_cnt is null then 0
else user_last1hour_addcart_diff_category_cnt end
as user_last1hour_addcart_diff_category_cnt,
case when user_last1hour_buy_diff_category_cnt is null then 0
else user_last1hour_buy_diff_category_cnt end
as user_last1hour_buy_diff_category_cnt,
case when user_last2hour_click_diff_item_cnt is null then 0
else user_last2hour_click_diff_item_cnt end
as user_last2hour_click_diff_item_cnt,
case when user_last2hour_bookmark_diff_item_cnt is null then 0
else user_last2hour_bookmark_diff_item_cnt end
as user_last2hour_bookmark_diff_item_cnt,
case when user_last2hour_addcart_diff_item_cnt is null then 0
else user_last2hour_addcart_diff_item_cnt end
as user_last2hour_addcart_diff_item_cnt,
case when user_last2hour_buy_diff_item_cnt is null then 0
else user_last2hour_buy_diff_item_cnt end
as user_last2hour_buy_diff_item_cnt,
case when user_last2hour_click_diff_category_cnt is null then 0
else user_last2hour_click_diff_category_cnt end
as user_last2hour_click_diff_category_cnt,
case when user_last2hour_bookmark_diff_category_cnt is null then 0
else user_last2hour_bookmark_diff_category_cnt end
as user_last2hour_bookmark_diff_category_cnt,
case when user_last2hour_addcart_diff_category_cnt is null then 0
else user_last2hour_addcart_diff_category_cnt end
as user_last2hour_addcart_diff_category_cnt,
case when user_last2hour_buy_diff_category_cnt is null then 0
else user_last2hour_buy_diff_category_cnt end
as user_last2hour_buy_diff_category_cnt,
case when user_last3hour_click_diff_item_cnt is null then 0
else user_last3hour_click_diff_item_cnt end
as user_last3hour_click_diff_item_cnt,
case when user_last3hour_bookmark_diff_item_cnt is null then 0
else user_last3hour_bookmark_diff_item_cnt end
as user_last3hour_bookmark_diff_item_cnt,
case when user_last3hour_addcart_diff_item_cnt is null then 0
else user_last3hour_addcart_diff_item_cnt end
as user_last3hour_addcart_diff_item_cnt,
case when user_last3hour_buy_diff_item_cnt is null then 0
else user_last3hour_buy_diff_item_cnt end
as user_last3hour_buy_diff_item_cnt,
case when user_last3hour_click_diff_category_cnt is null then 0
else user_last3hour_click_diff_category_cnt end
as user_last3hour_click_diff_category_cnt,
case when user_last3hour_bookmark_diff_category_cnt is null then 0
else user_last3hour_bookmark_diff_category_cnt end
as user_last3hour_bookmark_diff_category_cnt,
case when user_last3hour_addcart_diff_category_cnt is null then 0
else user_last3hour_addcart_diff_category_cnt end
as user_last3hour_addcart_diff_category_cnt,
case when user_last3hour_buy_diff_category_cnt is null then 0
else user_last3hour_buy_diff_category_cnt end
as user_last3hour_buy_diff_category_cnt,
case when user_last4hour_click_diff_item_cnt is null then 0
else user_last4hour_click_diff_item_cnt end
as user_last4hour_click_diff_item_cnt,
case when user_last4hour_bookmark_diff_item_cnt is null then 0
else user_last4hour_bookmark_diff_item_cnt end
as user_last4hour_bookmark_diff_item_cnt,
case when user_last4hour_addcart_diff_item_cnt is null then 0
else user_last4hour_addcart_diff_item_cnt end
as user_last4hour_addcart_diff_item_cnt,
case when user_last4hour_buy_diff_item_cnt is null then 0
else user_last4hour_buy_diff_item_cnt end
as user_last4hour_buy_diff_item_cnt,
case when user_last4hour_click_diff_category_cnt is null then 0
else user_last4hour_click_diff_category_cnt end
as user_last4hour_click_diff_category_cnt,
case when user_last4hour_bookmark_diff_category_cnt is null then 0
else user_last4hour_bookmark_diff_category_cnt end
as user_last4hour_bookmark_diff_category_cnt,
case when user_last4hour_addcart_diff_category_cnt is null then 0
else user_last4hour_addcart_diff_category_cnt end
as user_last4hour_addcart_diff_category_cnt,
case when user_last4hour_buy_diff_category_cnt is null then 0
else user_last4hour_buy_diff_category_cnt end
as user_last4hour_buy_diff_category_cnt,
case when user_last9hour_click_diff_item_cnt is null then 0
else user_last9hour_click_diff_item_cnt end
as user_last9hour_click_diff_item_cnt,
case when user_last9hour_bookmark_diff_item_cnt is null then 0
else user_last9hour_bookmark_diff_item_cnt end
as user_last9hour_bookmark_diff_item_cnt,
case when user_last9hour_addcart_diff_item_cnt is null then 0
else user_last9hour_addcart_diff_item_cnt end
as user_last9hour_addcart_diff_item_cnt,
case when user_last9hour_buy_diff_item_cnt is null then 0
else user_last9hour_buy_diff_item_cnt end
as user_last9hour_buy_diff_item_cnt,
case when user_last9hour_click_diff_category_cnt is null then 0
else user_last9hour_click_diff_category_cnt end
as user_last9hour_click_diff_category_cnt,
case when user_last9hour_bookmark_diff_category_cnt is null then 0
else user_last9hour_bookmark_diff_category_cnt end
as user_last9hour_bookmark_diff_category_cnt,
case when user_last9hour_addcart_diff_category_cnt is null then 0
else user_last9hour_addcart_diff_category_cnt end
as user_last9hour_addcart_diff_category_cnt,
case when user_last9hour_buy_diff_category_cnt is null then 0
else user_last9hour_buy_diff_category_cnt end
as user_last9hour_buy_diff_category_cnt,
case when user_last15hour_click_diff_item_cnt is null then 0
else user_last15hour_click_diff_item_cnt end
as user_last15hour_click_diff_item_cnt,
case when user_last15hour_bookmark_diff_item_cnt is null then 0
else user_last15hour_bookmark_diff_item_cnt end
as user_last15hour_bookmark_diff_item_cnt,
case when user_last15hour_addcart_diff_item_cnt is null then 0
else user_last15hour_addcart_diff_item_cnt end
as user_last15hour_addcart_diff_item_cnt,
case when user_last15hour_buy_diff_item_cnt is null then 0
else user_last15hour_buy_diff_item_cnt end
as user_last15hour_buy_diff_item_cnt,
case when user_last15hour_click_diff_category_cnt is null then 0
else user_last15hour_click_diff_category_cnt end
as user_last15hour_click_diff_category_cnt,
case when user_last15hour_bookmark_diff_category_cnt is null then 0
else user_last15hour_bookmark_diff_category_cnt end
as user_last15hour_bookmark_diff_category_cnt,
case when user_last15hour_addcart_diff_category_cnt is null then 0
else user_last15hour_addcart_diff_category_cnt end
as user_last15hour_addcart_diff_category_cnt,
case when user_last15hour_buy_diff_category_cnt is null then 0
else user_last15hour_buy_diff_category_cnt end
as user_last15hour_buy_diff_category_cnt,
-- 2021.06.21新增特征
case when user_last3day_mean_prior_click_next_buy_cnt is null then 0
else user_last3day_mean_prior_click_next_buy_cnt end
as user_last3day_mean_prior_click_next_buy_cnt,
case when user_last3day_mean_prior_bookmark_next_buy_cnt is null then 0
else user_last3day_mean_prior_bookmark_next_buy_cnt end
as user_last3day_mean_prior_bookmark_next_buy_cnt,
case when user_last3day_mean_prior_addcart_next_buy_cnt is null then 0
else user_last3day_mean_prior_addcart_next_buy_cnt end
as user_last3day_mean_prior_addcart_next_buy_cnt,
case when user_last3day_mean_prior_buy_next_buy_cnt is null then 0
else user_last3day_mean_prior_buy_next_buy_cnt end
as user_last3day_mean_prior_buy_next_buy_cnt,
case when user_last7day_mean_prior_click_next_buy_cnt is null then 0
else user_last7day_mean_prior_click_next_buy_cnt end
as user_last7day_mean_prior_click_next_buy_cnt,
case when user_last7day_mean_prior_bookmark_next_buy_cnt is null then 0
else user_last7day_mean_prior_bookmark_next_buy_cnt end
as user_last7day_mean_prior_bookmark_next_buy_cnt,
case when user_last7day_mean_prior_addcart_next_buy_cnt is null then 0
else user_last7day_mean_prior_addcart_next_buy_cnt end
as user_last7day_mean_prior_addcart_next_buy_cnt,
case when user_last7day_mean_prior_buy_next_buy_cnt is null then 0
else user_last7day_mean_prior_buy_next_buy_cnt end
as 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_ouyang_online_train_base_ui in_t1
LEFT OUTER JOIN
(
SELECT user_id FROM t_dh_ouyang_filter_user_list
)in_t2
ON in_t1.user_id = in_t2.user_id
LEFT OUTER JOIN
(
SELECT item_id FROM t_dh_ouyang_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_ouyang_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_ouyang_online_train_item_feature t3
ON t1.item_id = t3.item_id
LEFT OUTER JOIN
t_dh_ouyang_online_train_user_feature t4
ON t1.user_id = t4.user_id
LEFT OUTER JOIN
t_dh_ouyang_online_train_ui_feature t5
ON t1.user_id = t5.user_id AND t1.item_id = t5.item_id
)t
)out_t
;
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/bryan__/article/details/47112993