瀏覽代碼

feat:添加评估结果分析脚本

zhaohaipeng 6 月之前
父節點
當前提交
216c6d4b7e
共有 1 個文件被更改,包括 9 次插入3 次删除
  1. 9 3
      ad/model_predict_analyse.py

+ 9 - 3
ad/model_predict_analyse.py

@@ -3,7 +3,6 @@ import gzip
 import sys
 
 import pandas as pd
-
 from hdfs import InsecureClient
 
 client = InsecureClient("http://master-1-1.c-7f31a3eea195cb73.cn-hangzhou.emr.aliyuncs.com:9870", user="spark")
@@ -32,6 +31,15 @@ def read_predict(hdfs_path: str) -> list:
 
 
 def _main(model1_predict_path: str, model2_predict_path: str):
+    if not model1_predict_path.endswith("/"):
+        model1_predict_path += "/"
+
+    if not model2_predict_path.endswith("/"):
+        model2_predict_path += "/"
+
+    # # 设置 pandas 显示选项
+    # pd.set_option('display.max_rows', None)  # 显示所有行
+    # pd.set_option('display.max_columns', None)  # 显示所有列
 
     model1_result = read_predict(model1_predict_path)
     model2_result = read_predict(model2_predict_path)
@@ -55,8 +63,6 @@ def _main(model1_predict_path: str, model2_predict_path: str):
     # 计算差值的平均值,并保留六位小数
     mean_abs_diff = round(merged['score_diff'].mean(), 6)
 
-    print(mean_abs_diff)
-    
 
 if __name__ == '__main__':
     parser = argparse.ArgumentParser(description="model_predict_analyse.py")