Commit 8cab2688 authored by 张彦钊's avatar 张彦钊

add print

parent 401b81df
...@@ -244,21 +244,20 @@ if __name__ == "__main__": ...@@ -244,21 +244,20 @@ if __name__ == "__main__":
# 增加缓存日记视频列表 # 增加缓存日记视频列表
cache_video_id = [] cache_video_id = []
cache_device_city_list = [] cache_device_city_list = []
# while True: while True:
data_set_cid = pd.read_csv(DIRECTORY_PATH + "data_set_cid.csv")["cid"].values.tolist() data_set_cid = pd.read_csv(DIRECTORY_PATH + "data_set_cid.csv")["cid"].values.tolist()
total_video_id = get_video_id(cache_video_id) total_video_id = get_video_id(cache_video_id)
cache_video_id = total_video_id cache_video_id = total_video_id
# device_city_list = get_active_users() device_city_list = get_active_users()
device_city_list = [("AB20292B-5D15-4C44-9429-1C2FF5ED26F6","beijing"),] # 过滤掉上次预测过的用户
# 过滤掉上次预测过的用户 device_city_list = list(set(device_city_list)-set(cache_device_city_list))
device_city_list = list(set(device_city_list)-set(cache_device_city_list)) cache_device_city_list = device_city_list
cache_device_city_list = device_city_list total_number += len(device_city_list)
total_number += len(device_city_list) print("累计预测用户总数:{}".format(total_number))
print("累计预测用户总数:{}".format(total_number)) if device_city_list != []:
if device_city_list != []: for device_city in device_city_list:
for device_city in device_city_list: # start = time.time()
# start = time.time() multi_proecess_update(device_city[0], device_city[1], data_set_cid, total_video_id)
multi_proecess_update(device_city[0], device_city[1], data_set_cid, total_video_id)
# end = time.time() # end = time.time()
# print("更新该用户队列耗时{}秒".format((end - start))) # print("更新该用户队列耗时{}秒".format((end - start)))
......
...@@ -51,10 +51,10 @@ def con_sql(sql): ...@@ -51,10 +51,10 @@ def con_sql(sql):
def queue_compare(old_list, new_list): def queue_compare(old_list, new_list):
# 去掉前面的"diary|" # 去掉前面的"diary|"
old_list = list(map(lambda x: int(x[6:]),old_list)) old_list = list(map(lambda x: int(x[6:]),old_list))
print("旧表前十个") # print("旧表前十个")
print(old_list[:10]) # print(old_list[:10])
print("新表前十个") # print("新表前十个")
print(new_list[:10]) # print(new_list[:10])
temp = list(range(len(old_list))) temp = list(range(len(old_list)))
x_dict = dict(zip(old_list, temp)) x_dict = dict(zip(old_list, temp))
temp = list(range(len(new_list))) temp = list(range(len(new_list)))
...@@ -63,8 +63,8 @@ def queue_compare(old_list, new_list): ...@@ -63,8 +63,8 @@ def queue_compare(old_list, new_list):
for key in x_dict.keys(): for key in x_dict.keys():
if x_dict[key] != y_dict[key]: if x_dict[key] != y_dict[key]:
i += 1 i += 1
if i >0:
print("日记队列更新前日记总个数{},位置发生变化个数{},发生变化率{}%".format(len(old_list), i, print("日记队列更新前日记总个数{},位置发生变化个数{},发生变化率{}%".format(len(old_list), i,
round(i / len(old_list) * 100), 2)) round(i / len(old_list) * 100), 2))
......
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