|
@@ -33,15 +33,15 @@ features = [
|
|
|
'apptype',
|
|
|
'code',
|
|
|
'videoid',
|
|
|
- 'lastonehour_preview',
|
|
|
- 'lastonehour_view',
|
|
|
- 'lastonehour_play',
|
|
|
- 'lastonehour_share',
|
|
|
- 'lastonehour_return',
|
|
|
- 'lastonehour_preview_total',
|
|
|
- 'lastonehour_view_total',
|
|
|
- 'lastonehour_play_total',
|
|
|
- 'lastonehour_share_total',
|
|
|
+ 'lastonehour_preview',
|
|
|
+ 'lastonehour_view',
|
|
|
+ 'lastonehour_play',
|
|
|
+ 'lastonehour_share',
|
|
|
+ 'lastonehour_return',
|
|
|
+ 'lastonehour_preview_total',
|
|
|
+ 'lastonehour_view_total',
|
|
|
+ 'lastonehour_play_total',
|
|
|
+ 'lastonehour_share_total',
|
|
|
'platform_return',
|
|
|
'lastonehour_show',
|
|
|
'lastonehour_show_region',
|
|
@@ -162,6 +162,7 @@ def cal_score_initial(df, param):
|
|
|
else:
|
|
|
df['ctr'] = df['lastonehour_play'] / (df['lastonehour_preview'] + 1000)
|
|
|
df['K2'] = df['ctr'].apply(lambda x: 0.6 if x > 0.6 else x)
|
|
|
+
|
|
|
df['platform_return_rate'] = df['platform_return'] / df['lastonehour_return']
|
|
|
|
|
|
df['score1'] = df['share_rate'] * df['back_rate'] * df['log_back'] * df['K2']
|
|
@@ -348,6 +349,36 @@ def cal_score_multiply_return_retention_with_new_return(df, param):
|
|
|
return df
|
|
|
|
|
|
|
|
|
+def cal_score_with_back_view0(df, param):
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ df = df.fillna(0)
|
|
|
+ df['share_rate'] = (df['lastonehour_share'] + 1) / (df['lastonehour_play'] + 1000)
|
|
|
+ df['back_rate'] = (df['lastonehour_return'] + 1) / (df['lastonehour_share'] + 10)
|
|
|
+ df['log_back'] = (df['lastonehour_return'] + 1).apply(math.log)
|
|
|
+ df['ctr'] = (df['lastonehour_play'] + 1) / (df['lastonehour_view'] + 100)
|
|
|
+ df['platform_return_rate'] = df['platform_return'] / df['lastonehour_return']
|
|
|
+ df['score'] = df['share_rate'] * df['back_rate'] * df['log_back'] * df['ctr']
|
|
|
+ df = df.sort_values(by=['score'], ascending=False)
|
|
|
+ return df
|
|
|
+
|
|
|
+
|
|
|
+def cal_score_with_back_view1(df, param):
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ df = df.fillna(0)
|
|
|
+ df['back_play_rate'] = (df['lastonehour_return'] + 1) / (df['lastonehour_play'] + 1000)
|
|
|
+ df['log_back'] = (df['lastonehour_return'] + 1).apply(math.log)
|
|
|
+ df['ctr'] = (df['lastonehour_play'] + 1) / (df['lastonehour_view'] + 100)
|
|
|
+ df['platform_return_rate'] = df['platform_return'] / df['lastonehour_return']
|
|
|
+ df['score'] = df['back_play_rate'] * df['log_back'] * df['ctr']
|
|
|
+ df = df.sort_values(by=['score'], ascending=False)
|
|
|
+ return df
|
|
|
+
|
|
|
+
|
|
|
def cal_score(df, param):
|
|
|
if param.get('return_data', None) == 'share_region_return':
|
|
|
if param.get('score_func', None) == 'multiply_return_retention':
|
|
@@ -361,6 +392,10 @@ def cal_score(df, param):
|
|
|
df = cal_score_multiply_return_retention(df=df, param=param)
|
|
|
elif param.get('score_func', None) == 'update_backrate':
|
|
|
df = cal_score_update_backrate(df=df, param=param)
|
|
|
+ elif param.get('score_func', None) == 'back_view0':
|
|
|
+ df = cal_score_with_back_view0(df=df, param=param)
|
|
|
+ elif param.get('score_func', None) == 'back_view1':
|
|
|
+ df = cal_score_with_back_view1(df=df, param=param)
|
|
|
else:
|
|
|
df = cal_score_initial(df=df, param=param)
|
|
|
return df
|