Commit 5b75983b authored by 张彦钊's avatar 张彦钊

预测集增加应用列表特征

parent 8ca8aa06
......@@ -107,7 +107,7 @@ def get_data():
write_csv(train, "tr",100000)
write_csv(test, "va",80000)
return validate_date,value_map
return validate_date,value_map,app_list_map
def app_list_func(x,l):
......@@ -129,20 +129,22 @@ def write_csv(df,name,n):
temp.to_csv(path + name+ "/{}_{}.csv".format(name,i), index=False)
def get_predict(date,value_map):
def get_predict(date,value_map,app_list_map):
db = pymysql.connect(host='10.66.157.22', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='jerry_test')
sql = "select e.y,e.z,e.label,e.ucity_id,e.clevel1_id,e.ccity_name," \
"u.device_type,u.manufacturer,u.channel,c.top,cl.l1,cl.l2,e.device_id,e.cid_id,cut.time " \
"u.device_type,u.manufacturer,u.channel,c.top,cl.l1,cl.l2,e.device_id,e.cid_id,cut.time,dl.app_list " \
"from esmm_pre_data e left join user_feature u on e.device_id = u.device_id " \
"left join cid_type_top c on e.device_id = c.device_id " \
"left join cid_level2 cl on e.cid_id = cl.cid " \
"left join cid_time_cut cut on e.cid_id = cut.cid limit 6"
"left join cid_time_cut cut on e.cid_id = cut.cid " \
"left join device_app_list dl on e.device_id = dl.device_id limit 6"
df = con_sql(db, sql)
df = df.rename(columns={0: "y", 1: "z", 2: "label", 3: "ucity_id", 4: "clevel1_id", 5: "ccity_name",
6: "device_type", 7: "manufacturer", 8: "channel", 9: "top", 10: "l1",11:"l2",
12: "device_id", 13: "cid_id", 14: "time"})
12: "device_id", 13: "cid_id", 14: "time",15:"app_list"})
df["stat_date"] = date
df["app_list"] = df["app_list"].apply(app_list_func,args=(app_list_map,))
print("predict shape")
print(df.shape)
......@@ -192,6 +194,6 @@ def get_predict(date,value_map):
if __name__ == '__main__':
train_data_set = "esmm_train_data"
path = "/data/esmm/"
date,value = get_data()
get_predict(date, value)
date,value,app_list = get_data()
get_predict(date, value,app_list)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment