|
@@ -126,7 +126,7 @@ mid AS u_id
|
|
,round(if(i_rov_3month > 10.0, 10.0, i_rov_3month) / 10.0, 6) as i_rov_3month
|
|
,round(if(i_rov_3month > 10.0, 10.0, i_rov_3month) / 10.0, 6) as i_rov_3month
|
|
,round(if(i_ros_3month > 10.0, 10.0, i_ros_3month) / 10.0, 6) as i_ros_3month
|
|
,round(if(i_ros_3month > 10.0, 10.0, i_ros_3month) / 10.0, 6) as i_ros_3month
|
|
from
|
|
from
|
|
-user_video_features_data_final
|
|
|
|
|
|
+loghubods.user_video_features_data_final
|
|
where dt='{datetime}'
|
|
where dt='{datetime}'
|
|
and ad_ornot = '0'
|
|
and ad_ornot = '0'
|
|
and apptype != '13'
|
|
and apptype != '13'
|
|
@@ -238,12 +238,14 @@ from candidate_item
|
|
print(key_name_prefix)
|
|
print(key_name_prefix)
|
|
mean_item_h = 0.0
|
|
mean_item_h = 0.0
|
|
count_item_h = 0
|
|
count_item_h = 0
|
|
|
|
+ # 过期时间:一周
|
|
|
|
+ expire_time = 7 * 24 * 3600
|
|
with data.open_reader() as reader:
|
|
with data.open_reader() as reader:
|
|
for row in tqdm(reader):
|
|
for row in tqdm(reader):
|
|
k = str(row['i_id'])
|
|
k = str(row['i_id'])
|
|
item_features = get_item_features(row)
|
|
item_features = get_item_features(row)
|
|
item_h = lr_model.predict_h(item_features)
|
|
item_h = lr_model.predict_h(item_features)
|
|
- redis_helper.set_data_to_redis(f"{key_name_prefix}:{k}", item_h, 28 * 3600)
|
|
|
|
|
|
+ redis_helper.set_data_to_redis(f"{key_name_prefix}:{k}", item_h, expire_time)
|
|
item_h_dict[k] = item_h
|
|
item_h_dict[k] = item_h
|
|
mean_item_h += item_h
|
|
mean_item_h += item_h
|
|
count_item_h += 1
|
|
count_item_h += 1
|
|
@@ -254,7 +256,7 @@ from candidate_item
|
|
print(mean_item_h)
|
|
print(mean_item_h)
|
|
print(count_item_h)
|
|
print(count_item_h)
|
|
k = 'mean'
|
|
k = 'mean'
|
|
- redis_helper.set_data_to_redis(f"{key_name_prefix}:{k}", mean_item_h, 28 * 3600)
|
|
|
|
|
|
+ redis_helper.set_data_to_redis(f"{key_name_prefix}:{k}", mean_item_h, expire_time)
|
|
with open('{}.json'.format(key_name_prefix), 'w') as fout:
|
|
with open('{}.json'.format(key_name_prefix), 'w') as fout:
|
|
json.dump(item_h_dict, fout, indent=2, ensure_ascii=False, sort_keys=True)
|
|
json.dump(item_h_dict, fout, indent=2, ensure_ascii=False, sort_keys=True)
|
|
|
|
|