Commit 22d0ce14 authored by 张彦钊's avatar 张彦钊

把最近一天的数据集放进训练集

parent 759b7930
...@@ -141,10 +141,13 @@ def get_predict(date,value_map,app_list_map,level2_map,level3_map): ...@@ -141,10 +141,13 @@ def get_predict(date,value_map,app_list_map,level2_map,level3_map):
"recover_time","top") \ "recover_time","top") \
.rdd.map(lambda x: (app_list_func(x[0], app_list_map), app_list_func(x[1], level2_map), .rdd.map(lambda x: (app_list_func(x[0], app_list_map), app_list_func(x[1], level2_map),
app_list_func(x[2], level3_map), x[3],x[4],x[5],x[6],x[7],x[8], app_list_func(x[2], level3_map), x[3],x[4],x[5],x[6],x[7],x[8],
value_map[x[3]], value_map[x[9]], value_map.get(x[3], 300000),value_map.get(x[9], 299999),
value_map[x[10]], value_map[x[11]], value_map[x[12]], value_map[x[13]], value_map.get(x[10], 299998), value_map.get(x[11], 299997),
value_map[x[14]], value_map[x[15]], value_map[x[16]], value_map[x[17]], value_map.get(x[12], 299996), value_map.get(x[13], 299995),
value_map[x[18]], value_map[x[19]], value_map[x[20]], value_map.get(x[21],30000), value_map.get(x[14], 299994),value_map.get(x[15], 299993),
value_map.get(x[16], 299992),value_map.get(x[17], 299991),
value_map.get(x[18], 299990),value_map.get(x[19], 299989),
value_map.get(x[20], 299988),value_map.get(x[21], 299987),
value_map[date])) value_map[date]))
rdd.persist() rdd.persist()
...@@ -173,9 +176,9 @@ def get_predict(date,value_map,app_list_map,level2_map,level3_map): ...@@ -173,9 +176,9 @@ def get_predict(date,value_map,app_list_map,level2_map,level3_map):
.map(lambda x: (x[0], x[1], x[2], x[9], x[10], x[11], x[12], x[13], x[14], x[15], .map(lambda x: (x[0], x[1], x[2], x[9], x[10], x[11], x[12], x[13], x[14], x[15],
x[16, x[17], x[18], x[19], x[20], x[21], x[22], x[23]]))) \ x[16, x[17], x[18], x[19], x[20], x[21], x[22], x[23]]))) \
.toDF("app_list", "level2_ids", "level3_ids", "ucity_id", .toDF("app_list", "level2_ids", "level3_ids", "ucity_id",
"ccity_name", "device_type", "manufacturer", "channel", "top", "time", "hospital_id", "ccity_name", "device_type", "manufacturer", "channel", "time", "hospital_id",
"treatment_method", "price_min", "price_max", "treatment_time", "maintain_time", "treatment_method", "price_min", "price_max", "treatment_time", "maintain_time",
"recover_time","stat_date").write.csv('/recommend/nearby', mode='overwrite', header=True) "recover_time","top","stat_date").write.csv('/recommend/nearby', mode='overwrite', header=True)
rdd.unpersist() rdd.unpersist()
......
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