|
@@ -32,6 +32,8 @@ def get_featurs(mid, data, size, top_K, flow_pool_P, env_dict=None):
|
|
|
sencetype = env_dict.get('sencetype', '')
|
|
|
redisObj = RedisHelper()
|
|
|
pre_str = "v_ctr:"
|
|
|
+ hour_pre_str = "v_hour_ctr:"
|
|
|
+ hour_vidKeys = []
|
|
|
mid_list = []
|
|
|
videoid_list = []
|
|
|
apptype_list = []
|
|
@@ -69,9 +71,11 @@ def get_featurs(mid, data, size, top_K, flow_pool_P, env_dict=None):
|
|
|
machineinfo_platform_list.append(machineinfo_platform)
|
|
|
sencetype_list.append(sencetype)
|
|
|
vidKeys.append(pre_str + str(vid))
|
|
|
+ hour_vidKeys.append(hour_pre_str+str(vid))
|
|
|
recall_list.append(recall_item)
|
|
|
#print("vidKeys:", vidKeys)
|
|
|
video_static_info = redisObj.get_batch_key(vidKeys)
|
|
|
+ video_hour_static_info = redisObj.get_batch_key(hour_vidKeys)
|
|
|
#print("video_static_info:",video_static_info)
|
|
|
if video_static_info:
|
|
|
for i in range(len(video_static_info)):
|
|
@@ -108,6 +112,27 @@ def get_featurs(mid, data, size, top_K, flow_pool_P, env_dict=None):
|
|
|
day_return_rate_list, day_return_users_list, day_rov_list,
|
|
|
day_share_pv_list, day_share_return_score_list, day_share_score_list,
|
|
|
day_share_users, day_view_pv_list, day_view_users_list)
|
|
|
+ hour_rov_list = []
|
|
|
+ hour_share_score_list =[]
|
|
|
+ if video_hour_static_info:
|
|
|
+ for i in range(len(video_hour_static_info)):
|
|
|
+ try:
|
|
|
+ # print(video_scores[i])
|
|
|
+ vid = hour_vidKeys[i].replace(hour_pre_str,"")
|
|
|
+ if video_hour_static_info[i] :
|
|
|
+ per_hour_video_staic = json.loads(video_hour_static_info[i])
|
|
|
+ hour_rov_list.append(float(per_hour_video_staic[0]))
|
|
|
+ hour_share_score_list.append(float(per_hour_video_staic[2]))
|
|
|
+ else:
|
|
|
+ hour_rov_list.append(0.0)
|
|
|
+ hour_share_score_list.append(0.0)
|
|
|
+ except Exception:
|
|
|
+ hour_rov_list.append(0.0)
|
|
|
+ hour_share_score_list.append(0.0)
|
|
|
+ else:
|
|
|
+ for i in range(len(recall_list)):
|
|
|
+ hour_rov_list.append(0.0)
|
|
|
+ hour_share_score_list.append(0.0)
|
|
|
feature_dict["mid_list"] = mid_list
|
|
|
feature_dict["videoid_list"] = videoid_list
|
|
|
feature_dict["apptype_list"] = apptype_list
|
|
@@ -132,6 +157,8 @@ def get_featurs(mid, data, size, top_K, flow_pool_P, env_dict=None):
|
|
|
feature_dict["day_view_pv_list"] = day_view_pv_list
|
|
|
feature_dict["day_view_users_list"] = day_view_users_list
|
|
|
feature_dict["day_share_users_list"] = day_share_users
|
|
|
+ feature_dict["hour_rov_list"] = hour_rov_list
|
|
|
+ feature_dict["hour_share_score_list"] = hour_share_score_list
|
|
|
return feature_dict, recall_list
|
|
|
|
|
|
|
|
@@ -176,7 +203,9 @@ def get_tf_serving_sores(feature_dict):
|
|
|
"day_return_users": feature_dict["day_return_users_list"],
|
|
|
"day_share_users": feature_dict["day_share_users_list"],
|
|
|
"day_view_pv": feature_dict["day_view_pv_list"],
|
|
|
- "day_view_users":feature_dict["day_view_users_list"]
|
|
|
+ "day_view_users":feature_dict["day_view_users_list"],
|
|
|
+ "hour_rov_list": feature_dict["hour_rov_list"],
|
|
|
+ "hour_share_score_list": feature_dict["hour_share_score_list"]
|
|
|
}
|
|
|
request_data_dict= {}
|
|
|
request_data_dict["inputs"] = inputs_data
|