|
@@ -22,17 +22,22 @@ feature_file=20240703_ad_feature_name.txt
|
|
model_local_home=/root/zhaohp/XGB/
|
|
model_local_home=/root/zhaohp/XGB/
|
|
|
|
|
|
# 模型HDFS保存路径,测试时修改为其他路径,避免影响线上
|
|
# 模型HDFS保存路径,测试时修改为其他路径,避免影响线上
|
|
-MODEL_PATH=/dw/recommend/model/35_ad_model_test
|
|
|
|
|
|
+MODEL_PATH=/dw/recommend/model/35_ad_model
|
|
# 预测结果保存路径,测试时修改为其他路径,避免影响线上
|
|
# 预测结果保存路径,测试时修改为其他路径,避免影响线上
|
|
-PREDICT_RESULT_SAVE_PATH=/dw/recommend/model/34_ad_predict_data_test
|
|
|
|
|
|
+PREDICT_RESULT_SAVE_PATH=/dw/recommend/model/34_ad_predict_data
|
|
# 模型OSS保存路径,测试时修改为其他路径,避免影响线上
|
|
# 模型OSS保存路径,测试时修改为其他路径,避免影响线上
|
|
-MODEL_OSS_PATH=oss://art-recommend.oss-cn-hangzhou.aliyuncs.com/model/
|
|
|
|
|
|
+MODEL_OSS_PATH=oss://art-recommend.oss-cn-hangzhou.aliyuncs.com/zhangbo/
|
|
# 线上模型名,测试时修改为其他模型名,避免影响线上
|
|
# 线上模型名,测试时修改为其他模型名,避免影响线上
|
|
-model_name=model_xgb_351_1000_v2_test
|
|
|
|
|
|
+model_name=model_xgb_351_1000_v2
|
|
# 本地保存HDFS模型路径文件,测试时修改为其他模型名,避免影响线上
|
|
# 本地保存HDFS模型路径文件,测试时修改为其他模型名,避免影响线上
|
|
-model_path_file=${model_local_home}/online_model_path_test.txt
|
|
|
|
|
|
+model_path_file=${model_local_home}/online_model_path.txt
|
|
|
|
|
|
|
|
+# 任务开始时间
|
|
|
|
+start_time=$(date +%s)
|
|
|
|
+# 前一天
|
|
today_early_1="$(date -d '1 days ago' +%Y%m%d)"
|
|
today_early_1="$(date -d '1 days ago' +%Y%m%d)"
|
|
|
|
+# 线上模型在HDFS中的路径
|
|
|
|
+online_model_path=`cat ${model_path_file}`
|
|
# 训练用的数据路径
|
|
# 训练用的数据路径
|
|
train_data_path=""
|
|
train_data_path=""
|
|
# 评估用的数据路径
|
|
# 评估用的数据路径
|
|
@@ -41,11 +46,6 @@ predict_date_path=""
|
|
new_model_predict_result_path=""
|
|
new_model_predict_result_path=""
|
|
# 模型保存路径
|
|
# 模型保存路径
|
|
model_save_path=""
|
|
model_save_path=""
|
|
-
|
|
|
|
-# 任务开始时间
|
|
|
|
-start_time=$(date +%s)
|
|
|
|
-# 线上模型在HDFS中的路径
|
|
|
|
-online_model_path=`cat ${model_path_file}`
|
|
|
|
# 评测结果保存路径,后续需要根据此文件评估是否要更新模型
|
|
# 评测结果保存路径,后续需要根据此文件评估是否要更新模型
|
|
predict_analyse_file_path=""
|
|
predict_analyse_file_path=""
|
|
# 保存模型评估的分析结果
|
|
# 保存模型评估的分析结果
|
|
@@ -225,13 +225,11 @@ calc_model_predict() {
|
|
check_run_status $return_code $step_start_time "计算Top10差异"
|
|
check_run_status $return_code $step_start_time "计算Top10差异"
|
|
|
|
|
|
old_incr_rate_avg=$( echo "scale=6; ${old_total_diff} / ${count}" | bc -l )
|
|
old_incr_rate_avg=$( echo "scale=6; ${old_total_diff} / ${count}" | bc -l )
|
|
- return_code=$?
|
|
|
|
- check_run_status $return_code $step_start_time "计算老模型Top10差异"
|
|
|
|
|
|
+ check_run_status $? $step_start_time "计算老模型Top10差异"
|
|
|
|
|
|
|
|
|
|
new_incr_rate_avg=$( echo "scale=6; ${new_total_diff} / ${count}" | bc -l )
|
|
new_incr_rate_avg=$( echo "scale=6; ${new_total_diff} / ${count}" | bc -l )
|
|
- return_code=$?
|
|
|
|
- check_run_status $return_code $step_start_time "计算新模型Top10差异"
|
|
|
|
|
|
+ check_run_status $? $step_start_time "计算新模型Top10差异"
|
|
|
|
|
|
echo "老模型Top10差异平均值: ${old_incr_rate_avg}"
|
|
echo "老模型Top10差异平均值: ${old_incr_rate_avg}"
|
|
echo "老模型Top10差异列表: ${old_incr_rate_list}"
|
|
echo "老模型Top10差异列表: ${old_incr_rate_list}"
|
|
@@ -243,29 +241,29 @@ model_predict() {
|
|
|
|
|
|
# 线上模型评估最新的数据
|
|
# 线上模型评估最新的数据
|
|
local step_start_time=$(date +%s)
|
|
local step_start_time=$(date +%s)
|
|
- # /opt/apps/SPARK3/spark-3.3.1-hadoop3.2-1.0.5/bin/spark-class org.apache.spark.deploy.SparkSubmit \
|
|
|
|
- # --class com.tzld.piaoquan.recommend.model.pred_01_xgb_ad_hdfsfile_20240813 \
|
|
|
|
- # --master yarn --driver-memory 1G --executor-memory 1G --executor-cores 1 --num-executors 30 \
|
|
|
|
- # --conf spark.yarn.executor.memoryoverhead=1024 \
|
|
|
|
- # --conf spark.shuffle.service.enabled=true \
|
|
|
|
- # --conf spark.shuffle.service.port=7337 \
|
|
|
|
- # --conf spark.shuffle.consolidateFiles=true \
|
|
|
|
- # --conf spark.shuffle.manager=sort \
|
|
|
|
- # --conf spark.storage.memoryFraction=0.4 \
|
|
|
|
- # --conf spark.shuffle.memoryFraction=0.5 \
|
|
|
|
- # --conf spark.default.parallelism=200 \
|
|
|
|
- # /root/zhangbo/recommend-model/recommend-model-produce/target/recommend-model-produce-jar-with-dependencies.jar \
|
|
|
|
- # featureFile:20240703_ad_feature_name.txt \
|
|
|
|
- # testPath:${predict_date_path} \
|
|
|
|
- # savePath:${online_model_predict_result_path} \
|
|
|
|
- # modelPath:${online_model_path}
|
|
|
|
-
|
|
|
|
- # local return_code=$?
|
|
|
|
- # check_run_status $return_code $step_start_time "线上模型评估${predict_date_path: -8}的数据"
|
|
|
|
|
|
+ /opt/apps/SPARK3/spark-3.3.1-hadoop3.2-1.0.5/bin/spark-class org.apache.spark.deploy.SparkSubmit \
|
|
|
|
+ --class com.tzld.piaoquan.recommend.model.pred_01_xgb_ad_hdfsfile_20240813 \
|
|
|
|
+ --master yarn --driver-memory 1G --executor-memory 1G --executor-cores 1 --num-executors 30 \
|
|
|
|
+ --conf spark.yarn.executor.memoryoverhead=1024 \
|
|
|
|
+ --conf spark.shuffle.service.enabled=true \
|
|
|
|
+ --conf spark.shuffle.service.port=7337 \
|
|
|
|
+ --conf spark.shuffle.consolidateFiles=true \
|
|
|
|
+ --conf spark.shuffle.manager=sort \
|
|
|
|
+ --conf spark.storage.memoryFraction=0.4 \
|
|
|
|
+ --conf spark.shuffle.memoryFraction=0.5 \
|
|
|
|
+ --conf spark.default.parallelism=200 \
|
|
|
|
+ /root/zhangbo/recommend-model/recommend-model-produce/target/recommend-model-produce-jar-with-dependencies.jar \
|
|
|
|
+ featureFile:20240703_ad_feature_name.txt \
|
|
|
|
+ testPath:${predict_date_path} \
|
|
|
|
+ savePath:${online_model_predict_result_path} \
|
|
|
|
+ modelPath:${online_model_path}
|
|
|
|
+
|
|
|
|
+ local return_code=$?
|
|
|
|
+ check_run_status $return_code $step_start_time "线上模型评估${predict_date_path: -8}的数据"
|
|
|
|
|
|
# 结果分析
|
|
# 结果分析
|
|
- # local python_return_code=$(python ${sh_path}/model_predict_analyse.py -p ${online_model_predict_result_path} ${new_model_predict_result_path} -f ${predict_analyse_file_path})
|
|
|
|
- # check_run_status $python_return_code $step_start_time "线上模型评估${predict_date_path: -8}的数据"
|
|
|
|
|
|
+ local python_return_code=$(python ${sh_path}/model_predict_analyse.py -p ${online_model_predict_result_path} ${new_model_predict_result_path} -f ${predict_analyse_file_path})
|
|
|
|
+ check_run_status $python_return_code $step_start_time "线上模型评估${predict_date_path: -8}的数据"
|
|
|
|
|
|
calc_model_predict
|
|
calc_model_predict
|
|
|
|
|
|
@@ -321,13 +319,13 @@ model_upload_oss() {
|
|
main() {
|
|
main() {
|
|
init
|
|
init
|
|
|
|
|
|
- # check_ad_hive
|
|
|
|
|
|
+ check_ad_hive
|
|
|
|
|
|
- # origin_data
|
|
|
|
|
|
+ origin_data
|
|
|
|
|
|
- # bucket_feature
|
|
|
|
|
|
+ bucket_feature
|
|
|
|
|
|
- # xgb_train
|
|
|
|
|
|
+ xgb_train
|
|
|
|
|
|
model_predict
|
|
model_predict
|
|
|
|
|