信贷标签体系

基本属性标签:这类标签包括客户的年龄、性别、婚姻状况、教育水平、职业、收入水平等基本信息。
这些信息有助于银行进行初步的客户群体划分。
行为标签:行为标签则涉及客户的交易行为,如登录频率、贷款申请次数、还款习惯等。通过分析这
些行为数据,银行可以评估客户的活跃度和忠诚度。
信用标签:信用标签是基于客户的信用历史,包括信用评分、逾期记录、负债比例等。这类标签对于
信贷产品的定价和风险管理至关重要。
消费偏好标签:消费偏好标签反映了客户在消费方面的倾向,如购物类别、消费场景、支付方式选择
等。银行可以利用这些信息来推荐相应的金融产品或服务。
风险偏好标签:风险偏好标签则揭示了客户在投资时的风险承受能力,这对于银行在提供投资咨询和
理财产品时非常重要。
价值标签:价值标签则是基于客户的综合贡献度,包括存款余额、贷款金额、管理资产规模等。这类
标签有助于银行识别高价值客户,并制定相应的维护策略。
社交标签:社交标签则是基于客户的社交网络和人际关系,如好友数量、社交活跃度等。这些信息对
于分析客户的影响力和传播力非常有用。
时间标签:时间标签则记录了客户与银行互动的时间信息,如开户时间、最后一次交易时间等。这些
信息可以帮助银行分析客户的生命周期阶段。

会员基础信息标签大宽表

用户行为属性标签大宽表

用户交易属性标签大宽表

用户风险信息标签大宽表

营销属性标签大宽表

价值属性标签大宽表

标签业务需求示例:

标签开发案例
案例 1:定期批量减免罚息、利息
需求背景:面对突发情况(疫情),需要在某一段时期内,针对特定客群进行罚息减免。
需求内容:
1、客群筛选:支持按客户风险等级、首复贷用户、客户渠道来源、所在地区等标签,最长逾期阶段
M0、M1、M2、M3 等,根据多维度筛选特定类别客群;(支持指定用户)
2、减免力度:N%,N 支持系统配置,0≤N≤100;(减免计算的金额,需保存明细和汇总数据,对应
至用户、借据和时间等)
3、减免维度:支持选择罚息和利息,按日统计;
4、减免期限:生效时间、截止时间;
生效时间:即减免开始计算时点,包括当天;
截止时间:即减免终止计算时点,包括当天;
5、审批流:业务岗发起→财务岗审批(待确定);
6、减免后平台账与资金方账保持一致,若涉及外部资金方,由业务侧提前沟通贴息方案;
7、减免失败:返回失败的结果与明细,对应至用户、借据与失败原因。
需求分析,梳理出需要的标签

将需要用到的标签,先每个单独开发出来,再根据相同粒度进行合并成标签大宽表。
---------------------------------------------------------step1:标签开发
CREATE TABLE `ds_hive.user_is_frist_loan_year`(
`userid` string COMMENT 'userid',
`is_frist_loan` string COMMENT '标签值'
)
COMMENT 'userid是否近一年首贷用户'
PARTITIONED BY ( `data_date` string COMMENT '数据日期')
;
-------------------取全量数据量很大,想办法优化;
--create table if not exists ds_hive.tmp_is_frist_loan_year_001
--select t1.user_id as user_id --用户id
-- ,min(CRT_TM) as is_frist_loan --标签值
-- from Dwd.dwd_order_info_fact t1
--where t1.data_date<='${hivevar:statis_date}'
-- group by t1.user_id
--;
--insert overwrite table ds_hive.user_is_frist_loan_year partition(data_date= "${hivevar:statis_date}")
--select t1.user_id as user_id --用户id
-- ,case when frist_loan_dt>='${hivevar:1year}' then 'Y' else 'N' end as is_frist_loan
-- from ds_hive.tmp_is_frist_loan_year_001 t1
--;
--------------------优化:构建首购表和最近贷款的表后续重复使用
CREATE TABLE `dws.user_frist_loan_d`(
`userid` string COMMENT 'userid'
,`frist_loan_dt` string COMMENT '首次贷款'
,`last_loan_dt` string COMMENT '最近一次贷款'
)
COMMENT '用户首次贷款表'
;
-------实现代码:第一次全量同步,后续每天,此段代码下沉到数仓 dws 层
create table if not exists ds_hive.tmp_user_frist_loan_d_001
select t1.user_id as user_id --用户id
,min(CRT_TM) as is_frist_loan --标签值
,max(CRT_TM) as last_loan_dt --标签值
from Dwd.dwd_order_info_fact t1
where t1.data_date='${hivevar:statis_date}'
group by t1.user_id
;
insert overwrite table ds_hive.user_frist_loan_d
select t1.user_id as user_id --用户id
,frist_loan_dt
,last_loan_dt
from dws.user_frist_loan_d t1
union all
select t1.user_id as user_id --用户id
,min(CRT_TM) as is_frist_loan --首次贷款
,max(CRT_TM) as last_loan_dt --最近一次贷款
from ds_hive.tmp_user_frist_loan_d_001 t1
left join dws.user_frist_loan_d t2
on t1.user_id=t2.user_id
where t2.user_id is null
;
--------直接使用首贷表开发标签
insert overwrite table ds_hive.user_is_frist_loan_year partition(data_date= "${hivevar:statis_date}")
select t1.user_id as user_id --用户id
,case when frist_loan_dt>='${hivevar:1year}' then 'Y' else 'N' end as is_frist_loan
from ds_hive.user_frist_loan_d t1
;
----------------------------------------------------------------------贷款逾期次数标签表
CREATE TABLE `ds_hive.user_loan_over_cnt_d`(
`userid` string COMMENT 'userid',
`oan_over_cnt` string COMMENT '标签值'
)
COMMENT 'userid逾期次数'
PARTITIONED BY ( `data_date` string COMMENT '数据日期')
;
--------直接使用贷款逾期次数标签
insert overwrite table ds_hive.user_loan_over_cnt_d partition(data_date= "${hivevar:statis_date}")
select t1.user_id as user_id --用户id
,count(LN_NO) as oan_over_cnt
from dwd.D_EVN_LOAN_OVD_INFO_D t1
where data_date= '${hivevar:statis_date}'
group by t1.user_id
;
----------------------------------------------------------------------贷款逾期次数标签表
CREATE TABLE `ds_hive.user_loan_over_prdqt_d`(
`userid` string COMMENT 'userid',
`oan_over_prdqt` string COMMENT '标签值'
)
COMMENT 'userid是否近一年首贷用户'
PARTITIONED BY ( `data_date` string COMMENT '数据日期')
;
--------直接使用贷款逾期次数标签
-------实现代码:
drop table if exists ds_hive.tmp_user_loan_over_prdqt_d_001
create table if not exists ds_hive.tmp_user_loan_over_prdqt_d_001
select t1.user_id as user_id --用户id
,max(ACMOD_PRDQT) as oan_over_prdqt --标签值
from dwd.D_EVN_LOAN_OVD_INFO_D t1
where t1.data_date='${hivevar:statis_date}'
group by t1.user_id
;
insert overwrite table ds_hive.user_loan_over_prdqt_d partition(data_date= "${hivevar:statis_date}")
select t1.user_id as user_id --用户id
,case when oan_over_prdqt=0 then 'M0'
when oan_over_prdqt=1 then 'M1'
when oan_over_prdqt=2 then 'M2'
when oan_over_prdqt=3 then 'M3'
when oan_over_prdqt=4 then 'M4'
when oan_over_prdqt=5 then 'M5'
when oan_over_prdqt=6 then 'M6'
when oan_over_prdqt>=7 then 'M7' end as oan_over_prdqt
from tmp_user_loan_over_prdqt_d_001
;
-------------------------------step2:合并大宽表
---ds_hive.t_lbl_trade_action_all
---ds_hive.t_lbl_fengx_new_all
---增加字段
alter table ds_hive.t_lbl_trade_action_all add columns(is_frist_loan string comment '是否近一年首贷用户');
alter table ds_hive.t_lbl_fengx_new_all add columns(oan_over_cnt string comment '逾期次数',oan_over_prdqt string comment '逾期阶段');
--------完成用户价值属性表
insert overwrite table ds_hive.t_lbl_trade_action_all partition(data_date= "${hivevar:statis_date}")
select
t1.user_id
,t2.pls_is_fzn
,t3.pls_is_bind_card
,t3.pls_is_cur_bind_card
,t3.pls_is_epp_bag_user
,t3.pls_is_scan
,t3.pls_is_by_scan
,t3.pls_is_quick_pls
,t4.pls_is_fin_user
,t4.pls_is_bill_fin_user
,t4.pls_is_fnd_user
,t4.pls_is_bof_prch
,t4.pls_is_chp_user
,t4.pls_is_ins_user
,t4.pls_is_cfc_user
,t4.pls_is_ccr_user
,t4.pls_lifecycle
,t4.pls_actv_lvl_tm
,t4.pls_actv_lvl
,t5.pls_value_lvl
,t6.pls_loyal_lvl
,t7.pls_cosm_drive
,t8.pls_disposition
,t9.pls_gds_cgy_love
,t10.pls_work_dt_vst_lvl
,t10.pls_weekend_vst_lvl
,t10.pls_work_tm_vst_lvl
,t10.pls_rest_tm_vst_lvl
,t10.pls_night_vst_lvl
,t13.pls_commute_vst_lvl
,t13.pls_rgst_from
,t13.pls_rgst_tml
,t13.pls_tml_love
,t13.pls_chn_love
,t13.pls_vst_pg_lvl
,t13.pls_vst_cnt_lvl
,t13.pls_vst_bounce_lvl
,t13.pls_vst_staytm_lvl
,t13.pls_pg_staytm_lvl
,t13.pls_epp_lifecycle
,t13.pls_epp_bag_actv_lvl
,t13.pls_epp_scan_actv_lvl
,t13.pls_epp_byscan_actv_lvl
,t13.pls_is_epp_tran
,t13.pls_epp_tran_lvl
,t13.pls_is_bank_tran
,t13.pls_bank_tran_lvl
,t13.pls_is_crdt_crd_tran
,t13.pls_crdt_crd_tran_lvl
,t13.pls_is_mbl_fill
,t13.pls_mbl_fill_lvl
,t13.pls_is_sch_crd_user
,t13.pls_sch_crd_lvl
,t13.pls_is_water_chrg
,t13.pls_water_chrg_lvl
,t13.pls_is_ele_chrg
,t13.pls_ele_chrg_lvl
,t13.pls_is_gas_chrg
,t13.pls_gas_chrg_lvl
,t13.pls_is_tel_chrg
,t13.pls_tel_chrg_lvl
,t13.pls_is_adsl_chrg
,t13.pls_adsl_chrg_lvl
,t13.pls_is_mbl_bill_user
,t13.pls_mbl_bill_lvl
,t13.pls_is_tv_chrg
,t13.pls_tv_chrg_lvl
,t13.pls_is_gas_crd_user
,t13.pls_gas_crd_lvl
,t13.pls_epp_vst_pg_lvl
,t13.pls_epp_vst_cnt_lvl
,t13.pls_epp_vst_bounce_lvl
,t13.pls_epp_vst_staytm_lvl
,t13.pls_epp_pg_staytm_lvl
,t13.pls_fin_rgst_dt
,t13.pls_fin_rgst_days
,t13.pls_fin_rgst_drtn
,t13.pls_is_auto_bof_tran
,t13.pls_fin_aum_lvl
,t13.pls_fin_hold_amt
,t13.pls_fin_lifecycle
,t13.pls_fin_actv_lvl
,t13.pls_bof_actv_lvl
,t13.pls_fnd_actv_lvl
,t13.pls_bill_actv_lvl
,t13.pls_fin_value_lvl
,t13.pls_bof_value_lvl
,t13.pls_fnd_value_lvl
,t13.pls_bill_value_lvl
,t13.pls_is_fnd_prch
,t13.pls_is_bof_zero_hold
,t13.pls_is_bill_cash_user
,t13.pls_inv_prd_love
,t13.pls_inv_risk_love
,t1.pls_inv_term_love
,t1.pls_fin_tml_love
,t21.pls_fin_vst_pg_lvl
,t21.pls_fin_vst_cnt_lvl
,t21.pls_fin_vst_bounce_lvl
,t21.pls_fin_vst_staytm_lvl
,t21.pls_fin_pg_staytm_lvl
,t21.pls_fin_pls_tm_1st
,t21.pls_fin_pls_days_1st
,t21.pls_fin_pls_1st_drtn
,t21.pls_bof_pls_1st_drtn
,t21.pls_bof_pls_last_drtn
,t21.pls_bof_hold_drtn
,t21.pls_is_7d_fnd_fail
,t21.pls_is_7d_bof_fail
,t21.pls_is_7d_bil_fail
,t21.pls_is_bil_vip
,t21.pls_is_fnd_vip
,t21.pls_is_bof_vip
,t21.pls_bof_new_prch_7d
,t21.pls_fin_new_non_prch_7d
,t21.pls_fin_new_prch_7d
,t21.pls_bof_new_prch_30d
,t21.pls_fin_new_non_prch_30d
,t21.pls_fin_new_prch_30d
,t21.pls_non_2nd_prch
,t21.pls_non_prch_af_repls
,t34.is_frist_loan
from dwd.D_CST_PSNL_BSC_INFO_D t1
left join ds_hive.user_gender_label t2
on t1.user_id=t2.user_id and t2.data_date= '${hivevar:statis_date}'
left join ds_hive.user_7day_pay_label t3
on t1.user_id=t3.user_id and t3.data_date= '${hivevar:statis_date}'
left join ds_hive.user_last_dt_label t4
on t1.user_id=t4.user_id and t4.data_date= '${hivevar:statis_date}'
left join ds_hive.user_gender_label t5
on t1.user_id=t5.user_id and t5.data_date= '${hivevar:statis_date}'
left join ds_hive.user_gender_label t6
on t1.user_id=t6.user_id and t6.data_date= '${hivevar:statis_date}'
......这里省略N张标签小表或者中间小宽表
--新增标签代码
left join ds_hive.user_is_frist_loan_year t34
on t1.user_id=t34.user_id and t34.data_date= '${hivevar:statis_date}'
where t1.data_date= '${hivevar:statis_date}'
;
---ds_hive.t_lbl_fengx_new_all
---增加字段
--------完成用户价值属性表
insert overwrite table ds_hive.t_lbl_fengx_new_all partition(data_date= "${hivevar:statis_date}")
select
t1.user_id
,t2.mthly_income
,t3.work_life
,t4.is_has_car
,t4.is_has_house
,t4.has_pet
,t4.mrge_st
,t4.baby_qty
,t4.baby_age_1st
,t4.is_inr_emp
,t5.is_inr_emp_his
,t5.acct_type
,t5.auth_type
,t5.mbl_auth
,t5.pupsec_status
,t5.chnel_lvl
,t5.chnel_cnt
,t6.oan_over_cnt
,t7.oan_over_prdqt
from dwd.D_CST_PSNL_BSC_INFO_D t1
left join ds_hive.user_gender_label t2
on t1.user_id=t2.user_id and t2.data_date= '${hivevar:statis_date}'
left join ds_hive.user_7day_pay_label t3
on t1.user_id=t3.user_id and t3.data_date= '${hivevar:statis_date}'
left join ds_hive.user_last_dt_label t4
on t1.user_id=t4.user_id and t4.data_date= '${hivevar:statis_date}'
left join ds_hive.user_gender_label t5
on t1.user_id=t5.user_id and t5.data_date= '${hivevar:statis_date}'
left join ds_hive.user_loan_over_cnt_d t6
on t1.user_id=t6.user_id and t6.data_date= '${hivevar:statis_date}'
left join ds_hive.user_loan_over_cnt_d t7
on t1.user_id=t7.user_id and t7.data_date= '${hivevar:statis_date}'
where t1.data_date= '${hivevar:statis_date}'
;

案例2:低活跃用户定期 push 拉活
需求背景:为了实现用户拉活目标,增长业务需求,我们使用各种的拉活手段来进行用户促活,其中性价比最高的事 push 消息的手段。

---------------------------------------------------------step1:标签开发
CREATE TABLE `ds_hive.user_last_active_days`(
`userid` string COMMENT 'userid',
`last_active_days` string COMMENT '距今最近一次活跃天数'
)
COMMENT 'userid距今最近一次活跃天数'
PARTITIONED BY ( `data_date` string COMMENT '数据日期')
;
-----------------------------step1:求出登录用户,并且在app内停留时间大约20S
drop table if exists ds_hive.tmp_user_last_active_days_001;
create table if not exists ds_hive.tmp_user_last_active_days_001
select t1.member_id as user_id --用户id
,max(substr(CRTD_TIME,1,10)) as last_active_days --标签值
,sum(CRNT_PAGE_DRTN) as CRNT_PAGE_DRTNs --当天页面停留时间
from dwd.TSOR_BR_BASE_PAGEVIEW_D t1 ---此表是增量表
where t1.STATIS_DATE='${hivevar:statis_date}'
and LOGON_TP_ID='R' --R代表注册用户
group by t1.member_id
having CRNT_PAGE_DRTNs>=20
;
-----------------------------step1:点击页面数大于2个的用户
drop table if exists ds_hive.tmp_user_last_active_days_002;
create table if not exists ds_hive.tmp_user_last_active_days_002
select t1.member_id as user_id --用户id
,count(distinct URL_PATTERN_ID) as URL_PATTERN_CNT --当天点击的页面数
from dwd.TSOR_BR_BASE_CLICK_D t1 ---此表是增量表
where t1.STATIS_DATE='${hivevar:statis_date}'
group by t1.member_id
having URL_PATTERN_CNT>=2
;
-----------------------------step3:晒出目标客户
drop table if exists ds_hive.tmp_user_last_active_days_003;
create table if not exists ds_hive.tmp_user_last_active_days_003
select t1.user_id
,t1.last_active_days
from tmp_user_last_active_days_001 t1
join tmp_user_last_active_days_002 t2
on t1.user_id=t2.user_id
;
insert overwrite table ds_hive.user_last_active_days
partition(data_date= "${hivevar:statis_date}")
select t1.user_id as user_id --用户id
,last_active_days
from ds_hive.tmp_is_frist_loan_year_001 t1
;
-------------------------------step5:合并大宽表
---ds_hive.t_lbl_operations_beha_all
---增加字段
alter table ds_hive.t_lbl_operations_beha_all add columns(last_active_days string comment '距今最近一次活跃天数');
insert overwrite table ds_hive.t_lbl_fengx_new_all partition(data_date= "${hivevar:statis_date}")
select
user_id
,pay_lifecycle
,pay_actv_lvl_tm
,pay_actv_lvl
,pay_value_lvl
,pay_loyal_lvl
,pay_cosm_drive
,pay_disposition
,pay_vst_cnt_lvl
,pay_vst_bounce_lvl
,pay_vst_staytm_lvl
,pay_pg_staytm_lvl
,pay_epp_lifecycle
,pay_epp_bag_actv_lvl
,pay_epp_scan_actv_lvl
,pay_epp_byscan_actv_lvl
,pay_is_epp_tran
,pay_epp_tran_lvl
,pay_is_bank_tran
,pay_bank_tran_lvl
,pay_is_crdt_crd_tran
,pay_crdt_crd_tran_lvl
,pay_is_mbl_fill
,pay_mbl_fill_lvl
,pay_is_sch_crd_user
,pay_sch_crd_lvl
,pay_is_water_chrg
,pay_epp_vst_staytm_lvl
,pay_epp_pg_staytm_lvl
,pay_fin_rgst_dt
,pay_fin_rgst_days
,pay_fin_rgst_drtn
,pay_is_auto_bof_tran
,pay_fin_aum_lvl
,pay_fin_hold_amt
,pay_fin_lifecycle
,pay_fin_actv_lvl
,pay_bof_actv_lvl
,pay_fnd_actv_lvl
,pay_bill_actv_lvl
,pay_fin_value_lvl
,pay_bof_value_lvl
,pay_fnd_value_lvl
,pay_bill_value_lvl
,pay_is_fnd_prch
,pay_is_bof_zero_hold
,pay_is_bill_cash_user
,pay_inv_prd_love
,pay_inv_risk_love
,pay_inv_term_love
,pay_fin_tml_love
,pay_fin_vst_pg_lvl
,pay_fin_vst_cnt_lvl
,pay_fin_vst_bounce_lvl
,pay_fin_vst_staytm_lvl
,pay_fin_pg_staytm_lvl
,pay_fin_pay_tm_1st
,pay_fin_pay_days_1st
,pay_fin_pay_1st_drtn
,pay_bof_pay_1st_drtn
,pay_bof_pay_last_drtn
,pay_bof_hold_drtn
,pay_is_7d_fnd_fail
,pay_is_7d_bof_fail
,pay_is_7d_bil_fail
,pay_is_bil_vip
,pay_is_fnd_vip
,pay_is_bof_vip
,pay_bof_new_prch_7d
,pay_fin_new_non_prch_7d
,pay_fin_new_prch_7d
,pay_bof_new_prch_30d
,pay_fin_new_non_prch_30
,pay_fin_new_prch_30d
,pay_non_2nd_prch
,pay_non_prch_af_repay
,pay_bil_cash_cnt_1m
,pay_bil_cash_amt_1m
,pay_is_chp_focus_user
,pay_chp_foucs_attr
,pay_chp_focus_lvl
,pay_is_chp_pay_user
,pay_is_chp_lotto_user
,pay_chp_pay_tm_1st
,pay_chp_pay_days_1st
,pay_chp_pay_1st_drtn
,pay_chp_first_gz_type
,pay_chp_lifecycle
,pay_chp_actv_lvl
,pay_chp_value_lvl
,pay_chp_tml_love
,pay_chp_vst_pg_lvl
,pay_chp_vst_cnt_lvl
,pay_chp_vst_bounce_lvl
,pay_chp_vst_staytm_lvl
,pay_chp_pg_staytm_lvl
,pay_chp_is_click_farm
,pay_chp_lucky_draw_amt
,pay_chp_last_buy_cyc
,pay_chp_buy_gz_types
,pay_chp_buy_cnt
,pay_chp_reward_type_amt
,pay_chp_income_type_amt
,pay_chp_pv_cyc
,pay_chp_pv_types
,pay_chp_pv_cnt
,pay_chp_7days_nobuys
,pay_chp_15days_nobuys
,pay_chp_is_1yuan
,pay_chp_is_use_coupon
,pay_chp_coupon_use_cat
,pay_chp_coupon_use_cyc
,pay_chp_coupon_use_cnt
,pay_chp_coupon_use_amt
,pay_chp_coupon_ord_amt
,pay_chp_buy_cat
,pay_chp_buy_dept
,pay_cfc_rgst_dt
,pay_cfc_rgst_days
,pay_cfc_rgst_drtn
,pay_cfc_open_dt
,pay_cfc_open_drtn
,pay_cfc_pay_dt_1st
,pay_cfc_pay_1st_drtn
,pay_cfc_user_src
,pay_cfc_amt
,pay_cfc_bal
,pay_is_cfc_stages
,pay_is_cfc_flex_use
,pay_is_cfc_overdue
,pay_cfc_overdue_days
,pay_cfc_tml_love
,pay_is_nonfnc_mem
,pay_pupsec_status
,pay_chnel_lvl
,pay_chnel_cnt
,pay_mbl_auth
,pay_actv_type
,pay_app_hold
,pay_cfc_black_list
,pay_malicious_rgst
,pay_is_scalper
,pay_fin_black_list
,t35.last_active_days
from dwd.D_CST_PSNL_BSC_INFO_D t1
left join ds_hive.user_gender_label t2
on t1.user_id=t2.user_id and t2.data_date= '${hivevar:statis_date}'
......这里省略N张标签小表或者中间小宽表
--新增标签代码
left join ds_hive.user_gender_label t35
on t1.user_id=t2.user_id and t35.data_date= '${hivevar:statis_date}'
where t1.data_date= '${hivevar:statis_date}'
;

案例 5:催收人群拆分外呼对比实验(A/B 测试)
应用背景:智能外呼团队为了测试不同话术在外呼效果上的差异,对于同一个外呼人群需要随机平均拆分成 4 个子人群,然后针对不同子人群中的用户采用不同话术进行外呼,最终通过对比外呼效果来选出最佳话术。
应用方式:外呼团队在画像平台上创建逾期外呼人群,客群标准如下:
用户学历在本科及以上;
用户逾期在 0~30 天以上;
以前没有被催收电话拨打过;
人群根据并借助人群拆分功能将该人群按照 25%、25%、25%、25%的比例拆分为 4 个子人群,在外呼
平台导入 4 个子人群并配置不同的话术进行外呼操作。

---------------------------------------------------------建表:
CREATE TABLE `ds_hive.t_user_first_coll_call_dt`(
`user_id` string COMMENT 'userid',
`first_coll_call_dt` string COMMENT '首次催收拨打日期'
)
COMMENT '首次催收拨打日期'
PARTITIONED BY ( `data_date` string COMMENT '数据日期')
;
----------------插入标签表
insert overwrite table ds_hive.t_user_first_coll_call_dt
user_id
,min(CRT_TM) as first_coll_call_dt
from dwd.D_EVN_COLL_CALL_RCRD_D
where data_date= "${hivevar:statis_date}"
group by user_id
;
-------------------------------step5:合并大宽表
---ds_hive.t_lbl_operations_beha_all
---增加字段
alter table ds_hive.t_lbl_operations_beha_all add columns(first_coll_call_dt string comment '距今最近一次活跃天数');
insert overwrite table ds_hive.t_lbl_fengx_new_all partition(data_date= "${hivevar:statis_date}")
select
user_id
,pay_lifecycle
,pay_actv_lvl_tm
,pay_actv_lvl
,pay_value_lvl
,pay_loyal_lvl
,pay_cosm_drive
,pay_disposition
,pay_vst_cnt_lvl
,pay_vst_bounce_lvl
,pay_vst_staytm_lvl
,pay_pg_staytm_lvl
,pay_epp_lifecycle
,pay_epp_bag_actv_lvl
,pay_epp_scan_actv_lvl
,pay_epp_byscan_actv_lvl
,pay_is_epp_tran
,pay_epp_tran_lvl
,pay_is_bank_tran
,pay_bank_tran_lvl
,pay_is_crdt_crd_tran
,pay_crdt_crd_tran_lvl
,pay_is_mbl_fill
,pay_mbl_fill_lvl
,pay_is_sch_crd_user
,pay_sch_crd_lvl
,pay_is_water_chrg
,pay_epp_vst_staytm_lvl
,pay_epp_pg_staytm_lvl
,pay_fin_rgst_dt
,pay_fin_rgst_days
,pay_fin_rgst_drtn
,pay_is_auto_bof_tran
,pay_fin_aum_lvl
,pay_fin_hold_amt
,pay_fin_lifecycle
,pay_fin_actv_lvl
,pay_bof_actv_lvl
,pay_fnd_actv_lvl
,pay_bill_actv_lvl
,pay_fin_value_lvl
,pay_bof_value_lvl
,pay_fnd_value_lvl
,pay_bill_value_lvl
,pay_is_fnd_prch
,pay_is_bof_zero_hold
,pay_is_bill_cash_user
,pay_inv_prd_love
,pay_inv_risk_love
,pay_inv_term_love
,pay_fin_tml_love
,pay_fin_vst_pg_lvl
,pay_fin_vst_cnt_lvl
,pay_fin_vst_bounce_lvl
,pay_fin_vst_staytm_lvl
,pay_fin_pg_staytm_lvl
,pay_fin_pay_tm_1st
,pay_fin_pay_days_1st
,pay_fin_pay_1st_drtn
,pay_bof_pay_1st_drtn
,pay_bof_pay_last_drtn
,pay_bof_hold_drtn
,pay_is_7d_fnd_fail
,pay_is_7d_bof_fail
,pay_is_7d_bil_fail
,pay_is_bil_vip
,pay_is_fnd_vip
,pay_is_bof_vip
,pay_bof_new_prch_7d
,pay_fin_new_non_prch_7d
,pay_fin_new_prch_7d
,pay_bof_new_prch_30d
,pay_fin_new_non_prch_30
,pay_fin_new_prch_30d
,pay_non_2nd_prch
,pay_non_prch_af_repay
,pay_bil_cash_cnt_1m
,pay_bil_cash_amt_1m
,pay_is_chp_focus_user
,pay_chp_foucs_attr
,pay_chp_focus_lvl
,pay_is_chp_pay_user
,pay_is_chp_lotto_user
,pay_chp_pay_tm_1st
,pay_chp_pay_days_1st
,pay_chp_pay_1st_drtn
,pay_chp_first_gz_type
,pay_chp_lifecycle
,pay_chp_actv_lvl
,pay_chp_value_lvl
,pay_chp_tml_love
,pay_chp_vst_pg_lvl
,pay_chp_vst_cnt_lvl
,pay_chp_vst_bounce_lvl
,pay_chp_vst_staytm_lvl
,pay_chp_pg_staytm_lvl
,pay_chp_is_click_farm
,pay_chp_lucky_draw_amt
,pay_chp_last_buy_cyc
,pay_chp_buy_gz_types
,pay_chp_buy_cnt
,pay_chp_reward_type_amt
,pay_chp_income_type_amt
,pay_chp_pv_cyc
,pay_chp_pv_types
,pay_chp_pv_cnt
,pay_chp_7days_nobuys
,pay_chp_15days_nobuys
,pay_chp_is_1yuan
,pay_chp_is_use_coupon
,pay_chp_coupon_use_cat
,pay_chp_coupon_use_cyc
,pay_chp_coupon_use_cnt
,pay_chp_coupon_use_amt
,pay_chp_coupon_ord_amt
,pay_chp_buy_cat
,pay_chp_buy_dept
,pay_cfc_rgst_dt
,pay_cfc_rgst_days
,pay_cfc_rgst_drtn
,pay_cfc_open_dt
,pay_cfc_open_drtn
,pay_cfc_pay_dt_1st
,pay_cfc_pay_1st_drtn
,pay_cfc_user_src
,pay_cfc_amt
,pay_cfc_bal
,pay_is_cfc_stages
,pay_is_cfc_flex_use
,pay_is_cfc_overdue
,pay_cfc_overdue_days
,pay_cfc_tml_love
,pay_is_nonfnc_mem
,pay_pupsec_status
,pay_chnel_lvl
,pay_chnel_cnt
,pay_mbl_auth
,pay_actv_type
,pay_app_hold
,pay_cfc_black_list
,pay_malicious_rgst
,pay_is_scalper
,pay_fin_black_list
,t35.last_active_days
,t38.first_coll_call_dt
from dwd.D_CST_PSNL_BSC_INFO_D t1
left join ds_hive.user_gender_label t2
on t1.user_id=t2.user_id and t2.data_date= '${hivevar:statis_date}'
......这里省略N张标签小表或者中间小宽表
--新增标签代码
left join ds_hive.t_user_first_coll_call_dt t38
on t1.user_id=t2.user_id and t35.data_date= '${hivevar:statis_date}'
where t1.data_date= '${hivevar:statis_date}'
;
应用结果:人群拆分功能实现了对原人群的随机拆分,拆分过程完全随机且不受任何外部因素干扰,
这一特点保证了实验的有效性。最终通过对比不同子人群外呼效果找到了最合适的话术,其有效性相比其
他话术提高了 15%,外呼团队也针对性地提高了该话术在外呼中的占比。
标签的管理
