Commit ef5bbbd0 authored by 宋柯's avatar 宋柯

模型上线

parent 877cf714
...@@ -1103,19 +1103,17 @@ if __name__ == '__main__': ...@@ -1103,19 +1103,17 @@ if __name__ == '__main__':
spark = get_spark("SERVICE_FEATURE_CSV_EXPORT_SK") spark = get_spark("SERVICE_FEATURE_CSV_EXPORT_SK")
spark.sparkContext.setLogLevel("ERROR") spark.sparkContext.setLogLevel("ERROR")
#获取点击曝光数据 #获取点击曝光数据
# clickDF, expDF, ratingDF, startDay, endDay = get_click_exp_rating_df(trainDays, spark) clickDF, expDF, ratingDF, startDay, endDay = get_click_exp_rating_df(trainDays, spark)
#item Es Feature #item Es Feature
# itemEsFeatureDF = get_item_es_feature_df() itemEsFeatureDF = get_item_es_feature_df()
#计算 item 统计特征 #计算 item 统计特征
# clickStaticFeatures, expStaticFeatures = getItemStaticFeatures(itemStatisticStartDays + trainDays + 1, startDay, endDay) clickStaticFeatures, expStaticFeatures = getItemStaticFeatures(itemStatisticStartDays + trainDays + 1, startDay, endDay)
#计算线上推理 item 统计特征 #计算线上推理 item 统计特征
predictClickStaticFeatures, predictExpStaticFeatures = getPredictItemStaticFeatures(itemStatisticStartDays) predictClickStaticFeatures, predictExpStaticFeatures = getPredictItemStaticFeatures(itemStatisticStartDays)
predictClickStaticFeatures.show(100, False)
predictExpStaticFeatures.show(100, False)
#user Profile Feature #user Profile Feature
userProfileFeatureDF = getUserProfileFeature(spark, addDays(-trainDays - 1, format = "%Y-%m-%d"), addDays(-1, format = "%Y-%m-%d")) userProfileFeatureDF = getUserProfileFeature(spark, addDays(-trainDays - 1, format = "%Y-%m-%d"), addDays(-1, format = "%Y-%m-%d"))
...@@ -1221,6 +1219,15 @@ if __name__ == '__main__': ...@@ -1221,6 +1219,15 @@ if __name__ == '__main__':
print("训练数据写入 耗时s:{}".format(time.time() - write_time_start)) print("训练数据写入 耗时s:{}".format(time.time() - write_time_start))
#存入线上预测特征
# card_id | ITEM_NUMERIC_click_count_sum | ITEM_NUMERIC_click_count_avg | ITEM_NUMERIC_click_count_stddev
predictClickStaticDF = predictClickStaticFeatures.toPandas()
# card_id | ITEM_NUMERIC_exp_count_sum | ITEM_NUMERIC_exp_count_avg | ITEM_NUMERIC_exp_count_stddev
predictExpStaticDF = predictExpStaticFeatures.toPandas()
#
print("总耗时:{} mins".format((time.time() - start)/60)) print("总耗时:{} mins".format((time.time() - start)/60))
spark.stop() spark.stop()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment