Commit 3c6c69fa authored by 赵威's avatar 赵威

update tractate fe

parent 39ea1b4f
...@@ -6,30 +6,163 @@ from utils.cache import redis_db_client ...@@ -6,30 +6,163 @@ from utils.cache import redis_db_client
from ..utils import common_elements, nth_element from ..utils import common_elements, nth_element
TRACTATE_COLUMNS = [ TRACTATE_COLUMNS = [
"card_id", "is_pure_author", "is_have_pure_reply", "is_have_reply", "content_level", "show_tag_id", "reply_num", "card_id",
"reply_pure_num", "one_reply_user_num", "three_reply_user_num", "seven_reply_user_num", "fifteen_reply_user_num", "is_pure_author",
"thirty_reply_user_num", "sixty_reply_user_num", "ninety_reply_user_num", "history_reply_user_num", "one_reply_num", "is_have_pure_reply",
"three_reply_num", "seven_reply_num", "fifteen_reply_num", "thirty_reply_num", "sixty_reply_num", "ninety_reply_num", "is_have_reply",
"history_reply_num", "one_click_num", "three_click_num", "seven_click_num", "fifteen_click_num", "thirty_click_num", "content_level",
"sixty_click_num", "ninety_click_num", "history_click_num", "one_precise_exposure_num", "three_precise_exposure_num", "show_tag_id",
"seven_precise_exposure_num", "fifteen_precise_exposure_num", "thirty_precise_exposure_num", "sixty_precise_exposure_num", "reply_num",
"ninety_precise_exposure_num", "history_precise_exposure_num", "one_vote_user_num", "three_vote_user_num", "reply_pure_num",
"seven_vote_user_num", "fifteen_vote_user_num", "thirty_vote_user_num", "sixty_vote_user_num", "ninety_vote_user_num", "one_reply_user_num",
"history_vote_user_num", "one_ctr", "three_ctr", "seven_ctr", "fifteen_ctr", "thirty_ctr", "sixty_ctr", "ninety_ctr", "three_reply_user_num",
"history_ctr", "first_demands", "second_demands", "first_solutions", "second_solutions", "first_positions", "seven_reply_user_num",
"second_positions", "projects" "fifteen_reply_user_num",
"thirty_reply_user_num",
"sixty_reply_user_num",
"ninety_reply_user_num",
"history_reply_user_num",
"one_reply_num",
"three_reply_num",
"seven_reply_num",
"fifteen_reply_num",
"thirty_reply_num",
"sixty_reply_num",
"ninety_reply_num",
"history_reply_num",
"one_click_num",
"three_click_num",
"seven_click_num",
"fifteen_click_num",
"thirty_click_num",
"sixty_click_num",
"ninety_click_num",
"history_click_num",
"one_precise_exposure_num",
"three_precise_exposure_num",
"seven_precise_exposure_num",
"fifteen_precise_exposure_num",
"thirty_precise_exposure_num",
"sixty_precise_exposure_num",
"ninety_precise_exposure_num",
"history_precise_exposure_num",
"one_vote_user_num",
"three_vote_user_num",
"seven_vote_user_num",
"fifteen_vote_user_num",
"thirty_vote_user_num",
"sixty_vote_user_num",
"ninety_vote_user_num",
"history_vote_user_num",
"one_browse_user_num",
"three_browse_user_num",
"seven_browse_user_num",
"fifteen_browse_user_num",
"thirty_browse_user_num",
"sixty_browse_user_num",
"ninety_browse_user_num",
"history_browse_user_num",
"one_vote_pure_rate",
"three_vote_pure_rate",
"seven_vote_pure_rate",
"fifteen_vote_pure_rate",
"thirty_vote_pure_rate",
"sixty_vote_pure_rate",
"ninety_vote_pure_rate",
"history_vote_pure_rate",
"one_reply_pure_rate",
"three_reply_pure_rate",
"seven_reply_pure_rate",
"fifteen_reply_pure_rate",
"thirty_reply_pure_rate",
"sixty_reply_pure_rate",
"ninety_reply_pure_rate",
"history_reply_pure_rate",
"one_ctr",
"three_ctr",
"seven_ctr",
"fifteen_ctr",
"thirty_ctr",
"sixty_ctr",
"ninety_ctr",
"history_ctr",
"first_demands",
"second_demands",
"first_solutions",
"second_solutions",
"first_positions",
"second_positions",
"projects",
] ]
INT_COLUMNS = [ INT_COLUMNS = [
"active_days", "reply_num", "reply_pure_num", "one_reply_user_num", "three_reply_user_num", "seven_reply_user_num", "active_days",
"fifteen_reply_user_num", "thirty_reply_user_num", "sixty_reply_user_num", "ninety_reply_user_num", "history_reply_user_num", "reply_num",
"one_reply_num", "three_reply_num", "seven_reply_num", "fifteen_reply_num", "thirty_reply_num", "sixty_reply_num", "reply_pure_num",
"ninety_reply_num", "history_reply_num", "one_click_num", "three_click_num", "seven_click_num", "fifteen_click_num", "one_reply_user_num",
"thirty_click_num", "sixty_click_num", "ninety_click_num", "history_click_num", "one_precise_exposure_num", "three_reply_user_num",
"three_precise_exposure_num", "seven_precise_exposure_num", "fifteen_precise_exposure_num", "thirty_precise_exposure_num", "seven_reply_user_num",
"sixty_precise_exposure_num", "ninety_precise_exposure_num", "history_precise_exposure_num", "one_vote_user_num", "fifteen_reply_user_num",
"three_vote_user_num", "seven_vote_user_num", "fifteen_vote_user_num", "thirty_vote_user_num", "sixty_vote_user_num", "thirty_reply_user_num",
"ninety_vote_user_num", "history_vote_user_num" "sixty_reply_user_num",
"ninety_reply_user_num",
"history_reply_user_num",
"one_reply_num",
"three_reply_num",
"seven_reply_num",
"fifteen_reply_num",
"thirty_reply_num",
"sixty_reply_num",
"ninety_reply_num",
"history_reply_num",
"one_click_num",
"three_click_num",
"seven_click_num",
"fifteen_click_num",
"thirty_click_num",
"sixty_click_num",
"ninety_click_num",
"history_click_num",
"one_precise_exposure_num",
"three_precise_exposure_num",
"seven_precise_exposure_num",
"fifteen_precise_exposure_num",
"thirty_precise_exposure_num",
"sixty_precise_exposure_num",
"ninety_precise_exposure_num",
"history_precise_exposure_num",
"one_vote_user_num",
"three_vote_user_num",
"seven_vote_user_num",
"fifteen_vote_user_num",
"thirty_vote_user_num",
"sixty_vote_user_num",
"ninety_vote_user_num",
"history_vote_user_num"
"one_browse_user_num",
"three_browse_user_num",
"seven_browse_user_num",
"fifteen_browse_user_num",
"thirty_browse_user_num",
"sixty_browse_user_num",
"ninety_browse_user_num",
"history_browse_user_num",
"one_vote_pure_rate",
"three_vote_pure_rate",
"seven_vote_pure_rate",
"fifteen_vote_pure_rate",
"thirty_vote_pure_rate",
"sixty_vote_pure_rate",
"ninety_vote_pure_rate",
"history_vote_pure_rate",
"one_reply_pure_rate",
"three_reply_pure_rate",
"seven_reply_pure_rate",
"fifteen_reply_pure_rate",
"thirty_reply_pure_rate",
"sixty_reply_pure_rate",
"ninety_reply_pure_rate",
"history_reply_pure_rate",
] ]
FLOAT_COLUMNS = ["one_ctr", "three_ctr", "seven_ctr", "fifteen_ctr", "thirty_ctr", "sixty_ctr", "ninety_ctr", "history_ctr"] FLOAT_COLUMNS = ["one_ctr", "three_ctr", "seven_ctr", "fifteen_ctr", "thirty_ctr", "sixty_ctr", "ninety_ctr", "history_ctr"]
CATEGORICAL_COLUMNS = [ CATEGORICAL_COLUMNS = [
......
...@@ -55,6 +55,30 @@ _int_columns = [ ...@@ -55,6 +55,30 @@ _int_columns = [
"sixty_vote_user_num", "sixty_vote_user_num",
"ninety_vote_user_num", "ninety_vote_user_num",
"history_vote_user_num", "history_vote_user_num",
"one_browse_user_num",
"three_browse_user_num",
"seven_browse_user_num",
"fifteen_browse_user_num",
"thirty_browse_user_num",
"sixty_browse_user_num",
"ninety_browse_user_num",
"history_browse_user_num",
"one_vote_pure_rate",
"three_vote_pure_rate",
"seven_vote_pure_rate",
"fifteen_vote_pure_rate",
"thirty_vote_pure_rate",
"sixty_vote_pure_rate",
"ninety_vote_pure_rate",
"history_vote_pure_rate",
"one_reply_pure_rate",
"three_reply_pure_rate",
"seven_reply_pure_rate",
"fifteen_reply_pure_rate",
"thirty_reply_pure_rate",
"sixty_reply_pure_rate",
"ninety_reply_pure_rate",
"history_reply_pure_rate",
] ]
_float_columns = ["one_ctr", "three_ctr", "seven_ctr", "fifteen_ctr", "thirty_ctr", "sixty_ctr", "ninety_ctr", "history_ctr"] _float_columns = ["one_ctr", "three_ctr", "seven_ctr", "fifteen_ctr", "thirty_ctr", "sixty_ctr", "ninety_ctr", "history_ctr"]
_categorical_columns = [ _categorical_columns = [
......
...@@ -58,8 +58,7 @@ def main(): ...@@ -58,8 +58,7 @@ def main():
estimator_config = tf.estimator.RunConfig(session_config=session_config) 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) model = tf.estimator.Estimator(model_fn=esmm_model_fn, params=params, model_dir=model_path, config=estimator_config)
# TODO 50000 train_spec = tf.estimator.TrainSpec(input_fn=lambda: esmm_input_fn(train_df, shuffle=True), max_steps=50000)
train_spec = tf.estimator.TrainSpec(input_fn=lambda: esmm_input_fn(train_df, shuffle=True), max_steps=20000)
eval_spec = tf.estimator.EvalSpec(input_fn=lambda: esmm_input_fn(val_df, shuffle=False)) 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) res = tf.estimator.train_and_evaluate(model, train_spec, eval_spec)
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@") print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
...@@ -71,8 +70,7 @@ def main(): ...@@ -71,8 +70,7 @@ def main():
model_export_path = str(Path("~/data/models/tractate/").expanduser()) model_export_path = str(Path("~/data/models/tractate/").expanduser())
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)
# TODO save model set_essm_model_save_path("tractate", save_path)
# set_essm_model_save_path("tractate", save_path)
print("============================================================") print("============================================================")
# # save_path = str(Path("~/data/models/tractate/1596089465").expanduser()) # local # # save_path = str(Path("~/data/models/tractate/1596089465").expanduser()) # local
......
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