|
@@ -31,51 +31,92 @@ PREDICT_PATH=/root/joe/recommend-emr-dataprocess/predict
|
|
|
|
|
|
LAST_MODEL_HOME=/root/joe/model_online
|
|
|
|
|
|
-model_name=akaqjl8
|
|
|
+model_name=aka8
|
|
|
|
|
|
FM_HOME=/root/sunmingze/alphaFM/bin
|
|
|
|
|
|
HADOOP=/opt/apps/HADOOP-COMMON/hadoop-common-current/bin/hadoop
|
|
|
+OSS_PATH=oss://art-recommend.oss-cn-hangzhou.aliyuncs.com/zhangbo/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+echo "$(date +%Y-%m-%d_%H-%M-%S)----------step0------------开始对比,新:${MODEL_PATH}/${model_name}_${today_early_3}.txt,与线上online模型数据auc效果"
|
|
|
+$HADOOP fs -text ${bucketDataPath}/${begin_early_2_Str}/* | ${FM_HOME}/fm_predict -m ${LAST_MODEL_HOME}/model_online.txt -dim 8 -core 8 -out ${PREDICT_PATH}/${model_name}_${today}_online.txt
|
|
|
+$HADOOP fs -text ${bucketDataPath}/${begin_early_2_Str}/* | ${FM_HOME}/fm_predict -m ${MODEL_PATH}/${model_name}_${today_early_3}.txt -dim 8 -core 8 -out ${PREDICT_PATH}/${model_name}_${today}_new.txt
|
|
|
+
|
|
|
+online_auc=`cat ${PREDICT_PATH}/${model_name}_${today}_online.txt | /root/sunmingze/AUC/AUC`
|
|
|
+if [ $? -ne 0 ]; then
|
|
|
+ echo "推荐线上模型AUC计算失败"
|
|
|
+
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
+
|
|
|
+new_auc=`cat ${PREDICT_PATH}/${model_name}_${today}_new.txt | /root/sunmingze/AUC/AUC`
|
|
|
+if [ $? -ne 0 ]; then
|
|
|
+ echo "推荐新模型AUC计算失败"
|
|
|
+
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+if [ "$online_auc" \< "$new_auc" ]; then
|
|
|
+ echo "新模型优于线上模型: 线上模型AUC: ${online_auc}, 新模型AUC: ${new_auc}"
|
|
|
+
|
|
|
+ cat ${MODEL_PATH}/${model_name}_${today_early_3}.txt |
|
|
|
+ awk -F " " '{
|
|
|
+ if (NR == 1) {
|
|
|
+ print $1"\t"$2
|
|
|
+ } else {
|
|
|
+ split($0, fields, " ");
|
|
|
+ OFS="\t";
|
|
|
+ line="" 1; i <= 10 && i <= length(fields); i++) {
|
|
|
+ line
|
|
|
+ for (i = = (line ? line "\t" : "") fields[i];
|
|
|
+ }
|
|
|
+ print line
|
|
|
+ }
|
|
|
+ }' > ${MODEL_PATH}/${model_name}_${today_early_3}_change.txt
|
|
|
+ if [ $? -ne 0 ]; then
|
|
|
+ echo "新模型文件格式转换失败"
|
|
|
+
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
+
|
|
|
+ online_model_path=${OSS_PATH}/${model_name}.txt
|
|
|
+ $HADOOP fs -test -e ${online_model_path}
|
|
|
+ if [ $? -eq 0 ]; then
|
|
|
+ echo "数据存在, 先删除。"
|
|
|
+ $HADOOP fs -rm -r -skipTrash ${online_model_path}
|
|
|
+ else
|
|
|
+ echo "数据不存在"
|
|
|
+ fi
|
|
|
+
|
|
|
+ $HADOOP fs -put ${MODEL_PATH}/${model_name}_${today_early_3}_change.txt ${online_model_path}
|
|
|
+ if [ $? -eq 0 ]; then
|
|
|
+ echo "推荐模型文件至OSS成功"
|
|
|
+ else
|
|
|
+ echo "推荐模型文件至OSS失败"
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
+
|
|
|
+ cp -f ${LAST_MODEL_HOME}/model_online.txt ${LAST_MODEL_HOME}/model_online_$(date +\%Y\%m\%d).txt
|
|
|
+ cp -f ${MODEL_PATH}/${model_name}_${today_early_3}.txt ${LAST_MODEL_HOME}/model_online.txt
|
|
|
+ if [ $? -ne 0 ]; then
|
|
|
+ echo "模型备份失败"
|
|
|
+
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
+
|
|
|
+else
|
|
|
+ echo "新模型不如线上模型: 线上模型AUC: ${online_auc}, 新模型AUC: ${new_auc}"
|
|
|
+
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
echo "$(date +%Y-%m-%d_%H-%M-%S)----------step1------------开始校验是否生产完数据,分区信息:beginStr:${begin_early_2_Str}${beginHhStr},endStr:${end_early_2_Str}${endHhStr}"
|
|
|
while true; do
|