Commit a766cc94 authored by 赵威's avatar 赵威

service id for tractate

parent e9d3ba5a
......@@ -33,7 +33,7 @@ def build_features(df, int_columns, float_columns, categorical_columns, cross_co
elif col in [
"show_tag_id", "click_tractate_id1", "click_tractate_id2", "click_tractate_id3", "click_tractate_id4",
"click_tractate_id5", "click_diary_id1", "click_diary_id2", "click_diary_id3", "click_diary_id4",
"click_diary_id5"
"click_diary_id5", "service_id", "recommend_service_id"
]:
categorical_features.append(
fc.embedding_column(fc.categorical_column_with_hash_bucket(col, 20000), dimension=int(df[col].size**0.25)))
......
......@@ -121,9 +121,11 @@ TRACTATE_COLUMNS = [
"business_second_skip_num",
"effect_second_skip_rate",
"business_second_skip_rate",
"service_id",
"service_price",
"service_sold_num",
"service_city",
"recommend_service_id",
]
INT_COLUMNS = [
......@@ -287,7 +289,9 @@ CATEGORICAL_COLUMNS = [
"click_tractate_id4",
"click_tractate_id5",
"is_related_service",
"service_id",
"service_city",
"recommend_service_id",
# "device_fd2",
# "device_sd2",
# "device_fs2",
......
......@@ -166,7 +166,9 @@ _categorical_columns = [
"click_tractate_id3",
"click_tractate_id4",
"click_tractate_id5",
"service_id",
"service_city",
"recommend_service_id",
# "device_fd2",
# "device_sd2",
# "device_fs2",
......
......@@ -62,7 +62,8 @@ def main():
estimator_config = tf.estimator.RunConfig(session_config=session_config)
model = tf.estimator.Estimator(model_fn=esmm_model_fn, params=params, model_dir=model_path, config=estimator_config)
train_spec = tf.estimator.TrainSpec(input_fn=lambda: esmm_input_fn(train_df, shuffle=True), max_steps=50000)
# TODO 50000
train_spec = tf.estimator.TrainSpec(input_fn=lambda: esmm_input_fn(train_df, shuffle=True), max_steps=15000)
eval_spec = tf.estimator.EvalSpec(input_fn=lambda: esmm_input_fn(val_df, shuffle=False))
res = tf.estimator.train_and_evaluate(model, train_spec, eval_spec)
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
......@@ -77,8 +78,9 @@ def main():
model_export_path = str(Path("/data/files/models/tractate/").expanduser())
save_path = model_export(model, all_features, model_export_path)
print("save to: " + save_path)
set_essm_model_save_path("tractate", save_path)
record_esmm_auc_to_db("tractate", ctr_auc, ctcvr_auc, total_time, save_path)
# TODO save model
# set_essm_model_save_path("tractate", save_path)
# record_esmm_auc_to_db("tractate", ctr_auc, ctcvr_auc, total_time, save_path)
print("============================================================")
# save_path = get_essm_model_save_path("tractate")
......
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