Commit 9c7565b7 authored by 张彦钊's avatar 张彦钊

add note for test

parent 6a44a1fc
......@@ -177,16 +177,16 @@ def predict_save_to_local(user_profile, instance):
def predict(user_profile):
instance = feature_en(user_profile)
instance_file_path = transform_ffm_format(instance, user_profile["device_id"])
ffm_model = xl.create_ffm()
ffm_model.setTest(instance_file_path)
ffm_model.setSigmoid()
ffm_model.predict(DIRECTORY_PATH + "model_{0}-{1}_lr{2}_lambda{3}.out".format(DATA_START_DATE,
DATA_END_DATE, lr, l2_lambda),
DIRECTORY_PATH + "result/{0}_output.txt".format(user_profile['device_id']))
print("预测结束")
predict_save_to_local(user_profile, instance)
# instance_file_path = transform_ffm_format(instance, user_profile["device_id"])
#
# ffm_model = xl.create_ffm()
# ffm_model.setTest(instance_file_path)
# ffm_model.setSigmoid()
# ffm_model.predict(DIRECTORY_PATH + "model_{0}-{1}_lr{2}_lambda{3}.out".format(DATA_START_DATE,
# DATA_END_DATE, lr, l2_lambda),
# DIRECTORY_PATH + "result/{0}_output.txt".format(user_profile['device_id']))
# print("预测结束")
# predict_save_to_local(user_profile, instance)
def router(device_id):
user_profile, not_exist = fetch_user_profile(device_id)
......@@ -209,10 +209,10 @@ if __name__ == "__main__":
# router(device_id)
user_profile, not_exist = fetch_user_profile(device_id)
# if not_exist == 1:
# print('Sorry, we don\'t have you.')
# else:
# predict(user_profile)
if not_exist == 1:
print('Sorry, we don\'t have you.')
else:
predict(user_profile)
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