Commit e24d26a6 authored by 赵威's avatar 赵威

update auc info to db

parent 795c2040
...@@ -79,7 +79,7 @@ def main(): ...@@ -79,7 +79,7 @@ def main():
save_path = model_export(model, all_features, model_export_path) save_path = model_export(model, all_features, model_export_path)
print("save to: " + save_path) print("save to: " + save_path)
set_essm_model_save_path("diary", save_path) set_essm_model_save_path("diary", save_path)
record_esmm_auc_to_db("diary", ctr_auc, ctcvr_auc, total_time) record_esmm_auc_to_db("diary", ctr_auc, ctcvr_auc, total_time, save_path)
print("============================================================") print("============================================================")
# save_path = str(Path("~/Desktop/models/1596012827").expanduser()) # local # save_path = str(Path("~/Desktop/models/1596012827").expanduser()) # local
......
...@@ -75,7 +75,7 @@ def main(): ...@@ -75,7 +75,7 @@ def main():
save_path = model_export(model, all_features, model_export_path) save_path = model_export(model, all_features, model_export_path)
print("save to: " + save_path) print("save to: " + save_path)
set_essm_model_save_path("tractate", save_path) set_essm_model_save_path("tractate", save_path)
record_esmm_auc_to_db("tractate", ctr_auc, ctcvr_auc, total_time) record_esmm_auc_to_db("tractate", ctr_auc, ctcvr_auc, total_time, save_path)
print("============================================================") print("============================================================")
# save_path = get_essm_model_save_path("tractate") # save_path = get_essm_model_save_path("tractate")
......
...@@ -20,13 +20,14 @@ def _write_data_to_mysql(host, port, user, passwd, db, sql): ...@@ -20,13 +20,14 @@ def _write_data_to_mysql(host, port, user, passwd, db, sql):
# `ctr_auc` text NOT NULL, # `ctr_auc` text NOT NULL,
# `ctcvr_auc` text NOT NULL, # `ctcvr_auc` text NOT NULL,
# `cost` text NOT NULL, # `cost` text NOT NULL,
# `save_path` text NOT NULL,
# `date` datetime, # `date` datetime,
# PRIMARY KEY(`id`) # PRIMARY KEY(`id`)
# ) # )
def record_esmm_auc_to_db(content_type, ctr_auc, ctcvr_auc, cost): def record_esmm_auc_to_db(content_type, ctr_auc, ctcvr_auc, cost, save_path):
dt = datetime.datetime.now() dt = datetime.datetime.now()
t = dt.strftime("%Y-%m-%d %H:%M:%S") t = dt.strftime("%Y-%m-%d %H:%M:%S")
sql = """ sql = """
INSERT INTO esmm_auc_log(content_type, ctr_auc, ctcvr_auc, cost, date) VALUES ('{}', '{}', '{}', '{}', '{}') INSERT INTO esmm_auc_log(content_type, ctr_auc, ctcvr_auc, cost, save_path, date) VALUES ('{}', '{}', '{}', '{}', '{}', '{}')
""".format(content_type, ctr_auc, ctcvr_auc, cost, t) """.format(content_type, ctr_auc, ctcvr_auc, cost, save_path, t)
return _write_data_to_mysql("172.16.40.170", 4000, "st_user", "aqpuBLYzEV7tML5RPsN1pntUzFy", "jerry_test", sql) return _write_data_to_mysql("172.16.40.170", 4000, "st_user", "aqpuBLYzEV7tML5RPsN1pntUzFy", "jerry_test", sql)
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