Commit f25887eb authored by 张彦钊's avatar 张彦钊

add function save dataset_device_id,change main for train

parent 413961fe
......@@ -94,17 +94,16 @@ def router(device_id):
if __name__ == "__main__":
# TODO 如果耗时小于一分钟,下一次取到的device_id和上一次相同
router("00BBE073-ACE3-4588-9ED8-B35F13D282EB")
# while True:
# start = time.time()
# empty,device_id_list = get_active_users()
# if empty:
# time.sleep(10)
# else:
# for device_id in device_id_list:
# router(device_id)
#
# end = time.time()
# time_cost = (end - start)
# print("耗时{}秒".format(time_cost))
while True:
start = time.time()
empty,device_id_list = get_active_users()
if empty:
time.sleep(10)
else:
for device_id in device_id_list:
router(device_id)
end = time.time()
time_cost = (end - start)
print("耗时{}秒".format(time_cost))
......@@ -60,6 +60,13 @@ def feature_en():
print(cid_df.head(2))
cid_df.to_csv(DIRECTORY_PATH + "data_set_cid.csv", index=False)
# 将device_id 保存。目的是为了判断预测的device_id是否在这个集合里,如果不在,不需要预测
data_set_device_id = data["device_id"].unique()
device_id_df = pd.DataFrame()
device_id_df['device_id'] = data_set_device_id
print("data_set_device_id :")
print(device_id_df.head(2))
device_id_df.to_csv(DIRECTORY_PATH + "device_id.csv", index=False)
return data, test_number, validation_number
......
......@@ -8,6 +8,7 @@ if __name__ == "__main__":
data_fe = feature_en()
ffm_transform(data_fe)
train()
print('---------------prepare candidates--------------')
get_eachCityDiaryTop3000()
print("end")
# print('---------------prepare candidates--------------')
# get_eachCityDiaryTop3000()
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