|
@@ -95,13 +95,19 @@ def get_threshold_record_new_by_uv(ad_abtest_abcode_config, feature_df, threshol
|
|
# 获取当前阈值参数
|
|
# 获取当前阈值参数
|
|
threshold_param_old = threshold_record_old[ab_test_group].get('group')
|
|
threshold_param_old = threshold_record_old[ab_test_group].get('group')
|
|
if uv_differ < 0:
|
|
if uv_differ < 0:
|
|
- # 当前uv < 目标uv,阈值按梯度调低
|
|
|
|
- step = math.ceil((uv_differ * -1) / gradient)
|
|
|
|
|
|
+ # 当前uv < 目标uv,阈值按梯度调低(第一个梯度区间:向上取整,之后:四舍五入)
|
|
|
|
+ if abs(uv_differ) < gradient:
|
|
|
|
+ step = math.ceil(abs(uv_differ) / gradient)
|
|
|
|
+ else:
|
|
|
|
+ step = round(abs(uv_differ) / gradient)
|
|
step = max_update_step if step > max_update_step else step
|
|
step = max_update_step if step > max_update_step else step
|
|
threshold_param_new = float(threshold_param_old) - update_range * step
|
|
threshold_param_new = float(threshold_param_old) - update_range * step
|
|
elif uv_differ > 0:
|
|
elif uv_differ > 0:
|
|
- # 当前uv > 目标uv,阈值按梯度调高
|
|
|
|
- step = math.ceil(uv_differ / gradient)
|
|
|
|
|
|
+ # 当前uv > 目标uv,阈值按梯度调高(第一个梯度区间:向上取整,之后:四舍五入)
|
|
|
|
+ if uv_differ < gradient:
|
|
|
|
+ step = math.ceil(uv_differ / gradient)
|
|
|
|
+ else:
|
|
|
|
+ step = round(uv_differ / gradient)
|
|
step = max_update_step if step > max_update_step else step
|
|
step = max_update_step if step > max_update_step else step
|
|
threshold_param_new = float(threshold_param_old) + update_range * step
|
|
threshold_param_new = float(threshold_param_old) + update_range * step
|
|
else:
|
|
else:
|