Commit 13d02840 authored by 赵威's avatar 赵威

get result

parent 4d4e4fa5
...@@ -59,7 +59,8 @@ def main(): ...@@ -59,7 +59,8 @@ def main():
device_dict = device_fe.get_device_dict_from_redis() device_dict = device_fe.get_device_dict_from_redis()
diary_dict = diary_fe.get_diary_dict_from_redis() diary_dict = diary_fe.get_diary_dict_from_redis()
print("redis data: " + str(len(device_dict)) + " " + str(len(diary_dict))) tractate_dict = tractate_fe.get_tractate_dict_from_redis()
print("redis data: " + str(len(device_dict)) + " " + str(len(diary_dict)) + " " + str(len(tractate_dict)))
diary_save_path = "/home/gmuser/data/models/diary/1596083349" diary_save_path = "/home/gmuser/data/models/diary/1596083349"
diary_predict_fn = tf.contrib.predictor.from_saved_model(diary_save_path) diary_predict_fn = tf.contrib.predictor.from_saved_model(diary_save_path)
......
...@@ -13,18 +13,20 @@ from utils.portrait import (get_user_portrait_tag3_read_v2, user_portrait_tag3_g ...@@ -13,18 +13,20 @@ from utils.portrait import (get_user_portrait_tag3_read_v2, user_portrait_tag3_g
if __name__ == "__main__": if __name__ == "__main__":
time_begin = time.time() time_begin = time.time()
device_dict = device_fe.get_device_dict_from_redis()
tractate_dict = tractate_fe.get_tractate_dict_from_redis()
print("redis data: " + str(len(device_dict)) + " " + str(len(tractate_dict)))
device_id = "androidid_a25a1129c0b38f7b" device_id = "androidid_a25a1129c0b38f7b"
tractate_save_path = "/home/gmuser/data/models/tractate/1596092061" tractate_save_path = "/home/gmuser/data/models/tractate/1596092061"
tractate_predict_fn = tf.contrib.predictor.from_saved_model(tractate_save_path) tractate_predict_fn = tf.contrib.predictor.from_saved_model(tractate_save_path)
read_list, _ = get_user_portrait_tag3_read_v2(device_id, "tractate") tractate_ids = user_portrait_tag3_get_candidate_unread_list(device_id, "tractate")
print(len(read_list)) print("tractate_ids: " + str(len(tractate_ids)))
print(read_list[:10]) res = model_predict_tractate(device_id, tractate_ids, device_dict, tractate_dict, tractate_predict_fn)
print("res: " + str(len(res)))
res = user_portrait_tag3_get_candidate_unread_list(device_id, "tractate") # user_portrait_tag3_write_ctcvr_data(device_id, "tractate", res[:500])
print(len(res))
print(res[:10])
total_time = (time.time() - time_begin) / 60 total_time = (time.time() - time_begin) / 60
print("total cost {:.2f} mins at {}".format(total_time, datetime.datetime.now())) print("total cost {:.2f} mins at {}".format(total_time, datetime.datetime.now()))
...@@ -86,7 +86,7 @@ def get_n_unread_data_from_ids(data, size, read_lst): ...@@ -86,7 +86,7 @@ def get_n_unread_data_from_ids(data, size, read_lst):
def _user_portrait_tag3_get_ctcvr_candidate_key(device_id, content_type): def _user_portrait_tag3_get_ctcvr_candidate_key(device_id, content_type):
""" """
device_id: device_id:
content_type: diary content_type: diary, tractate
return: return:
""" """
return "doris:user_portrait:tag3:ctcvr:candidate:{}:device_id:".format(content_type) + str(device_id) return "doris:user_portrait:tag3:ctcvr:candidate:{}:device_id:".format(content_type) + str(device_id)
...@@ -151,7 +151,7 @@ def user_portrait_tag3_get_candidate_unread_list(device_id, content_type, size=5 ...@@ -151,7 +151,7 @@ def user_portrait_tag3_get_candidate_unread_list(device_id, content_type, size=5
def user_portrait_tag3_write_ctcvr_data(device_id, content_type, data): def user_portrait_tag3_write_ctcvr_data(device_id, content_type, data):
""" """
device_id: device_id:
content_type: diary content_type: diary, tractate
data: [15420031, 15531030, 16049931, 15335637, 16443431] data: [15420031, 15531030, 16049931, 15335637, 16443431]
return: return:
""" """
......
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