Commit 0de4ac9f authored by 张彦钊's avatar 张彦钊

delete prints

parent 3dd5cceb
...@@ -23,8 +23,6 @@ def feature_en(user_profile): ...@@ -23,8 +23,6 @@ def feature_en(user_profile):
# 虽然预测y,但ffm转化需要y,并不影响预测结果 # 虽然预测y,但ffm转化需要y,并不影响预测结果
data["y"] = 0 data["y"] = 0
data = data.drop("city_id", axis=1) data = data.drop("city_id", axis=1)
print(data.head(1))
print("特征工程处理结束")
return data return data
...@@ -90,7 +88,7 @@ def router(device_id): ...@@ -90,7 +88,7 @@ def router(device_id):
# 多进程预测 # 多进程预测
def multi_predict(predict_list,processes=8): def multi_predict(predict_list,processes=12):
pool = Pool(processes) pool = Pool(processes)
for device_id in predict_list: for device_id in predict_list:
start = time.time() start = time.time()
...@@ -101,6 +99,7 @@ def multi_predict(predict_list,processes=8): ...@@ -101,6 +99,7 @@ def multi_predict(predict_list,processes=8):
pool.close() pool.close()
pool.join() pool.join()
if __name__ == "__main__": if __name__ == "__main__":
# TODO 如果耗时小于一分钟,下一次取到的device_id和上一次相同 # TODO 如果耗时小于一分钟,下一次取到的device_id和上一次相同
while True: while True:
...@@ -116,23 +115,6 @@ if __name__ == "__main__": ...@@ -116,23 +115,6 @@ if __name__ == "__main__":
predict_list = list(set(device_id_list) & set(old_device_id_list)) predict_list = list(set(device_id_list) & set(old_device_id_list))
multi_predict(predict_list) multi_predict(predict_list)
# while True:
# empty,device_id_list = get_active_users()
# if empty:
# for eachFile in os.listdir("/tmp"):
# if "xlearn" in eachFile:
# os.remove("/tmp" + "/" + eachFile)
# time.sleep(58)
# else:
# old_device_id_list = pd.read_csv(DIRECTORY_PATH + "data_set_device_id.csv")["device_id"].values.tolist()
# for device_id in device_id_list:
# if device_id in old_device_id_list:
# start = time.time()
# router(device_id)
# end = time.time()
# print("该用户预测耗时{}秒".format(end - start))
# else:
# print("该用户不是老用户,不能预测")
......
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