Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
gm_strategy_cvr
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rank
gm_strategy_cvr
Commits
3c6c69fa
Commit
3c6c69fa
authored
Aug 14, 2020
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update tractate fe
parent
39ea1b4f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
180 additions
and
25 deletions
+180
-25
tractate_fe.py
src/models/esmm/fe/tractate_fe.py
+154
-21
tractate_model.py
src/models/esmm/tractate_model.py
+24
-0
train_tractate.py
src/train_tractate.py
+2
-4
No files found.
src/models/esmm/fe/tractate_fe.py
View file @
3c6c69fa
...
...
@@ -6,30 +6,163 @@ from utils.cache import redis_db_client
from
..utils
import
common_elements
,
nth_element
TRACTATE_COLUMNS
=
[
"card_id"
,
"is_pure_author"
,
"is_have_pure_reply"
,
"is_have_reply"
,
"content_level"
,
"show_tag_id"
,
"reply_num"
,
"reply_pure_num"
,
"one_reply_user_num"
,
"three_reply_user_num"
,
"seven_reply_user_num"
,
"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_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"
"card_id"
,
"is_pure_author"
,
"is_have_pure_reply"
,
"is_have_reply"
,
"content_level"
,
"show_tag_id"
,
"reply_num"
,
"reply_pure_num"
,
"one_reply_user_num"
,
"three_reply_user_num"
,
"seven_reply_user_num"
,
"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
=
[
"active_days"
,
"reply_num"
,
"reply_pure_num"
,
"one_reply_user_num"
,
"three_reply_user_num"
,
"seven_reply_user_num"
,
"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"
"active_days"
,
"reply_num"
,
"reply_pure_num"
,
"one_reply_user_num"
,
"three_reply_user_num"
,
"seven_reply_user_num"
,
"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"
,
]
FLOAT_COLUMNS
=
[
"one_ctr"
,
"three_ctr"
,
"seven_ctr"
,
"fifteen_ctr"
,
"thirty_ctr"
,
"sixty_ctr"
,
"ninety_ctr"
,
"history_ctr"
]
CATEGORICAL_COLUMNS
=
[
...
...
src/models/esmm/tractate_model.py
View file @
3c6c69fa
...
...
@@ -55,6 +55,30 @@ _int_columns = [
"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"
]
_categorical_columns
=
[
...
...
src/train_tractate.py
View file @
3c6c69fa
...
...
@@ -58,8 +58,7 @@ 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
)
# TODO 50000
train_spec
=
tf
.
estimator
.
TrainSpec
(
input_fn
=
lambda
:
esmm_input_fn
(
train_df
,
shuffle
=
True
),
max_steps
=
20000
)
train_spec
=
tf
.
estimator
.
TrainSpec
(
input_fn
=
lambda
:
esmm_input_fn
(
train_df
,
shuffle
=
True
),
max_steps
=
50000
)
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
(
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
)
...
...
@@ -71,8 +70,7 @@ def main():
model_export_path
=
str
(
Path
(
"~/data/models/tractate/"
)
.
expanduser
())
save_path
=
model_export
(
model
,
all_features
,
model_export_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
(
"============================================================"
)
# # save_path = str(Path("~/data/models/tractate/1596089465").expanduser()) # local
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment