Commit 5bb516de authored by 张彦钊's avatar 张彦钊

修改测试文件

parent fb95c89f
...@@ -38,7 +38,7 @@ def feature_engineer(): ...@@ -38,7 +38,7 @@ def feature_engineer():
validate_date = con_sql(db, sql)[0].values.tolist()[0] validate_date = con_sql(db, sql)[0].values.tolist()[0]
print("validate_date:" + validate_date) print("validate_date:" + validate_date)
temp = datetime.datetime.strptime(validate_date, "%Y-%m-%d") temp = datetime.datetime.strptime(validate_date, "%Y-%m-%d")
start = (temp - datetime.timedelta(days=3)).strftime("%Y-%m-%d") start = (temp - datetime.timedelta(days=100)).strftime("%Y-%m-%d")
print(start) print(start)
sql = "select e.y,e.z,e.stat_date,e.ucity_id,feat.level2_ids,e.ccity_name,u.device_type,u.manufacturer," \ sql = "select e.y,e.z,e.stat_date,e.ucity_id,feat.level2_ids,e.ccity_name,u.device_type,u.manufacturer," \
...@@ -160,7 +160,7 @@ def get_predict(date,value_map,app_list_map,level2_map,level3_map): ...@@ -160,7 +160,7 @@ def get_predict(date,value_map,app_list_map,level2_map,level3_map):
print("native") print("native")
print(native_pre.count()) print(native_pre.count())
native_pre.write.format("avro").save(path="/recommend", mode="overwrite") native_pre.write.format("avro").save(path="/recommend/pre_native", mode="overwrite")
spark.createDataFrame(rdd.filter(lambda x: x[6] == 0) spark.createDataFrame(rdd.filter(lambda x: x[6] == 0)
.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],
...@@ -174,7 +174,7 @@ def get_predict(date,value_map,app_list_map,level2_map,level3_map): ...@@ -174,7 +174,7 @@ def get_predict(date,value_map,app_list_map,level2_map,level3_map):
.toDF("city", "uid", "cid_id") .toDF("city", "uid", "cid_id")
print("nearby") print("nearby")
print(nearby_pre.count()) print(nearby_pre.count())
nearby_pre.write.format("avro").save(path="/recommend", mode="overwrite") nearby_pre.write.format("avro").save(path="/recommend/pre_nearby", mode="overwrite")
spark.createDataFrame(rdd.filter(lambda x: x[6] == 1) spark.createDataFrame(rdd.filter(lambda x: x[6] == 1)
.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],
......
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