瀏覽代碼

feat:修改绝对值计算

zhaohaipeng 5 月之前
父節點
當前提交
f2585d86e0
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      ad/02_ad_model_update_test.sh

+ 2 - 2
ad/02_ad_model_update_test.sh

@@ -43,8 +43,8 @@ calc_model_predict() {
       top10_msg="${top10_msg} \n| ${numbers[0]} | ${numbers[6]} | ${numbers[7]} | "
       top10_msg="${top10_msg} \n| ${numbers[0]} | ${numbers[6]} | ${numbers[7]} | "
 
 
       # 计算top10相对误差绝对值的均值
       # 计算top10相对误差绝对值的均值
-      old_abs_score=$( echo "if(${numbers[6]} < 0) -${numbers[6]} else ${numbers[6]}" | bc -l )
-      new_abs_score=$( echo "if(${numbers[7]} < 0) -${numbers[7]} else ${numbers[7]}" | bc -l )
+      old_abs_score=$( echo "${numbers[6]} * ((${numbers[6]} >= 0) * 2 - 1)" | bc -l )
+      new_abs_score=$( echo "${numbers[7]} * ((${numbers[7]} >= 0) * 2 - 1)" | bc -l )
 
 
       old_total_diff=$( echo "${old_total_diff} + ${old_abs_score}" | bc -l )
       old_total_diff=$( echo "${old_total_diff} + ${old_abs_score}" | bc -l )
       new_total_diff=$( echo "${new_total_diff} + ${new_abs_score}" | bc -l )
       new_total_diff=$( echo "${new_total_diff} + ${new_abs_score}" | bc -l )