Browse Source

update video rank

linfan 1 year ago
parent
commit
fc744766fa
1 changed files with 21 additions and 0 deletions
  1. 21 0
      video_rank.py

+ 21 - 0
video_rank.py

@@ -668,6 +668,27 @@ def video_new_rank2(data, size, top_K, flow_pool_P, ab_code, mid, exp_config=Non
                             total_score = return_score * score_result[i][0]
                         rec_recall_item_list[i]['sort_score'] = total_score
                         print("total_score:", total_score, " model score :", score_result[i][0], "return_score:", return_score)
+                try:
+                    if video_scores[i] is None and len(score_result[i])>0:
+                        return_score = 0.000000001
+                        # sore_index :10 = model score
+                        if sort_index == 10:
+                            total_score = score_result[i][0]
+                        else:
+                            total_score = return_score * score_result[i][0]
+                        rec_recall_item_list[i]['sort_score'] = total_score
+                    else:
+                        video_score_str = json.loads(video_scores[i])
+                        # sore_index :10 = model score
+                        if sort_index == 10:
+                            total_score = score_result[i][0]
+                        else:
+                            return_score = 0.000000001
+                            if len(video_score_str)>= sort_index and  len(video_score_str)>0:
+                                return_score = video_score_str[sort_index]
+                            total_score = return_score * score_result[i][0]
+                        rec_recall_item_list[i]['sort_score'] = total_score
+                        print("total_score:", total_score, " model score :", score_result[i][0], "return_score:", return_score)return_score
                 except Exception as e:
                     print('exception: {}:', e)
                     if sort_index == 10: