xueyiming 14 часов назад
Родитель
Сommit
a39f702684
1 измененных файлов с 12 добавлено и 7 удалено
  1. 12 7
      ad/pai_flow_operator_v3.py

+ 12 - 7
ad/pai_flow_operator_v3.py

@@ -683,8 +683,8 @@ def validate_model_data_accuracy():
         ]
         msg = f'DNN广告模型评估{bizdate}'
         top10_msg = ''
-        result = True
-        level = 'info'
+        auc_decline_threshold = 0.0005
+        auc_check_passed = True
 
         for name, compare_key, new_eval_key, old_eval_key in categories:
             df = get_data_from_odps('pai_algo', table_dict[compare_key], num)
@@ -693,6 +693,9 @@ def validate_model_data_accuracy():
             new_auc = get_dict_from_odps('pai_algo', table_dict[new_eval_key])['AUC']
             old_auc = get_dict_from_odps('pai_algo', table_dict[old_eval_key])['AUC']
 
+            if name in ('扫码', '加微') and old_auc - new_auc > auc_decline_threshold:
+                auc_check_passed = False
+
             msg += f'\n【{name}】'
             msg += f'\n\t - 老模型AUC: {old_auc}'
             msg += f'\n\t - 新模型AUC: {new_auc}'
@@ -706,6 +709,8 @@ def validate_model_data_accuracy():
             top10_msg += section_msg
             print(section_msg)
 
+        result = auc_check_passed
+        level = 'info' if result else 'error'
         return result, msg, level, top10_msg
 
     except Exception as e:
@@ -788,11 +793,11 @@ if __name__ == '__main__':
     else:
         print("所有函数都成功执行,可以继续下一步操作。")
         result, msg, level, top10_msg = validate_model_data_accuracy()
-        # if result:
-            # update_online_res = update_online_model()
-            # if update_online_res:
-            #     update_trained_cids_pointer()
-            #     print("success")
+        if result:
+            update_online_res = update_online_model()
+            if update_online_res:
+                # update_trained_cids_pointer()
+                print("success")
         step_end_time = int(time.time())
         elapsed = step_end_time - start_time
         print(level, msg, start_time, elapsed, top10_msg)