Commit b09b7f2d authored by 张彦钊's avatar 张彦钊

修改模型训练和ctr文件中点击表和曝光表的名称

parent a803f9aa
......@@ -5,7 +5,7 @@ from datetime import timedelta
def get_tail8():
sql = "select distinct device_id from data_feed_click2 \
sql = "select distinct device_id from data_feed_click \
where stat_date='{}' \
and cid_type='{}' \
and device_id regexp '8$';".format(stat_date,cid_type)
......@@ -24,7 +24,7 @@ def get_tail8():
def get_ctr(user_tuple):
sql = "select count(device_id) from data_feed_click2 \
sql = "select count(device_id) from data_feed_click \
where stat_date='{}' \
and cid_type='{}' \
and device_id in {}".format(stat_date, cid_type, user_tuple)
......@@ -35,7 +35,7 @@ def get_ctr(user_tuple):
click = cursor.fetchall()[0][0]
print(click)
sql = "select count(device_id) from data_feed_exposure2 \
sql = "select count(device_id) from data_feed_exposure \
where stat_date='{}' \
and cid_type='{}' \
and device_id in {}".format(stat_date, cid_type, user_tuple)
......@@ -54,7 +54,7 @@ def get_tail6():
print(len(pre_list))
print(pre_list[:2])
db = pymysql.connect(host='10.66.157.22', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='jerry_test')
sql = "select distinct device_id from data_feed_click2 \
sql = "select distinct device_id from data_feed_click \
where stat_date='{}' \
and cid_type='{}' \
and device_id in {}".format(stat_date,cid_type,pre_list)
......
......@@ -4,15 +4,14 @@ import time
import pymysql
def fetch_data(start_date, end_date):
# 获取点击表里的device_id
db = pymysql.connect(host='10.66.157.22', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='jerry_test')
sql = "select distinct device_id from data_feed_click2"
sql = "select distinct device_id from data_feed_click"
click_device_id = con_sql(db,sql)[0].values.tolist()
print("成功获取点击表里的device_id")
# 获取点击表里的数据
sql = "select cid,device_id,time,stat_date from data_feed_click2 " \
sql = "select cid,device_id,time,stat_date from data_feed_click " \
"where stat_date >= '{0}' and stat_date <= '{1}'".format(start_date, end_date)
# 因为上面的db已经关了,需要再写一遍
db = pymysql.connect(host='10.66.157.22', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='jerry_test')
......@@ -25,7 +24,7 @@ def fetch_data(start_date, end_date):
click = click.drop("time_date", axis=1)
# 获取曝光表里的数据
sql = "select cid,device_id,time,stat_date from data_feed_exposure2 " \
sql = "select cid,device_id,time,stat_date from data_feed_exposure " \
"where stat_date >= '{0}' and stat_date <= '{1}'".format(start_date, end_date)
start = time.time()
# 因为上面的db已经关了,需要再写一遍
......
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