Browse Source

feat:修改模型训练脚本

zhaohaipeng 8 months ago
parent
commit
1a501b56f8
1 changed files with 37 additions and 0 deletions
  1. 37 0
      recommend/21_vid_score_restore.sh

+ 37 - 0
recommend/21_vid_score_restore.sh

@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# 将负样本采样后的数据还原,再计算平均值
+
+
+set -x
+
+predict_date=$1
+model_name=$2
+
+PROJECT_HOME=/root/zhaohp/recommend-emr-dataprocess/
+PREDICT_PATH=${PROJECT_HOME}/predict/recommend/
+
+
+
+vids=(22895200 22751457 14146727 22847440 22927926 22858609 22974689 22563167 22959023 22970515 22946931 22994781 20720060 22979110)
+
+main() {
+    for(( i = 0; i < ${#vids[@]}; i++)) do
+        vid=${vids[i]}
+        score_avg=$(awk '{
+            score = $2
+            new_score = ( 0.1 * score ) / ( 1 - 0.9 * score)
+            sum += new_score
+            count++
+        } END {
+            if ( count > 0 ){
+                print sum / count
+            } else {
+                print "NaN"
+            }
+        }' ${PREDICT_PATH}/${model_name}_${predict_date}_${vid}.txt)
+        echo -e "VID: ${vid} 平均分计算结果: ${score_avg} \n\t数据路径: ${PREDICT_PATH}/${model_name}_${predict_date}_${vid}.txt"
+    done
+}
+
+main