|
@@ -38,18 +38,21 @@ def get_threshold_record_new(ad_abtest_abcode_config, feature_df, threshold_reco
|
|
|
if len(ab_code_list) > 0:
|
|
|
b_mean = temp_df[temp_df['adcode'].isin(ab_code_list)]['b'].mean()
|
|
|
if b_mean < 0:
|
|
|
- # 阈值调高
|
|
|
- threshold_param_new = float(threshold_record.get(ad_abtest_tag)) + threshold_update
|
|
|
+ # 阈值按梯度调高
|
|
|
+ b_i = (b_mean * -1)//0.05 + 1
|
|
|
+ threshold_param_new = float(threshold_record.get(ad_abtest_tag)) + threshold_update * b_i
|
|
|
elif b_mean > 0.1:
|
|
|
# 阈值调低
|
|
|
threshold_param_new = float(threshold_record.get(ad_abtest_tag)) - threshold_update
|
|
|
+ b_i = 1
|
|
|
else:
|
|
|
continue
|
|
|
if threshold_param_new > 0:
|
|
|
threshold_record_new[ad_abtest_tag] = threshold_param_new
|
|
|
robot_msg_record.append({'appType': app_type, 'ad_abtest_tag': ad_abtest_tag,
|
|
|
- 'param_old': float(threshold_record.get(ad_abtest_tag)),
|
|
|
- 'param_new': threshold_param_new})
|
|
|
+ 'b_i': int(b_i), 'gradient': round(threshold_update, 4),
|
|
|
+ 'param_old': round(float(threshold_record.get(ad_abtest_tag)), 4),
|
|
|
+ 'param_new': round(threshold_param_new, 4)})
|
|
|
return threshold_record_new, robot_msg_record
|
|
|
|
|
|
|