|
@@ -1,4 +1,7 @@
|
|
|
|
+import argparse
|
|
import gzip
|
|
import gzip
|
|
|
|
+import sys
|
|
|
|
+
|
|
import pandas as pd
|
|
import pandas as pd
|
|
|
|
|
|
from hdfs import InsecureClient
|
|
from hdfs import InsecureClient
|
|
@@ -28,9 +31,9 @@ def read_predict(hdfs_path: str) -> list:
|
|
return result
|
|
return result
|
|
|
|
|
|
|
|
|
|
-def _main():
|
|
|
|
- model1_result = read_predict("/dw/recommend/model/34_ad_predict_data/20241004_351_0927_1003_1000/")
|
|
|
|
- model2_result = read_predict("/dw/recommend/model/34_ad_predict_data/20241004_351_0927_1003_1000/")
|
|
|
|
|
|
+def _main(model1_predict_path: str, model2_predict_path: str):
|
|
|
|
+ model1_result = read_predict(model1_predict_path)
|
|
|
|
+ model2_result = read_predict(model2_predict_path)
|
|
|
|
|
|
m1 = pd.DataFrame(model1_result)
|
|
m1 = pd.DataFrame(model1_result)
|
|
g1 = m1.groupby("cid").agg(count=('cid', 'size'), average_value=('score', 'mean'))
|
|
g1 = m1.groupby("cid").agg(count=('cid', 'size'), average_value=('score', 'mean'))
|
|
@@ -46,12 +49,12 @@ def _main():
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
- # parser = argparse.ArgumentParser(description="model_predict_analyse.py")
|
|
|
|
- # parser.add_argument("-p", "--predict_path_list", type=list, help="config file path")
|
|
|
|
- # args = parser.parse_args()
|
|
|
|
- #
|
|
|
|
- # predict_path_list = args.predict_path_list
|
|
|
|
- # # 判断参数是否正常
|
|
|
|
- # if len(predict_path_list) != 2:
|
|
|
|
- # sys.exit(1)
|
|
|
|
- _main()
|
|
|
|
|
|
+ parser = argparse.ArgumentParser(description="model_predict_analyse.py")
|
|
|
|
+ parser.add_argument("-p", "--predict_path_list", type=list, help="config file path")
|
|
|
|
+ args = parser.parse_args()
|
|
|
|
+
|
|
|
|
+ predict_path_list = args.predict_path_list
|
|
|
|
+ # 判断参数是否正常
|
|
|
|
+ if len(predict_path_list) != 2:
|
|
|
|
+ sys.exit(1)
|
|
|
|
+ _main(predict_path_list[0], predict_path_list[1])
|