Commit 751ba854 authored by 张彦钊's avatar 张彦钊

fix train main function

parent f25887eb
......@@ -100,9 +100,12 @@ if __name__ == "__main__":
if empty:
time.sleep(10)
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:
router(device_id)
else:
print("该用户不是老用户,不能预测")
end = time.time()
time_cost = (end - start)
print("耗时{}秒".format(time_cost))
......
......@@ -66,7 +66,7 @@ def feature_en():
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)
device_id_df.to_csv(DIRECTORY_PATH + "data_set_device_id.csv", index=False)
return data, test_number, validation_number
......
......@@ -5,10 +5,9 @@ from diaryCandidateSet import get_eachCityDiaryTop3000
# 把数据获取、特征转换、模型训练的模型串联在一起
if __name__ == "__main__":
data_fe = feature_en()
ffm_transform(data_fe)
data, test_number, validation_number = feature_en()
ffm_transform(data, test_number, validation_number)
train()
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